jenkins-2.225部署
安装maven
- 下载地址 http://mirror.bit.edu.cn/apache/maven/maven-3/
- 记得下载bin类型的文件:apache-maven-3.6.3-bin.tar.gz
- 解压:
tar -zxvf apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3 /home/work/apache-maven-3.6.3
- 添加环境变量
- vim /etc/bashrc
export M2_HOME=/home/work/apache-maven-3.6.3
export M2=$M2_HOME/bin
PATH=$M2:$PATH
- source /etc/bashrc
- 检验安装 :
- mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/work/apache-maven-3.6.3
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /usr/java/jdk1.8.0_201-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.1.3.el7.x86_64", arch: "amd64", family: "unix"
安装jenkins
- 下载地址 https://pkg.jenkins.io/redhat-stable/
- jenkins-2.204.5-1.1.noarch.rpm
- rpm -ivh jenkins-2.204.5-1.1.noarch.rpm
- 修改workspace地址
vim /var/lib/jenkins/config.xml
<workspaceDir>${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}</workspaceDir>
替换成自己定义的workspace地址
<workspaceDir>/home/work/workspace/${ITEM_FULL_NAME}</workspaceDir>
workspace目录需要提前创建好,并给与Jenkins的权限
mkdir /home/work/workspace
chown jenkins:jenkins /home/work/workspace
- 启动服务
service jenkins start
systemctl status jenkins.service
chkconfig jenkins on
- 服务一切正常的话可以打开ip:8080打开Jenkins
- 首次打开需要管理员密码:cat /var/lib/jenkins/secrets/initialAdminPassword
在服务端直接安装插件
- 插件下载地址 http://mirror.bit.edu.cn/jenkins/plugins/
- 查看日志,寻找需要安装的plugin,然后进行去插件网站下载。
tail -f /var/log/jenkins/jenkins.log
Failed Loading plugin Pipeline v2.6 (workflow-aggregator)
- 下载所需要plugin文件 workflow-aggregator.hpi
- 在Jenkins页面导入plugin文件
- "系统管理"-"插件管理"-"高级"-"上传插件文件"-"提交"
- 继续查看日志安装是否还有依赖,有的话重复上面操作继续安装插件
tail -f /var/log/jenkins/jenkins.log
Installation successful: workflow-aggregator
安装成功,重启服务,模块生效
[root@master]# systemctl restart jenkins