1、下載jenkins
- curl -O :下載并以不同的文件名保存
- um的repo中默認(rèn)沒有Jenkins贡羔,需要先將Jenkins存儲(chǔ)庫添加到y(tǒng)um repos陨帆,執(zhí)行下面的命令:
- rpm安裝
curl -o /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
2、添加key
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
3二蓝、安裝Jenkins
- 下載指定版本的rpm文件引镊,進(jìn)行rpm進(jìn)行安裝
# 在線安裝
yum install -y jenkins
# 或 離線rpm安裝
rpm -ivh jenkins-2.156-1.1.noarch.rpm
4川慌、啟動(dòng)jenkins
systemctl jenkins start
systemctl start jenkins
5 、停用jenkins
systemctl jenkins stop
systemctl stop jenkins
6祠乃、重啟jenkins
systemctl jenkins restart
systemctl restart jenkins
7、開機(jī)啟動(dòng)
systemctl enable jenkins
8兑燥、安裝默認(rèn)的目錄
/usr/lib/jenkins/jenkins.war WAR包
/etc/sysconfig/jenkins 配置文件
/var/lib/jenkins/ 默認(rèn)的JENKINS_HOME目錄
/var/log/jenkins/jenkins.log
9亮瓷、修改sysconfig的Jenkins文件
-
JENKINS_USER
訪問用戶,默認(rèn)為Jenkins降瞳,把它改成root
vim /etc/sysconfig/jenkins
-----------------------------------------------------------------------
# 指定目錄
JENKINS_HOME="/home/jenkins"
# 訪問用戶嘱支,默認(rèn)為Jenkins,把它改成root
JENKINS_USER="root"
# 修改端口
JENKINS_PORT="8080"
10挣饥、給指定root用戶進(jìn)行授權(quán)
chown -R root:root /var/lib/jenkins
chown -R root:root /var/cache/jenkins
chown -R root:root /var/log/jenkins
11除师、創(chuàng)建jenkins目錄
- JENKINS_HOME
directory does not exist: /home/jenkins
mkdir /home/jenkins
12. 修改jenkins的配置文件
- whereis java 找到j(luò)dk安裝目錄 找到
candidates="
在它到后面添加jdk安裝的目錄,然后vi保存退出
vi /etc/init.d/jenkins
rpm安裝包下載地址
紅帽子官方下載地址
參考文章