jenkins官方地址:https://jenkins.io/download/
步骤
下面展示一些 内联代码片
。
1、wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
2、 rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
或者: rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
3、yum install -y jenkins
报错:
warning: /var/cache/yum/x86_64/7/jenkins/packages/jenkins-2.303-1.1.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID 45f2c3d5: NOKEY
Public key for jenkins-2.303-1.1.noarch.rpm is not installed
尝试解决
wget https://prodjenkinsreleases.blob.core.windows.net/redhat/jenkins-2.305-1.1.noarch.rpm
rpm -ivh jenkins-2.303-1.1.noarch.rpm
配置文件: vi /etc/sysconfig/jenkins
更改jenkins配置文件里的监听端口:
JENKINS_PORT="1107"
jdk:
jenkins:
4、service jenkins start
凉凉报错了,我的是jdk环境配置的不是默认地址
配置:java环境
5、vi /etc/init.d/jenkins
systemctl daemon-reload
service jenkins start
修改配置,没错的不用改了
卸载
service jenkins stop
yum clean all
yum -y remove jenkins
rpm卸载:
rpm -e jenkins
查看
rpm -ql jenkins
find / -iname jenkins | xargs -n 1000 rm -rf
# find命令用来查找“/”下名称符合jenkins的文件
# -name name, -iname name : 文件名称符合 name 的文件。iname 会忽略大小写
# xargs 命令 可以将管道或标准输入(stdin)数据转换成命令行参数,也能够从文件的输出中读取数据。
# -n 选项 每次传递几个参数给其后面的命令执行
初始密码:
/var/lib/jenkins/secrets ------initialAdminPassword
解决离线问题
修改/var/lib/jenkins/updates/default.json
sed -i ‘s/http://updates.jenkins-ci.org/download/https://mirrors.tuna.tsinghua.edu.cn/jenkins/g’ default.json && sudo sed -i ‘s/http://www.google.com/https://www.baidu.com/g’ default.json
maven :
wget https://mirrors.cnnic.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -zxvf apache-maven-3.6.3-bin.tar.gz
vi /etc/profile
export MAVEN_HOME=/home/software/maven/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
source /etc/profile
mvn -version