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
[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 ~]# 
[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
[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

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

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:\/\/\//http:\/\/\//g' /root/.jenkins/updates/default.json 
[root@jenkins ~]# sed -i 's#' /root/.jenkins/updates/default.json 
[root@jenkins ~]#
[root@jenkins ~]# 
[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