codcodog / Blog

h2O's Blog
20 stars 1 forks source link

jenkins 安装 #106

Open codcodog opened 5 years ago

codcodog commented 5 years ago

jenkins 安装

安装

下载 jenkins
$ mkdir /usr/local/jenkins
$ cd /usr/local/jenkins
$ wget -c http://mirrors.jenkins.io/war-stable/latest/jenkins.war

下载地址: jenkins

配置环境变量

设置 jenkins 的主目录

## root 用户配置 /etc/profile
# vi /etc/profile
export JENKINS_ROOT=/usr/local/jenkins
export JENKINS_HOME=$JENKINS_ROOT/jenkins_home
# source /etc/profile

## 非 root 用户,配置 .bashrc
$ vi ~/.bashrc
export JENKINS_ROOT=/usr/local/jenkins
export JENKINS_HOME=$JENKINS_ROOT/jenkins_home
$ source ~/.bashrc
启动
$ nohup java -jar /usr/local/jenkins/jenkins.war --httpPort=8080 >> /usr/local/jenkins/jenkins.log 2>&1 &
配置

web 配置

http://localhost:8080/

问题

根据 web 配置完之后,登录进来空白页.

重启 jenkins 即可.

其他

jenkins 重启

http://localhost:8080/restart

jenkins 重载 - 重新加载配置信息

http://localhost:8080/reload

jenkins 退出

http://localhost:8080/exit

参考文章

Jenkins安装

lovecn commented 5 years ago
Jenkins requires Java 8, but you are running 11.0.2+7-LTS from /usr/java/jdk-11.0.2
java.lang.UnsupportedClassVersionError: 55.0
        at Main.main(Main.java:139)

版本太高,这怎么办

codcodog commented 5 years ago

@lovecn 下载 WAR 2.127+, 加 --enable-future-java 选项,即 nohup java -jar /usr/local/jenkins/jenkins.war --enable-future-java --httpPort=8080 >> /usr/local/jenkins/jenkins.log 2>&1 &

可以参考 Running Jenkins with Java 10 and 11

lovecn commented 5 years ago

@codcodog 谢谢,我该先搜索下的。已经安装完了 http://118.24.158.116:8180