欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CentOS安装Jenkins

程序员文章站 2022-05-10 21:30:02
...

安装步骤

安装jdk

请参照我的另一篇博客:Linux下轻松jdk安装

安装git

yum -y install git

安装jenkins

方法1:

wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum -y install jenkins

方法2:

官网下载指定版本: https://pkg.jenkins.io/

wget https://pkg.jenkins.io/redhat/jenkins-2.156-1.1.noarch.rpm
rpm -ivh jenkins-2.156-1.1.noarch.rpm

放行端口

firewall-cmd --add-port=8080/tcp
firewall-cmd --add-port=8080/tcp --per

配置Jenkins

vim /etc/sysconfig/jenkins
	JENKINS_PORT="8080"			#监听端口
	JENKINS_USER="root"			#运行用户
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins

启动Jenkins

ll /usr/bin/java		#查看是否存在此文件

若存在此文件:

systemctl restart jenkins
systemctl enable jenkins

若不存在此文件:

ln -s /usr/local/java/jdk1.8.0_162/bin/java /usr/bin/java		#根据具体java版本创建软链接
systemctl restart jenkins
systemctl enable jenkins

访问8080端口:http://<服务器地址>:8080

CentOS安装Jenkins
执行命令查看临时密码:

cat /var/lib/jenkins/secrets/initialAdminPassword

选择“推荐插件”:

CentOS安装Jenkins
等待安装完毕:

CentOS安装Jenkins
创建管理员账户:

CentOS安装Jenkins
CentOS安装Jenkins



Jenkins配置文件

vim /etc/sysconfig/jenkins
	JENKINS_PORT="8080"			#监听端口
	JENKINS_USER="root"			#运行用户

关注 京城郭少``