centos安装jenkins
使用 jenkins 的安装仓库
sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key
使用 yum 安装
因为高版本的已经不支持java8,查看官网后最新支持java8的版本为2.346.1.
yum install jenkins jenkins-2.346.1
如果安装出现错误
Public key for jenkins-2.414.2-1.1.noarch.rpm is not installed
新增 --nogpgcheck 参数,实现不检查Public Key而强制安装, 命令如下:
yum install jenkins --nogpgcheck
如果8080端口冲突需要修改端口号
vi /etc/sysconfig/jenkins
修改/etc/init.d/jenkins文件,添加自己的java配置
vi /etc/init.d/jenkins
添加自启动
systemctl enable jenkins
启动jenkins
systemctl start jenkins
查看密码
cat /var/lib/jenkins/secrets/initialAdminPassword
如果启不来报 没有权限 ,执行一下
chmod -R 777 /var/lib/jenkins/
卸载jenkins
#查看Jenkins
rpm -qa | grep jenkins
#卸载jenkins
rpm -e jenkins
#查看Jenkins的安装文件
rpm -ql jenkins
#彻底删除残留文件
find / -iname jenkins | xargs -n 1000 rm -rf