Jenkins rpm 安装
jenkins 下载地址https://pkg.jenkins.io/redhat/开始安装 Jenkinsrpm -ivh jenkins-2.187-1.1.noarch.rpm配置 jenkis的端口vim /etc/sysconfig/jenkinsJENKINS_PORT="8080"#此端口不冲突可以不修改JENKINS_USER="root" # jenkins...
·
jenkins 下载地址
https://pkg.jenkins.io/redhat/
开始安装 Jenkins
rpm -ivh jenkins-2.187-1.1.noarch.rpm
配置 jenkis的端口
vim /etc/sysconfig/jenkins
JENKINS_PORT="8080" #此端口不冲突可以不修改
JENKINS_USER="root" # jenkins 用户权限不够
启动jenkins
service jenkins start/stop/restart
或者:sudo service jenkins status 查看状态
- 安装成功后Jenkins将作为一个守护进程随系统启动
- 系统会创建一个“jenkins”用户来允许这个服务,如果改变服务所有者,同时需要修改/var/log/jenkins, /var/lib/jenkins, 和/var/cache/jenkins的所有者
- 启动的时候将从/etc/sysconfig/jenkins获取配置参数
- 默认情况下,Jenkins运行在8080端口,在浏览器中直接访问该端进行服务配置
- Jenkins的RPM仓库配置被加到/etc/yum.repos.d/jenkins.repo
安装问题
[root@localhost jenkins]# systemctl status jenkins.service
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since 日 2019-08-11 13:01:43 CST; 20s ago
Docs: man:systemd-sysv-generator(8)
Process: 85644 ExecStop=/etc/rc.d/init.d/jenkins stop (code=exited, status=0/SUCCESS)
Process: 89938 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)
8月 11 13:01:43 localhost.localdomain runuser[89947]: pam_unix(runuser:session): session opened for user root by (uid=0)
8月 11 13:01:43 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
8月 11 13:01:43 localhost.localdomain jenkins[89938]: Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录
8月 11 13:01:43 localhost.localdomain jenkins[89938]: [失败]
8月 11 13:01:43 localhost.localdomain systemd[1]: jenkins.service: control process exited, code=exited status=1
8月 11 13:01:43 localhost.localdomain systemd[1]: Failed to start LSB: Jenkins Automation Server.
8月 11 13:01:43 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
8月 11 13:01:43 localhost.localdomain systemd[1]: jenkins.service failed.
解决办法
vim /etc/init.d/jenkins
candidates="
/usr/java/jdk1.8.0_221/bin/java # 此处是自己的jdk路径
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-11.0/bin/java
/usr/lib/jvm/jre-11.0/bin/java
/usr/lib/jvm/java-11-openjdk-amd64
/usr/bin/java
"
vim /etc/sysconfig/jenkins
JENKINS_JAVA_CMD="$candidate"
重新启动
[root@localhost jenkins]# systemctl daemon-reload
[root@localhost jenkins]# service jenkins start
完美解决
建议在登录Jenkins之前把插件可能存在的问题配置好
登入 Jenkins
http://192.168.121.3:8080
如果忘记密码,找回方式
vi /var/lib/jenkins/secrets/initialAdminPassword
安装插件问题
checknow 报红色预警
vim /var/lib/jenkins/updates/default.json
该配置文件中http://www.google.com,查找更换为http://www.baidu.com
项目中插件下载地址默认配置Https的地址
(https://updates.jenkins.io/update-center.json),
修改为http即可,有可以能还是不行就修改成下面的国内镜像。再重启服务。国内的镜像地址
修改配置 hudson.model.UpdateCenter.xml
vim /var/lib/jenkins/hudson.model.UpdateCenter.xml
https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json
http://mirror.esuni.jp/jenkins/updates/update-center.json
更多推荐
已为社区贡献1条内容
所有评论(0)