白日依山尽,黄河入海流。欲穷千里目,更上一层楼。 -- 唐·王之涣

centos7下 Jenkins 安装

Requirement

Java

root@pts/0 # java -version 
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

Installation

# get repo
rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo
yum install jenkins -y

Configuration and start

# auto-start after reboot
chkconfig jenkins on

# start
service jenkins start[stop/restart/status]

# modify jenkins user and login port
sed -i 's@JENKINS_PORT="8080"@JENKINS_PORT="8008"@' /etc/sysconfig/jenkins
sed -i 's@JENKINS_USER="jenkins"@JENKINS_USER="root"@' /etc/sysconfig/jenkins
# change to root for ssh remote execution

## log path
/var/log/jenkins
# install path /var/lib/jenkins
# /var/lib/jenkins/jobs
# /var/lib/jenkins/workspace

Test installation

netstat -tnlp | grep 8080
http://localhost:8080
http://jenkins-server-ip:8080

Simple Usage

Error

# error
Starting jenkins (via systemctl):  Job for jenkins.service failed. See 'systemctl status jenkins.service' and 'journalctl -xn' for details. [FAILED]
# fixed
install java

# error ,forgot to add 'admin' to Matrix based security authentication
admin没有Overall/Read权限
# fixed
sed -i 's/youyuan/admin/g' /var/lib/jenkins/config.xml
# reason after signup admin user but forgot to add privileges for it
# 'Jenkins' -> 'system management' -> 'Configure Global Security' -> 'Authorization' -> 'matrix-based security'

公众号: DailyJobOps DailyJobOps
作者

Colin

发布于

2015-04-22

许可协议