Centos 7.6 安装和卸载jenkins

1:卸载jenkins
systemctl stop jenkins.service
rpm -e jenkins
rpm -qa | grep jenkins # 查看是否还有jenkins依赖,有就删除
rm -rf /etc/sysconfig/jenkins.rpmsave
rm -rf /var/cache/jenkins/
rm -rf /var/lib/jenkins/
rm -rf /var/log/jenkins
rm -rf /usr/lib/jenkins


2:安装jenkins
下载rpm安装包
wget https://pkg.jenkins.io/redhat/jenkins-2.164.3.noarch.rpm
解压rpm文件
rpm -ivh jenkins-2.156-1.1.noarch.rpm

3:配置jenkins监听端口,如果有需要可以修改
vim /etc/sysconfig/jenkins

#监听端口
JENKINS_PORT="8080"

4:修改/etc/init.d/jenkins 文件,指定jdk路径(提前安装好jdk,根据jenkins的版本来安装对应版本的jdk)
candidates="
/usr/local/jdk1.8.0_101/bin/java
"
注:这里也可以不修改此文件,直接创建一个软连接连接到jdk目录
ln -s /usr/local/jdk1.8.0_101/bin/java /usr/bin/java

5:jenkins的相关命令
service jenkins start/stop/restart/status

6:此外如果需要更新jenkins的版本,只需要在jenkins官网https://www.jenkins.io/download/
下载指定版本的jenkins.war,替换/usr/lib/jenkins 目录下的jenkins.war即可

posted @ 2021-06-29 17:08  低调小雄  阅读(589)  评论(0编辑  收藏  举报