jenkins 安装与使用 2022-08-12 09:55 • 阅读:次 #### 安装依赖 > 安装JDk ``` 下载相对应的版本 https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html tar -zxvf jdk-8u301-linux-x64.tar.gz mv jdk1.8.0_301/ /usr/local/ ``` > 配置JAVA环境变量 ``` vi /etc/profile export JAVA_HOME=/usr/local/jdk1.8.0_301 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin export PATH=$PATH:${JAVA_PATH} source /etc/profile // 生效 ``` > 安装 Maven ``` 下载地址官网:http://maven.apache.org/download.cgi tar -zxvf apache-maven-3.5.4-bin.tar.gz mv apache-maven-3.8.1 /usr/local/ vi /etc/profile export MAVEN_HOME=/usr/local/apache-maven-3.8.1 export PATH=$PATH:$MAVEN_HOME/bin source /etc/profile // 生效 ``` > 安装 Jenkins ```bash 域名:https://pkg.jenkins.io/redhat/ # 设置存储库 sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo # 导入秘钥 sudo rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key # 安装 yum install epel-release # repository that provides 'daemonize' yum install java-11-openjdk-devel yum install jenkins ``` > 配置文件 ```bash /etc/sysconfig/jenkins JENKINS_USER=root JENKINS_GROUP=root 可以修改为root权限运行 ``` > 服务管理 ``` service jenkins start (restart|stop|status) service jenkins restart ```