Linux+jenkins deployment and installation

Operating System:  CentOS Linux release 6.5

Software version:  jdk-8u161-linux-x64 apache-tomcat-apache-tomcat-7.0.73 jenkins-2.109

Experimental conditions:  Turn off the firewall, and enable iptables to access port 80 / 8080 of the host

1. Install jenkins

1. Download jenkins

      Here I choose the war package to install jenkins, which is simple and not mind-boggling, and uses the latest jenkins-2.109.war

  Official website: https://jenkins.io/index.html Select the war package to download;

       You can select the jenkins package to download at http://mirrors.tuna.tsinghua.edu.cn/jenkins/war;

       

2. Install the jdk environment

     The latest JDK download address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  jdk-8u161-linux-x64.tar.gz
     Here select the copy and download link of Linux64-bit suffix tar.gz, decompress and configure the environment variable vim /etc/profile on the server and write it at the end

     JAVA_HOME=/data/java/jdk directory name #java directory is created by me, unzip the jdk package into it, the absolute path to write the unzip location
     CLASSPATH=$JAVA_HOME/lib/
  PATH=$JAVA_HOME/bin:$PATH # Be careful, if the PATH is wrongly written here, you will find that the command must be used with an absolute path. Sadly,
  export PATH JAVA_HOME CLASSPATH

      The configuration is complete and saved without any problem. Source /etc/profile makes the configured environment variables take effect. At this time, you can run the command java -version to see if the version is java version "1.8.0_***", if it is 1.6 or something It does not take effect, look at the decompression path.

3. Install tomcat

     Download address: http://mirrors.hust.edu.cn/apache/tomcat Select tomcat to download

  This version can be used, don't be too old, the old version will have loopholes, after the decompression is complete, try to see if it can be used, in the bin directory of the tomcat directory, start sh startup.sh, visit it, the inability to access is basically a firewall problem, can You can stop when the tom cat interface appears, you can sh shutdown.sh, you can also find the pid number of the process ps -ef |grep tomcat, kill -9 pid number, go to the webapps directory to delete all, and copy the previous jenkins.war Come in, start tomcat. I use port 8080 to access the address http://IP address:8080/jenkins

On the server, cat /root/.jenkins/secrets/initialAdminPassword will show the entered password, a string of numbers and letters, wait for a while until the following interface appears, drink saliva, three minutes have passed, and the next interface will appear

This means that it is recommended to install or choose by yourself. The package you need can be installed later. I clicked the first one, and I know what plug-in to use and the second one can also be installed in this way. There are fewer packages. The installed plugins are all under /root/.jenkins/plugins/.

 

 

 

Get started, click to enter

 

     If the user is not set to enter, the admin user does not know what the password is when logging in. It is the password in /root/.jenkins/secrets/initialAdminPassword, http://this place hit ip:8080/jenkins/user/admin/configure to modify admin password, you can also click system management, find the management user in it, click admin at the top of the screen, go to the bottom, change the password and save it.

 

4. Solutions to errors encountered:

Using jenkins under linux basically cannot update the plug-in, it must be configured separately

1. Update path: /root/.jenkins/hudson.model.UpdateCenter.xml or System Management->Plugin Management->Advanced->Update Site URL
http://updates.jenkins-ci.org/update-center.json ==>http://mirror.xmission.com/jenkins/updates/update-center.json

2./etc/hosts add domain name resolution 

101.6.6.177  mirrors.tuna.tsinghua.edu.cn
198.60.22.13 mirror.xmission.com
52.202.51.185 updates.jenkins-ci.org
52.202.51.185 mirrors.jenkins-ci.org
202.121.199.235 mirrors.shu.edu.cn

5. Common plugins

Select the one that created the maven project: maven integration plugins 

The name of the SVN plugin is: Subversion Plug-in

Automatic deployment requires a container, so how does Jenkins know about your container? Container plugin: deploy to container plugin

email plugin, this plugin is a replacement for Jenkins email publisher. It allows to configure every aspect of email notifications: when an email is sent, who gets it and what the email says: Email Extension Plugin

A better way to automate the deployment of tomcat is to use a script to shut down tomcat, then delete the old deployment application under webapps, put the new war package over, and then start

So, we need to use another plugin here: PostBuildScript:

Remotely publish SSH plugin and plugin Ant Plugin 

Publish Over SSH  Instructions: This plugin can connect to other Linux machines via ssh:

Configure the ssh host information password in the settings:

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325243225&siteId=291194637