01-Jenkins-Master节点安装

Jenkins安装前需要JDK8,下载最新版本的Jenkins LTS 2.150.防止下载缓慢可以通过清华源进行下载。
[root@node1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.150.2-1.1.noarch.rpm
--2019-01-25 07:09:30--  https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.150.2-1.1.noarch.rpm
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 75785378 (72M) [application/x-redhat-package-manager]
Saving to: enkins-2.150.2-1.1.noarch.rpm

100%[====================================================>] 75,785,378  2.73MB/s   in 30s    

2019-01-25 07:10:00 (2.44 MB/s) - enkins-2.150.2-1.1.noarch.rpmsaved [75785378/75785378]

设置JENKINS_HOME位置,然后通过rpm命令直接安装部署。

[root@node1 ~]# export JENKINS_HOME=/var/lib/jenkins
[root@node1 ~]# echo $JENKINS_HOME
/var/lib/jenkins
[root@node1 ~]# rpm -ivh jenkins-2.150.2-1.1.noarch.rpm 
warning: jenkins-2.150.2-1.1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID d50582e6: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:jenkins-2.150.2-1.1              ################################# [100%]

安装成功后,将jenkins服务设置开机自启,并启动服务。

[root@node1 ~]# systemctl enable jenkins
jenkins.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig jenkins on
[root@node1 ~]# systemctl start jenkins

 

配置成功后检查jenkins服务运行状态,jenkins默认的端口是8080。

[root@node1 ~]# netstat -anlpt | grep 8080
tcp6       0      0 :::8080                 :::*                    LISTEN      1323/java           
[root@node1 ~]# ps aux | grep java | grep 8080
jenkins   1323 95.8  3.3 3111652 134504 ?      Ssl  07:19   0:14 /etc/alternatives/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --daemon --httpPort=8080 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20

 

这时,可以通过浏览器访问 http://localhost:8080 地址打开jenkins页面。默认第一次打开jenkins页面时,需要通过秘钥文件解锁。页面中会提示默认的秘钥文件位置,找到文件复制秘钥解锁即可。

解锁成功后,会进入到插件安装的页面。

 

 

 

 

然后会让你创建一个管理员账号,这里默认admin admin,最后会出现Jenkins的站点路径配置,默认即可。

jenkins主页

 

 

 

posted @ 2019-01-25 21:41  Zeyangli  阅读(698)  评论(0编辑  收藏  举报