Jenkins deployed in war package mode

1, Deploy Jenkins

#Install Tomcat as middleware
#Need JDK environment above Java 1.8
[root@jenkins /]# java -version 
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
#Deploying Tomcat
[root@jenkins ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.100/bin/apache-tomcat-7.0.100.tar.gz
[root@jenkins ~]# tar zxf apache-tomcat-7.0.100.tar.gz 
[root@jenkins ~]# mv apache-tomcat-7.0.100/ /usr/local/tomcat
[root@jenkins ~]# echo  'export CATALINA_HOME=/usr/local/tomcat' >> /etc/profile
[root@jenkins ~]# echo 'export PATH=$CATALINA_HOME/bin:$PATH' >> /etc/profile
[root@jenkins ~]# source /etc/profile
[root@jenkins /]# vim /usr/local/tomcat/conf/server.xml           # Modify tomcat port number
<Connector port="8081" protocol="HTTP/1.1"
[root@jenkins ~]# startup.sh 
[root@jenkins ~]# netstat -anput | grep 8081
tcp6       0      0 :::8081                 :::*                    LISTEN      3006/java    
#When Jenkins' war package is put into middleware, it will be deployed automatically, so we can check the log to see the installation status
[root@jenkins /]# tail -f /usr/local/tomcat/logs/

[root@jenkins ~]# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
[root@jenkins ~]# cp jenkins.war /usr/local/tomcat/webapps/            # Copy to tomcat project directory
#A line of administrator password will appear during automatic deployment
[root@jenkins ~]# cat /root/.jenkins/secrets/initialAdminPassword           # You can also determine the password by viewing this file
ca281fb7866b4cc588c58a8c9d309b7d


After the key input is completed, we need to install the plug-in. If the report is red on the way to install, wait for him to install other plug-ins, and then click to reinstall again

————Additional————
If you think the installation of the plug-in is too slow, you can try to replace its image source. Because Jenkins uses a foreign image source by default, it will be slow. Here we can change it to Tsinghua image source

#After Jenkins is installed, a hidden directory will be created in the root directory
[root@jenkins ~]# sed -i 's/http:\/\/www.google.com\//http:\/\/www.baidu.com\//g' /root/.jenkins/updates/default.json 
[root@jenkins ~]# sed -i 's#http://updates.jenkins-ci.org/download/#https://mirrors.tuna.tsinghua.edu.cn/jenkins/#g' /root/.jenkins/updates/default.json 
[root@jenkins ~]# shutdown.sh
[root@jenkins ~]# startup.sh 
[root@jenkins ~]# tail -f /usr/local/tomcat/logs/catalina.out           # View health
#Visit the Jenkins web page again and re-enter the password to install the plug-in

————Attach end————


Tags: jenkins Tomcat Apache Java

Posted on Fri, 20 Mar 2020 13:07:49 -0700 by shinichi_nguyen