[root@wulaoer.org ~]# wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo [root@wulaoer.org ~]# rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key [root@wulaoer.org ~]# yum install jenkins-2.346
这里注意,在yumjenkins的时候源也是一样有问题,换成国内的即可,可以参考下面扩展部分。
jenkins安装后简单配置一下,用户和路径,然后启动起来
[root@wulaoer.org ~]# vim /etc/sysconfig/jenkins ............................................ # JENKINS_HOME="/ops/jenkins" ## Type: string ## Default: "" ## ServiceRestart: jenkins # # Java executable to run Jenkins # When left empty, we'll try to find the suitable Java. # JENKINS_JAVA_CMD="" ## Type: string ## Default: "jenkins" ## ServiceRestart: jenkins # # Unix user account that runs the Jenkins daemon # Be careful when you change this, as you need to update # permissions of $JENKINS_HOME and /var/log/jenkins, # and if you have already run Jenkins, potentially other # directories such as /var/cache/jenkins . # JENKINS_USER="root" .........................................................
jenkins配置好后,我们需要在配置一下jdk,这里就不多说了,可以参考:https://www.wulaoer.org/?p=487
[root@wulaoer.org ~]# vim /etc/init.d/jenkins ................................ /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-11.0/bin/java /usr/lib/jvm/jre-11.0/bin/java /usr/lib/jvm/java-11-openjdk-amd64 /usr/bin/java /usr/local/jdk/bin/java #增加jdk的路径 .............................
然后启动jenkins,并设置成开机自启动。
[root@wulaoer.org ~]# systemctl enable jenkins [root@wulaoer.org ~]# systemctl start jenkins
后面就都正常了,如果安装插件的时候超时或者失败,可以把jenkins的目录下的hudson.model.UpdateCenter.xml中的连接改成国内的即可。
扩展部分
yum总是超时,拉取不了,修改国内的源即可
Delta RPMs disabled because /usr/bin/applydeltarpm not installed. jenkins-2.346-1.1.noarch.rpm FAILED http://pkg.jenkins.io/redhat/jenkins-2.346-1.1.noarch.rpm: [Errno 12] Timeout on https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat/jenkins-2.346-1.1.noarch.rpm: (28, 'Operation timed out after 30741 milliseconds with 0 out of 0 bytes received')
解决方法
把指向国外的源换成国内的,但是国内的https太慢了,直接换成http即可
[root@wulaoer.org ~]# cd /etc/yum.repos.d/ [root@wulaoer.org yum.repos.d]# vim jenkins.repo [jenkins] name=Jenkins #baseurl=http://pkg.jenkins.io/redhat baseurl=http://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat gpgcheck=1
您可以选择一种方式赞助本站
支付宝扫一扫赞助
微信钱包扫描赞助
赏