Jenkins installation under centos

title: Jenkins installation under centos
date: 2015-04-22 13:02:23 +0800
comments: true
category: Jenkins
tags: jenkins,linux

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'
    原文作者:全栈运维
    原文地址: https://www.jianshu.com/p/804043016e38
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