Jenkins准备篇02-Jenkins部署安装

前面已经简单介绍jenkins持续集成,今天本篇文章主要针对“阿里云服务器安装Jenkins且进入Jenkins解锁页面”进行讲解。关于“jenkins页面设置”会在下一篇进行说明,希望感兴趣的小伙伴可以坚持看下去同时欢迎提出宝贵的意见让我们一起进步!

第一步:下载安装包

(1)linux命令为:wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war

[root@iZ2zebjpjfqq58nc6ul6hnZ package]# wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
--2020-04-25 17:16:43--  http://mirrors.jenkins.io/war-stable/latest/jenkins.war
Resolving mirrors.jenkins.io (mirrors.jenkins.io)... 52.202.51.185
Connecting to mirrors.jenkins.io (mirrors.jenkins.io)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://mirror.serverion.com/jenkins/war-stable/2.222.3/jenkins.war [following]
--2020-04-25 17:16:44--  http://mirror.serverion.com/jenkins/war-stable/2.222.3/jenkins.war
Resolving mirror.serverion.com (mirror.serverion.com)... 185.126.34.191
Connecting to mirror.serverion.com (mirror.serverion.com)|185.126.34.191|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 66241734 (63M)
Saving to: ‘jenkins.war’

100%[==============================================================================================>] 66,241,734  18.9KB/s   in 52m 39s

2020-04-25 18:09:26 (20.5 KB/s) - ‘jenkins.war’ saved [66241734/66241734]
第二步:安装jdk

如何安装jdk在前面文章已介绍,具体见文章https://www.jianshu.com/p/5ec40e6287c4

第三步:启动Jenkins

(1)linux控制台启用命令为(退出控制台进程就关闭):java -jar /root/package/jenkins.war --httpPort=8080
(2)linux后台启用命令为(后台一直运行):nohup java -jar /root/package/jenkins.war --httpPort=8080 &
(3)linux后台启用命令为(打印启动日志):nohup java -jar /root/package/jenkins.war --httpPort=8080 > jenkins.log 2>&1 &
(4)注意:根据自己安装包所在的路径启动命令

[root@iZ2zebjpjfqq58nc6ul6hnZ package]# java -jar /root/package/jenkins.war --httpPort=8080
Running from: /root/package/jenkins.war
webroot: $user.home/.jenkins
2020-04-25 10:17:27.413+0000 [id=1] INFO    org.eclipse.jetty.util.log.Log#initialized: Logging initialized @762ms to org.eclipse.jetty.util.log.JavaUtilLog
2020-04-25 10:17:27.593+0000 [id=1] INFO    winstone.Logger#logInternal: Beginning extraction from war file
2020-04-25 10:17:29.120+0000 [id=1] WARNING o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
2020-04-25 10:17:29.220+0000 [id=1] INFO    org.eclipse.jetty.server.Server#doStart: jetty-9.4.27.v20200227; built: 2020-02-27T18:37:21.340Z; git: a304fd9f351f337e7c0e2a7c28878dd536149c6c; jvm 1.8.0_251-b08
2020-04-25 10:17:29.649+0000 [id=1] INFO    o.e.j.w.StandardDescriptorProcessor#visitServlet: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
2020-04-25 10:17:29.718+0000 [id=1] INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: DefaultSessionIdManager workerName=node0
2020-04-25 10:17:29.720+0000 [id=1] INFO    o.e.j.s.s.DefaultSessionIdManager#doStart: No SessionScavenger set, using defaults
2020-04-25 10:17:29.723+0000 [id=1] INFO    o.e.j.server.session.HouseKeeper#startScavenging: node0 Scavenging every 600000ms
2020-04-25 10:17:30.387+0000 [id=1] INFO    hudson.WebAppMain#contextInitialized: Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
2020-04-25 10:17:30.566+0000 [id=1] INFO    o.e.j.s.handler.ContextHandler#doStart: Started w.@24a1c17f{Jenkins v2.222.3,/,file:///root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war}
2020-04-25 10:17:30.645+0000 [id=1] INFO    o.e.j.server.AbstractConnector#doStart: Started ServerConnector@60f00693{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2020-04-25 10:17:30.646+0000 [id=1] INFO    org.eclipse.jetty.server.Server#doStart: Started @3995ms
2020-04-25 10:17:30.649+0000 [id=20]    INFO    winstone.Logger#logInternal: Winstone Servlet Engine running: controlPort=disabled
2020-04-25 10:17:32.382+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: Started initialization
2020-04-25 10:17:32.405+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: Listed all plugins
2020-04-25 10:17:34.762+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
2020-04-25 10:17:34.769+0000 [id=26]    INFO    jenkins.InitReactorRunner$1#onAttained: Started all plugins
2020-04-25 10:17:34.836+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
2020-04-25 10:17:36.006+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: System config loaded
2020-04-25 10:17:36.006+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: System config adapted
2020-04-25 10:17:36.006+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
2020-04-25 10:17:36.029+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
2020-04-25 10:17:36.621+0000 [id=39]    INFO    hudson.model.AsyncPeriodicWork#lambda$doRun$0: Started Download metadata
2020-04-25 10:17:36.663+0000 [id=39]    INFO    hudson.util.Retrier#start: Attempt #1 to do the action check updates server
2020-04-25 10:17:37.360+0000 [id=25]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@1d4bf43: display name [Root WebApplicationContext]; startup date [Sat Apr 25 18:17:37 CST 2020]; root of context hierarchy
2020-04-25 10:17:37.360+0000 [id=25]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@1d4bf43]: org.springframework.beans.factory.support.DefaultListableBeanFactory@32504f01
2020-04-25 10:17:37.368+0000 [id=25]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@32504f01: defining beans [authenticationManager]; root of factory hierarchy
2020-04-25 10:17:37.652+0000 [id=25]    INFO    o.s.c.s.AbstractApplicationContext#prepareRefresh: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@7696c8e9: display name [Root WebApplicationContext]; startup date [Sat Apr 25 18:17:37 CST 2020]; root of context hierarchy
2020-04-25 10:17:37.653+0000 [id=25]    INFO    o.s.c.s.AbstractApplicationContext#obtainFreshBeanFactory: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@7696c8e9]: org.springframework.beans.factory.support.DefaultListableBeanFactory@d6894aa
2020-04-25 10:17:37.654+0000 [id=25]    INFO    o.s.b.f.s.DefaultListableBeanFactory#preInstantiateSingletons: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@d6894aa: defining beans [filter,legacy]; root of factory hierarchy
2020-04-25 10:17:38.129+0000 [id=25]    INFO    jenkins.install.SetupWizard#init: 

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

