Jenkins服务器的安装
Jenkins服务器的安装
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.安装jdk
详情请参考:https://www.cnblogs.com/yinzhengjie/p/10739218.html
二.下载最新版本jenkins安装包
1>.访问Jenkins官网,点击"下载"
官方中文文档链接:https://jenkins.io/zh/
2>.选择需要安装Jenkins的运行平台
3>.选择Jenkins版本
4>.下载最目前最新版本的Jenkins安装包
[root@node202.yinzhengjie.org.cn ~]# yum -y install wget Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile epel/x86_64/metalink | 7.8 kB 00:00:00 * base: mirrors.aliyun.com * epel: mirrors.aliyun.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com base | 3.6 kB 00:00:00 epel | 5.3 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/4): epel/x86_64/updateinfo | 975 kB 00:00:00 (2/4): extras/7/x86_64/primary_db | 204 kB 00:00:00 (3/4): updates/7/x86_64/primary_db | 6.4 MB 00:00:04 (4/4): epel/x86_64/primary_db | 6.7 MB 00:00:06 Resolving Dependencies --> Running transaction check ---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================================================================= Package Arch Version Repository Size ================================================================================================================================================================================================= Installing: wget x86_64 1.14-18.el7_6.1 updates 547 k Transaction Summary ================================================================================================================================================================================================= Install 1 Package Total download size: 547 k Installed size: 2.0 M Downloading packages: wget-1.14-18.el7_6.1.x86_64.rpm | 547 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : wget-1.14-18.el7_6.1.x86_64 1/1 Verifying : wget-1.14-18.el7_6.1.x86_64 1/1 Installed: wget.x86_64 0:1.14-18.el7_6.1 Complete! [root@node202.yinzhengjie.org.cn ~]#
[root@node202.yinzhengjie.org.cn ~]# wget https://pkg.jenkins.io/redhat-stable/jenkins-2.176.1-1.1.noarch.rpm --2019-06-20 11:21:43-- https://pkg.jenkins.io/redhat-stable/jenkins-2.176.1-1.1.noarch.rpm Resolving pkg.jenkins.io (pkg.jenkins.io)... 52.202.51.185 Connecting to pkg.jenkins.io (pkg.jenkins.io)|52.202.51.185|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://prodjenkinsreleases.blob.core.windows.net/redhat-stable/jenkins-2.176.1-1.1.noarch.rpm [following] --2019-06-20 11:21:44-- https://prodjenkinsreleases.blob.core.windows.net/redhat-stable/jenkins-2.176.1-1.1.noarch.rpm Resolving prodjenkinsreleases.blob.core.windows.net (prodjenkinsreleases.blob.core.windows.net)... 52.167.88.112 Connecting to prodjenkinsreleases.blob.core.windows.net (prodjenkinsreleases.blob.core.windows.net)|52.167.88.112|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 77091562 (74M) [application/x-redhat-package-manager] Saving to: ‘jenkins-2.176.1-1.1.noarch.rpm’ 100%[==================================================================================================================================================================>] 77,091,562 53.1KB/s in 20m 48s 2019-06-20 11:42:36 (60.3 KB/s) - ‘jenkins-2.176.1-1.1.noarch.rpm’ saved [77091562/77091562] [root@node202.yinzhengjie.org.cn ~]#
三.安装Jenkins
1>.安装Jenkins
[root@node202.yinzhengjie.org.cn ~]# ll total 75288 -rw-r--r-- 1 root root 77091562 Jun 19 23:50 jenkins-2.176.1-1.1.noarch.rpm [root@node202.yinzhengjie.org.cn ~]# [root@node202.yinzhengjie.org.cn ~]# rpm -ivh jenkins-2.176.1-1.1.noarch.rpm warning: jenkins-2.176.1-1.1.noarch.rpm: Header V4 DSA/SHA1 Signature, key ID d50582e6: NOKEY Preparing... ################################# [100%] Updating / installing... 1:jenkins-2.176.1-1.1 ################################# [100%] [root@node202.yinzhengjie.org.cn ~]# [root@node202.yinzhengjie.org.cn ~]#
2>.启动Jenkins服务
[root@node202.yinzhengjie.org.cn ~]# ll /var/lib/jenkins/ total 0 [root@node202.yinzhengjie.org.cn ~]# [root@node202.yinzhengjie.org.cn ~]# systemctl start jenkins.service [root@node202.yinzhengjie.org.cn ~]# [root@node202.yinzhengjie.org.cn ~]# ll /var/lib/jenkins/ total 32 -rw-r--r-- 1 jenkins jenkins 1655 Jun 19 23:57 config.xml -rw-r--r-- 1 jenkins jenkins 29 Jun 19 23:57 failed-boot-attempts.txt -rw-r--r-- 1 jenkins jenkins 156 Jun 19 23:57 hudson.model.UpdateCenter.xml -rw------- 1 jenkins jenkins 1712 Jun 19 23:57 identity.key.enc -rw-r--r-- 1 jenkins jenkins 7 Jun 19 23:57 jenkins.install.UpgradeWizard.state -rw-r--r-- 1 jenkins jenkins 171 Jun 19 23:57 jenkins.telemetry.Correlator.xml drwxr-xr-x 2 jenkins jenkins 6 Jun 19 23:57 jobs drwxr-xr-x 3 jenkins jenkins 19 Jun 19 23:57 logs -rw-r--r-- 1 jenkins jenkins 907 Jun 19 23:57 nodeMonitors.xml drwxr-xr-x 2 jenkins jenkins 6 Jun 19 23:57 nodes drwxr-xr-x 2 jenkins jenkins 6 Jun 19 23:57 plugins -rw-r--r-- 1 jenkins jenkins 64 Jun 19 23:57 secret.key -rw-r--r-- 1 jenkins jenkins 0 Jun 19 23:57 secret.key.not-so-secret drwx------ 4 jenkins jenkins 265 Jun 19 23:57 secrets drwxr-xr-x 2 jenkins jenkins 24 Jun 19 23:57 userContent drwxr-xr-x 3 jenkins jenkins 55 Jun 19 23:57 users [root@node202.yinzhengjie.org.cn ~]#
3>.访问web UI
[root@node202.yinzhengjie.org.cn ~]# ss -ntl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 50 *:8080 *:* LISTEN 0 128 *:22 *:* LISTEN 0 100 127.0.0.1:25 *:* LISTEN 0 128 *:389 *:* LISTEN 0 128 :::22 :::* LISTEN 0 128 :::389 :::* [root@node202.yinzhengjie.org.cn ~]#
[root@node202.yinzhengjie.org.cn ~]# cat /var/lib/jenkins/hudson.model.UpdateCenter.xml <?xml version='1.1' encoding='UTF-8'?> <sites> <site> <id>default</id> <url>https://updates.jenkins.io/update-center.json</url> </site> </sites>[root@node202.yinzhengjie.org.cn ~]# [root@node202.yinzhengjie.org.cn ~]# [root@node202.yinzhengjie.org.cn ~]#
4>.跳过自定义Jenkins插件(我们也可以根据向导选择"安装推荐的插件",需要服务器联网哟,运行时间较长)
5>.开始使用Jenkins服务
四.修改Jenkins密码(不难发现,我们在安装Jenkins的时候就发现Jenkins存放初始密码存放位置是:/var/lib/jenkins/secrets/initialAdminPassword)
1>.点击"admin"用户
2>.进入admin用户界面后点击"Configure"
3>.修改新密码并保存
4>.使用修改后的密码进行登陆
5>.登陆成功
本文来自博客园,作者:尹正杰,转载请注明原文链接:https://www.cnblogs.com/yinzhengjie/p/11056346.html,个人微信: "JasonYin2020"(添加时请备注来源及意图备注,有偿付费)
当你的才华还撑不起你的野心的时候,你就应该静下心来学习。当你的能力还驾驭不了你的目标的时候,你就应该沉下心来历练。问问自己,想要怎样的人生。