centos8 安装jenkins
通过官网查到安装方式
https://www.jenkins.io/doc/book/installing/#red-hat-centos
sudo wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key sudo yum upgrade sudo yum install jenkins java-1.8.0-openjdk-devel sudo systemctl daemon-reload
需要自定义端口,修改配置文件/etc/sysconfig/jenkins
JENKINS_PORT="8080" # 修改成自己需要的端口
JENKINS_HOME="/var/lib/jenkins" # 记住这个目录,
用户权限问题参考:
https://www.cnblogs.com/binghe001/p/12882636.html
gpasswd -a jenkins root
修改/etc/sysconfig/jenkins
JENKINS_USER=root JENKINS_GROUP=root
启动:
systemctl start jenkins
访问:
通过ip加自定义端口(8080),端口所在安全组要开放
根据提示获取管理员密码
cat /var/lib/jenkins/secrets/initialAdminPassword
完成操作后
出现 No such plugin: cloudbees-folder
参考 https://www.cnblogs.com/changjianblog/p/10916098.html
找到 /var/lib/jenkins 新建目录WEB-INF\detached-plugins
打开链接“http://ftp.icm.edu.pl/packages/jenkins/plugins/cloudbees-folder/”,在最下面找到并打开“latest”目录。
将目录中的“cloudbees-folder.hpi”放到 WEB-INF\detached-plugins中
重启
systemctl stop jenkins systemctl start jenkins
我选择安装推荐的插件
然后创建用户
想修改工作目录的
停止jenkins
进入目录 /var/lib/jenkins
备份config.xml
找到<workspaceDir>${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}</workspaceDir>
将${JENKINS_HOME}/workspace换成自己想要的目录
<workspaceDir>/www/wwwroot/${ITEM_FULL_NAME}</workspaceDir>