a168e06e5ee64e5fa4cb60b7737ab0df

This may also be found at: /root/.jenkins/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************


2020-04-25 10:20:19.368+0000 [id=25]    INFO    jenkins.InitReactorRunner$1#onAttained: Completed initialization
2020-04-25 10:20:19.417+0000 [id=19]    INFO    hudson.WebAppMain$3#run: Jenkins is fully up and running
第四步:将TCP端口号添加到安全组实例中

(1)阿里云服务器必须将TCP端口号添加到安全组实例中才能访问相关端口,否则在地址栏输入“http://ip:端口号”会报“无法访问此网站”错误

image.png

(2)如何将TCP端口号添加到安全组实例中前面文章已介绍,具体见文章https://www.jianshu.com/p/5d1774c412a4

第五步:进入解锁Jenkins页面

(1)在浏览器网址栏输入“http://59.110.230.1xx:端口号/

解锁Jenkins.png

额外补充:

(1)注意:登录Jenkins主页的ip如果是虚拟机用内网IP ;如果是云服务器用外网IP
(2)云服务器查看外网IP命令为:curl cip.cc

[root@iZ2zebjpjfqq58nc6ul6hnZ ~]# curl cip.cc
IP  : 59.110.230.1XX
地址  : 中国  北京
运营商 : 阿里云/电信/联通/移动/铁通/教育网

数据二 : 北京市 | 阿里云

数据三 : 中国北京北京 | 阿里云

URL : http://www.cip.cc/59.110.230.1XX

(3)查看端口使用情况命令为:netstat -nltp

[root@iZ2zebjpjfqq58nc6ul6hnZ ~]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      25074/java          
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1022/sshd  

(4)杀死一个进程命令为:kill -9 进程号

[root@iZ2zebjpjfqq58nc6ul6hnZ ~]# ps -ef |grep jenkins
root     25074 23090  1 00:20 pts/1    00:00:11 java -jar /root/package/jenkins.war --httpPort=8080
root     25748 23090  0 00:32 pts/1    00:00:00 grep --color=auto jenkins
root     25760 23090  0 00:33 pts/1    00:00:00 grep --color=auto jenkins
[root@iZ2zebjpjfqq58nc6ul6hnZ ~]# kill -9 25074
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,616评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 91,020评论 3 387
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 159,078评论 0 349
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 57,040评论 1 285
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,154评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,265评论 1 292
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,298评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,072评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,491评论 1 306
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,795评论 2 328
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,970评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,654评论 4 337
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,272评论 3 318
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,985评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,223评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,815评论 2 365
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,852评论 2 351