目录
官方安装手册:Installing Jenkins
Jenkins依赖JDK,官方推荐11,但由于大部分项目目前还是在使用1.8,在安装Jenkins前先安装JDK1.8,注意不能是Oracle JDK,步骤略。
because Oracle's Java RPMs are incorrect and fail to register as providing a java dependency. Thus, adding an explicit dependency requirement on Java would force installation of the OpenJDK JVM.
- 2.164 (2019-02) and newer: Java 8 or Java 11
- 2.54 (2017-04) and newer: Java 8
- 1.612 (2015-05) and newer: Java 7
通过yum库安装
推荐安装LTS(Long-Term Support release)长期稳定版本,另外有每周发行版,区别在于库名,注意区分。
https://pkg.jenkins.io/redhat-stable/jenkins.repo
https://pkg.jenkins.io/redhat/jenkins.repo
#LTS
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
# Add required dependencies for the jenkins package
#选择安装JDK,注意版本
#sudo yum install java-11-openjdk
sudo yum install jenkins
sudo systemctl daemon-reload
安装后通过系统服务来管理:
systemctl start jenkins
systemctl stop jenkins
systemctl status jenkins
通过war包安装(离线方便安装)
官方离线安装手册:Offline Installations
Jenkins download and deployment
在服务器直接下载指定包:
wget -c https://get.jenkins.io/war-stable/2.346.1/jenkins.war
指定端口启动
java -jar jenkins.war --httpPort=8080 &
执行启动命令后留意下日志打印,生成的密码后续安装要用。
*************************************************************
*************************************************************
*************************************************************
Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:
90c93d1063eb456a8aa05ad2616ffef3
This may also be found at: /root/.jenkins/secrets/initialAdminPassword
*************************************************************
*************************************************************
*************************************************************
访问正常,可以进行下一步配置操作