linux下的jekins安装

前提:

linux安装了jdk,配置路径如:

编辑配置文件:vi /etc/profile ,文件末尾或开头,添加如下图的部分

export JAVA_HOME=/usr/local/jdk1.8.0_191

export JRE_HOME=${JAVA_HOME}/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH

export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin

export PATH=$PATH:${JAVA_PATH}

 

安装步骤:

一 安装jenkins

wget -O :下载并以不同的文件名保存

yum的repo中默认没有Jenkins,需要先将Jenkins存储库添加到yum repos,执行下面的命令:

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo

然后执行下面的命令:yum --import 增加资源库

rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

然后 安装Jenkins 

yum install -y jenkins 默认安装最新的

启动jenkins

systemctl start jenkins.service

systemctl status jenkins.service

报错 Jenkins bash: /usr/bin/java: No such file or directory

 

 

发现是找不到jdk,修改文件:

 

vim /etc/init.d/jenkins

 

candidates="

/usr/local/jdk1.8.0_191/bin/java #此处为加入的java路径

/etc/alternatives/java

/usr/lib/jvm/java-1.8.0/bin/java

/usr/lib/jvm/jre-1.8.0/bin/java

/usr/lib/jvm/java-1.7.0/bin/java

/usr/lib/jvm/jre-1.7.0/bin/java

/usr/bin/java

 

[root@localhost ~]# systemctl stop jenkins.service

Warning: jenkins.service changed on disk. Run 'systemctl daemon-reload' to reload units.

[root@localhost ~]# systemctl daemon-reload

[root@localhost ~]# systemctl stop jenkins.service

[root@localhost ~]# systemctl start jenkins.service

[root@localhost ~]# systemctl status jenkins.service

● jenkins.service - LSB: Jenkins Automation Server

Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)

Active: active (running) since Sun 2018-12-16 22:49:46 EST; 10s ago

Docs: man:systemd-sysv-generator(8)

Process: 6839 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=0/SUCCESS)

Tasks: 31

Memory: 310.1M

CGroup: /system.slice/jenkins.service

└─6858 /usr/local/jdk1.8.0_191/bin/java -Dcom.sun.akuma.Daemon=daemonized -Djava.awt.headless=true -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/j...

 

Dec 16 22:49:45 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...

Dec 16 22:49:45 localhost.localdomain runuser[6844]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)

Dec 16 22:49:46 localhost.localdomain runuser[6844]: pam_unix(runuser:session): session closed for user jenkins

Dec 16 22:49:46 localhost.localdomain systemd[1]: Started LSB: Jenkins Automation Server.

Dec 16 22:49:46 localhost.localdomain jenkins[6839]: Starting Jenkins [ OK ]

 

2. 把jekins的端口加入防火墙:

[root@localhost ~]# firewall-cmd --zone=public --add-port=8080/tcp --permanent

success

[root@localhost ~]# firewall-cmd --reload

success

[root@localhost ~]# firewall-cmd --zone=public --query-port=8080/tcp

yes

[root@localhost ~]# systemctl stop firewalld

[root@localhost ~]# systemctl start firewalld

[root@localhost ~]# systemctl status firewalld

查看网址:http://172.16.244.131:8080/,打开就是如下图:

[root@localhost ~]# cat /var/lib/jenkins/secrets/initialAdminPassword

0651b69bb79a4d65a6d5ff6e7c9cb7e8

 

输入网页的密码窗口处,

选择“Install suggested plugins”安装默认的插件,下面Jenkins就会自己去下载相关的插件进行安装。

 

设置用户:admin/admin

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值