Jenkins安装与卸载(Linux系统本地部署)

一、安装JDK

  • 下载JDK

下载地址:https://www.oracle.com/java/technologies/javase-jdk8-downloads.html

image-20200301120129167

  • 创建目录
[root@localhost ~]# mkdir /usr/local/java/
  • 解压至安装目录
[root@localhost ~]# tar -zxvf jdk-8u241-linux-x64.tar.gz -C /usr/local/java/
  • 设置环境变量
[root@localhost ~]# vi /etc/profile


export JAVA_HOME=/usr/local/java/jdk1.8.0_241
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

image-20200301120932557

  • 使环境变量生效
[root@localhost ~]# source /etc/profile
  • 添加软链接
[root@localhost ~]# ln -s /usr/local/java/jdk1.8.0_241/bin/java /usr/bin/java
  • 查看是否安装正确
[root@localhost ~]# java -version
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)

二、安装jenkins

由于需要将代码拉取到本地系统,然后执行newman命令,所以建议将jenkins安装在宿主机。

  • 下载jenkins(选择适合宿主机的版本)
[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.190.3-1.1.noarch.rpm

下载链接:https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/

  • 安装
[root@localhost ~]# rpm -ivh jenkins-2.190.3-1.1.noarch.rpm
  • 修改配置文件
vi /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
  • 启动服务
service jenkins restart
  • 查看jenkins密码
cat /var/lib/jenkins/secrets/initialAdminPassword
  • 安装插件

image-20200301125008344

三、卸载jenkins

#卸载
rpm -e jenkins

#检查是否卸载成功
rpm -ql jenkins

#彻底删除残留文件:
find / -iname jenkins | xargs -n 1000 rm -rf
posted @ 2020-09-20 11:25  xyztank  阅读(1007)  评论(0编辑  收藏  举报