inux下安装jenkins有两种方式:
1,通过rpm方式
2,通过war方式
本文是基于war方式,以下是war方式安装的步骤:
1,下载安装配置JDK环境;
具体操作查看笔者Linux下装JDK笔录:
https://www.jianshu.com/p/5557fb0bc5d4
2,下载安装配置Tomcat环境;
具体操作查看笔者Linux安装tomcat笔录:
https://www.jianshu.com/p/f62f75c00c97
3,下载安装jenkins;
1,下载jenkins的war包:
去该地址下载想要安装的版本:
http://mirrors.jenkins.io/war-stable/
这里笔者下载的是2.121.1版本
[root@iZj6c7eeosj2t5vjw8rf4xZ jenkins]# wget http://mirrors.shu.edu.cn/jenkins/war-stable/2.121.1/jenkins.war
2,把jenkins.war包放置到tomcat的webapps目录下面;
[root@iZj6c7eeosj2t5vjw8rf4xZ webapps]# cp -f /opt/frank/jenkins/jenkins.war /opt/tomcat/webapps/
[root@iZj6c7eeosj2t5vjw8rf4xZ webapps]# ls
docs examples host-manager jenkins.war manager ROOT tatoo
3,启动tomcat;
启动tomcat,tomcat会自动解压war包,生成一个jenkins文件夹,而且Jenkins默认会存放在用户主目录下的.jenkins文件夹中。
如:Linux root用户:/root/.jenkins
tomcat自动解压生成jenkins文件查看:
[root@iZj6c7eeosj2t5vjw8rf4xZ webapps]# ls
docs examples host-manager jenkins jenkins.war manager ROOT tatoo
[root@iZj6c7eeosj2t5vjw8rf4xZ webapps]# cd jenkins
[root@iZj6c7eeosj2t5vjw8rf4xZ jenkins]# ls
bootstrap favicon.ico LogFileOutputStream$1.class MainDialog$1.class scripts
ColorFormatter.class help LogFileOutputStream$2.class MainDialog.class WEB-INF
css images LogFileOutputStream.class Main$FileAndDescription.class winstone.jar
dc-license.txt JNLPMain.class Main.class META-INF
executable jsbundles MainDialog$1$1.class robots.txt
jenkins的.jenkins文件位置
[root@iZj6c7eeosj2t5vjw8rf4xZ jenkins]# cd /root/.jenkins/
[root@iZj6c7eeosj2t5vjw8rf4xZ .jenkins]# ls
config.xml jenkins.install.UpgradeWizard.state nodes secrets
hudson.model.UpdateCenter.xml jobs plugins updates
identity.key.enc logs secret.key userContent
jenkins.CLI.xml nodeMonitors.xml secret.key.not-so-secret users
4,如果不知道tomcat的访问端口是什么可以通过以下命令:
[root@iZj6c7eeosj2t5vjw8rf4xZ .jenkins]# ps -ef|grep tomcat
root 1913 1883 0 Apr01 ? 01:14:19 java -jar /opt/frank/tomcat/apache-tomcat-8.5.23/melibs/cn-jufuns-ien-api-provider-1.0.0-local_dev.jar
root 18774 1 0 Apr12 ? 01:51:33 /usr/java/jdk1.8.0_144/jre/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djdk.tls.ephemeralDHKeySize=2048 -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dignore.endorsed.dirs= -classpath /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
root 19027 17608 0 14:51 pts/0 00:00:00 grep tomcat
[root@iZj6c7eeosj2t5vjw8rf4xZ .jenkins]# netstat -apn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1432/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2108/nginx
tcp 0 0 0.0.0.0:42395 0.0.0.0:* LISTEN 1894/java
tcp 0 0 127.0.0.1:32000 0.0.0.0:* LISTEN 1144/java
tcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN 18774/java
tcp 0 0 0.0.0.0:2181 0.0.0.0:* LISTEN 1894/java
tcp 0 0 0.0.0.0:12200 0.0.0.0:* LISTEN 1913/java
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1766/php-fpm
tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN 18774/java
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 18774/java
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2108/nginx
tcp 0 0 172.31.195.1:57890 140.205.140.205:80 ESTABLISHED 19072/AliYunDun
tcp 0 0 127.0.0.1:31000 127.0.0.1:32000 ESTABLISHED 1144/java
tcp 0 2804 172.31.195.1:22 183.6.179.98:2048 ESTABLISHED 17606/sshd
tcp 0 0 127.0.0.1:2181 127.0.0.1:45840 ESTABLISHED 1894/java
tcp 0 0 127.0.0.1:45840 127.0.0.1:2181 ESTABLISHED 1913/java
tcp 0 0 127.0.0.1:32000 127.0.0.1:31000 ESTABLISHED 1142/wrapper
tcp 0 0 :::8989 :::* LISTEN 1803/python
tcp 0 0 :::3306 :::* LISTEN 1680/mysqld
udp 0 0 0.0.0.0:33848 0.0.0.0:* 18774/java
udp 0 0 0.0.0.0:68 0.0.0.0:* 942/dhclient
udp 0 0 172.31.195.1:123 0.0.0.0:* 1443/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 1443/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 1443/ntpd
udp 0 0 0.0.0.0:34999 0.0.0.0:* 1803/python
udp 0 0 0.0.0.0:5353 0.0.0.0:* 18774/java
udp 0 0 :::123 :::* 1443/ntpd
udp 0 0 :::8989 :::* 1803/python
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 20736497 19072/AliYunDun /tmp/Aegis-<Guid(5A2C30A2-A87D-490A-9281-6765EDAD7CBA)>
unix 2 [ ACC ] STREAM LISTENING 11161 1/init @/com/ubuntu/upstart
unix 2 [ ] DGRAM 11542 367/udevd @/org/kernel/udev/udevd
unix 5 [ ] DGRAM 12729 1021/rsyslogd /dev/log
unix 2 [ ACC ] STREAM LISTENING 9784 154/plymouthd @/ply-boot-protocol@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
unix 2 [ ACC ] STREAM LISTENING 14744 1680/mysqld /var/lib/mysql/mysql.sock
unix 2 [ ACC ] STREAM LISTENING 20736498 19072/AliYunDun /usr/local/aegis/Aegis-<Guid(5A2C30A2-A87D-490A-9281-6765EDAD7CBA)>
unix 3 [ ] STREAM CONNECTED 14909 1766/php-fpm
unix 2 [ ] STREAM CONNECTED 4213164 18774/java
unix 3 [ ] STREAM CONNECTED 17926 2108/nginx
unix 2 [ ] DGRAM 10537908 999/auditd
unix 3 [ ] STREAM CONNECTED 17927 2108/nginx
unix 3 [ ] STREAM CONNECTED 20736493 19072/AliYunDun
unix 3 [ ] STREAM CONNECTED 20736494 19072/AliYunDun
unix 3 [ ] STREAM CONNECTED 20736495 19072/AliYunDun
unix 2 [ ] DGRAM 14270 1443/ntpd
unix 2 [ ] STREAM CONNECTED 4213151 18774/java
unix 2 [ ] STREAM CONNECTED 13699 1144/java
unix 3 [ ] DGRAM 11556 367/udevd
unix 3 [ ] STREAM CONNECTED 14910 1766/php-fpm
unix 2 [ ] STREAM CONNECTED 15663 1894/java
unix 3 [ ] STREAM CONNECTED 12689 999/auditd
unix 2 [ ] STREAM CONNECTED 15669 1894/java
unix 2 [ ] STREAM CONNECTED 12920 1144/java
unix 3 [ ] STREAM CONNECTED 20736496 19072/AliYunDun
unix 3 [ ] STREAM CONNECTED 12688 999/auditd
unix 3 [ ] DGRAM 11555 367/udevd
unix 2 [ ] STREAM CONNECTED 15759 1913/java
unix 2 [ ] STREAM CONNECTED 16175 1913/java
unix 2 [ ] DGRAM 25634203 17606/sshd
ps -ef|grep java 和 netstat -apn命令:有上可知我们的tomcat端口是8080
4,访问jenkins界面:
在浏览器上输入ip地址http://47.52.41.245:8080/jenkins(http://ip:端口/jenkins)即可访问,如图:
image首次进入jenkins如要输入密码,密码位置:/root/.jenkins/secrets/initialAdminPassword
通过cat查看密码,复制粘贴进来,点击继续,进入插件选择安装界面,点击安装默认插件,然后进入插件安装界面,安装完插件之后创建账号然后登录;
如果插件安装失败可以去镜像地址下载插件,然后手动上传
镜像地址:https://mirrors.tuna.tsinghua.edu.cn/jenkins/
网友评论