Linux安装jenkins(war包方式安装)

1.下载Jenkins
官方网站:https://www.jenkins.io/download/
直接下载war包
Linux安装jenkins(war包方式安装)2.安装java并配置jenkins启动目录

[root@nmhs-pp-mw049181 ~]# yum install java -y
[root@nmhs-pp-mw049181 ~]# java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode
[root@nmhs-pp-mw049181 ~]$ cat /etc/profile
#Jenkins
export JENKINS_HOME=/data/jenkins
[root@nmhs-pp-mw049181 ~]$ source /etc/profile

3.启动jenkins

[root@nmhs-pp-mw049181 ~]# nohup java -jar /data/jenkins/jenkins.war --ajp13Port=-1 --httpPort=8888 > /data/jenkins/jenkins.log &
#自定义端口为8888
--ajp13Port=-1 --httpPort=8888
[root@nmhs-pp-mw049181 ~]# ll /data/jenkins/
total 65860
drwxrwx---  3 yundiao yundiao     4096 Jan  3 16:50 caches
-rw-rw----  1 yundiao yundiao     1644 Jan  3 16:45 config.xml
-rw-rw----  1 yundiao yundiao      156 Jan  3 16:30 hudson.model.UpdateCenter.xml
-rw-rw----  1 yundiao yundiao     1243 Jan  3 16:45 hudson.plugins.emailext.ExtendedEmailPublisher.xml
-rw-rw----  1 yundiao yundiao      370 Jan  3 16:42 hudson.plugins.git.GitTool.xml
-rw-------  1 yundiao yundiao     1712 Dec 31 15:25 identity.key.enc
-rw-rw----  1 yundiao yundiao        7 Jan  3 16:45 jenkins.install.InstallUtil.lastExecVersion
-rw-rw----  1 yundiao yundiao        7 Jan  3 16:45 jenkins.install.UpgradeWizard.state
-rw-rw----  1 yundiao yundiao    49029 Jan  3 16:50 jenkins.log
-rw-rw----  1 yundiao yundiao      183 Jan  3 16:45 jenkins.model.JenkinsLocationConfiguration.xml
-rw-rw----  1 yundiao yundiao      171 Dec 31 15:25 jenkins.telemetry.Correlator.xml
-rw-r--r--  1 yundiao yundiao 67270143 Dec 30 15:33 jenkins.war
drwxrwx---  3 yundiao yundiao     4096 Jan  3 16:49 jobs
drwxrwx---  3 yundiao yundiao     4096 Dec 31 15:25 logs
-rw-rw----  1 yundiao yundiao      907 Jan  3 16:30 nodeMonitors.xml
drwxrwx---  2 yundiao yundiao     4096 Dec 31 15:25 nodes
-rw-rw----  1 yundiao yundiao       46 Jan  3 16:50 org.jenkinsci.plugins.workflow.flow.FlowExecutionList.xml
drwxrwx--- 80 yundiao yundiao    12288 Jan  3 16:48 plugins
-rw-rw----  1 yundiao yundiao      129 Jan  3 16:50 queue.xml
-rw-rw----  1 yundiao yundiao      129 Jan  3 16:29 queue.xml.bak
-rw-rw----  1 yundiao yundiao       64 Dec 31 15:25 secret.key
-rw-rw----  1 yundiao yundiao        0 Dec 31 15:25 secret.key.not-so-secret
drwx------  4 yundiao yundiao     4096 Jan  3 16:50 secrets
drwxrwx---  2 yundiao yundiao     4096 Jan  3 16:49 updates
drwxrwx---  2 yundiao yundiao     4096 Dec 31 15:25 userContent
drwxrwx---  3 yundiao yundiao     4096 Jan  3 16:44 users
drwxrwx--- 11 yundiao yundiao     4096 Dec 31 15:25 war
drwxrwx---  2 yundiao yundiao     4096 Jan  3 16:42 workflow-libs
drwxrwx---  4 yundiao yundiao     4096 Jan  3 16:50 workspace

4.修改jenkins插件下载为国内源

[root@nmhs-pp-mw049181 ~]$ kill $(ps -ef | grep jenkins | grep -v grep | awk '{print $2}')
[root@nmhs-pp-mw049181 ~]$ sed -i 's/http:\/\/www.google.com/https:\/\/www.baidu.com/g' default.json
[root@nmhs-pp-mw049181 ~]$ sed -i 's/https:\/\/updates.jenkins.io\/download/https:\/\/mirrors.tuna.tsinghua.edu.cn\/jenkins/g' default.json
#如果是内网环境只能做单项路由才能访问的话需要添加
https://www.baidu.com  #IP 110.242.68.66
https://mirrors.tuna.tsinghua.edu.cn   #IP 101.6.8.193
的出口ip路由
[root@nmhs-pp-mw049181 ~]$ route add -net 110.242.68.66 netmask 255.255.255.255 gw 182.42.24.65
[root@nmhs-pp-mw049181 ~]$ route add -net 101.6.8.193 netmask 255.255.255.255 gw 182.42.24.65
[root@nmhs-pp-mw049181 ~]$ cat /etc/hosts
#jenkins国内源插件
#jenkins国内源插件
110.242.68.66 www.baidu.com
101.6.8.193 mirrors.tuna.tsinghua.edu.cn
[root@nmhs-pp-mw049181 ~]$ nohup java -jar /data/jenkins/jenkins.war --ajp13Port=-1 --httpPort=8888 > /data/jenkins/jenkins.log &

上一篇:Linux用户组和权限管理


下一篇:nginx之配置转发