[wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.332.3-1.1.noarch.rpm –no-check-certificate [wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ rpm -ivh jenkins-2.332.3-1.1.noarch.rpm
jenkins这样就安装好了,但是我们先不启动,先修改一下配置,这里注意我的jdk已经配置好了,不会jdk配置的可以参考:https://www.wulaoer.org/?p=487
[wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ ln -s /usr/local/jdk/bin/java /usr/bin/java [wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ vim /etc/sysconfig/jenkins ............................. JENKINS_HOME="/apps/works/server/jenkins" JENKINS_USER="root" [wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ vim /usr/lib/systemd/system/jenkins.service .................................... # Directory where Jenkins stores its configuration and workspaces Environment="JENKINS_HOME=/apps/works/server/jenkins" WorkingDirectory=/apps/works/server/jenkins .................................... [wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ vim /etc/init.d/jenkins ........................... candidates=" /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 " [wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ /etc/init.d/jenkins start /etc/init.d/jenkins: line 74: /etc/init.d/functions: No such file or directory
我这是在容器中测试的,所以如果有报错就安装下面的方式解决,如果没有报错就可以忽略了。
[wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ yum install -y initscripts [wolf@wulaoer.org 🔥🔥🔥🔥 ~ ]$ /etc/init.d/jenkins start Starting Jenkins [ OK ]
现在jenkins就已经安装好了,下面我们看一下是否路径有切换。因为我这个是新的,已经安装好了,如果是已经安装好的,记得必须把/var/lib/jenkins目录下的内容copy到你新的目录下,两边都要修改。启动后在配置Manage Jenkins--Configure System--主目录就可以看到新路径了。
安装好后需要配置jdk和maven,在Manage Jenkins--Global Tool Configuration--JDK和Maven
别名:JAVA_HOME JAVA_HOME:/usr/local/jdk 别名:MAVEN_HOME MAVEN_HOME:/usr/local/maven
另外需要在Manage Jenkins--Configure System--全局属性中添加环境变量
键:PATH 值:/usr/local/maven/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
保存即可,至此,jenkins的配置完成,
您可以选择一种方式赞助本站
支付宝扫一扫赞助
微信钱包扫描赞助
赏