Jenkins是开源的,起到自动构建、自动编译、自动化测试一体龙的功能,在Centos上可以通过yum命令行直接安装。
在这里记录下安装的步骤,方便以后进行查看
首先,需要安装好Java以及安装好Git。
安装Java
安装Git
一行命令即可
yum install -y git
检查Git
git --version
安装Jenkins
先添加Jenkins源
sudo wget -O /etc/yum.repos.d/jenkins.repo http://jenkins-ci.org/redhat/jenkins.repo
然后
sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
添加完成之后直接使用yum命令安装Jenkins
yum install jenkins
启动Jenkins
使用命令启动Jenkins
sudo service jenkins start
在浏览器中输入:http://<服务器ip>:8080/ 就可以进入Jenkins界面直接使用了
停止Jenkins
sudo service jenkins stop
相关配置
Jenkins安装目录
/var/lib/jenkins/
Jenkins配置文件目录
/etc/sysconfig/jenkins
可以在这里查看Jenkins默认的配置
cat jenkins
配置说明
这里介绍下三个比较重要的配置:
JENKINS_HOME JENKINS_USER JENKINS_PORT JENKINS_HOME是Jenkins的主目录,Jenkins工作的目录都放在这里,Jenkins储存文件的地址,Jenkins的插件,生成的文件都在这个目录下 ## Path: Development/Jenkins ## Description: Jenkins Continuous Integration Server ## Type: string ## Default: "/var/lib/jenkins" ## ServiceRestart: jenkins # # Directory where Jenkins store its configuration and working # files (checkouts, build reports, artifacts, ...). # JENKINS_HOME="/var/lib/jenkins"
JENKINS_USER 是Jenkins的用户,拥有$JENKINS_HOME和/var/log/jenkins的权限
## 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. # JENKINS_USER="jenkins"
JENKINS_PORT是Jenkins的端口,默认端口是8080
## Type: integer(0:65535) ## Default: 8080 ## ServiceRestart: jenkins # # Port Jenkins is listening on. # Set to -1 to disable # JENKINS_PORT="8080"