Prerequisite: To install Tomcat first, please refer to the previously written blog post on Centos7 to install Tomcat
http://12395331.blog.51cto.com/12385331/1884980
Installing Jenkins
1> Download the Jenkins package.
Enter the tomcat/webapps/directory, download the Jenkins.war package here, the following problems can be downloaded to this directory, the deployment of the process is not down for half a day, providing Jenkins accessories
wget Http://mirrors.jenkins-ci.org/war/latest/jenkins.war
2> jekins environment variable settings
[email protected] bin]# sudo vi/etc/profile export jenkins_home=/data/program/tomcat/webapps/jenkins [[email P Rotected] bin]#. /etc/profile #使配置文件生效
3> Modifying the Tomcat default port number
Vi/usr/local/apache-tomcat/conf/server.xml
Modify the following section of the port modified to not 8080 of the other ports, here is modified to 8081, there is a condition: in the previous modification of the Iptables rule file has opened 8081 of the port, if not please re-modify, restart the Iptables service.
<connector port= "8080" protocol= "http/1.1" connectiontimeout= "20000" redirectport= "8443"/>
4> reboot Tomcat to enter the bin directory under Tomcat's installation directory
[Email protected] bin]#./startup.sh
Tomcat will unzip the war package, generate a Jenkins folder, and generate a. Jenkins folder in the root directory
5> Jenkins verification. in the browser, enter the URL: http://localhost:8081/jenkins
6> Enter the password for the first time enter Jenkins. To enter a password
Password location:/root/.jenkins/secrets/initialadminpassword, find this file is not found. -name. Jenkins
7> Installing the required plugins
The first entry, will appear the default plug-in installation is not successful, into the plug-in management list is also empty, click on the Advanced Checknow, you can output available list, try several times. In addition to the basic installation of plug-ins, the main installed plugins are: git, git Client, Gitlab hook, etc.
Installing Ansible
Prerequisite: The version of Python that must be installed in the Ansible system to be installed is at 2.7 and above.
1> Ansible is part of the extra Packages for Enterprise Linux (EPEL) library, so install EPEL first
[email protected] ~]# Yum install Epel-release
2> directly installs the Ansible, the currently installed version of the default is 2.2, the official continued in the update
[email protected] ~]# Yum install ansible
3> to support Windows client, install the following package: Install the Python winrm module
Pip Install "pywinrm>=0.1.1"
4> The underlying communication is based on PowerShell, and the management and remote hosts are Kerbero-certified and require additional installation of the Python-kerbero and MIT krb5 dependent libraries.
Step 1, install the Python-kerberos dependency, the command is as follows:
Yum-y Install python-devel krb5-devel krb5-libs krb5-workstation
Step 2, install PYTHON-KERBEROS,OSX and Linux distributions are installed by default, the installation command is as follows:
Pip Install Kerberos
problems encountered and their solutions :
1. Port conflict, Tomcat's port changed to 8081. The 8080 port is the internal port that Jenkins comes with, which is also the purpose of the above steps to change 8081.
2. After the Tomcat service starts, the page does not load properly. Workaround: Systemctl start Tomcat.service. Enter into/usr/local/tomcat/bin,./startup.sh so that starting Tomcat can be solved.
This article is from the "ntting" blog, make sure to keep this source http://ntting.blog.51cto.com/12385331/1885015
Build jenkins+ansible server on the CENTOS7