CentOS on Jenkins Installation _ operation dimension

Source: Internet
Author: User


Jenkins installation on CentOS



Article Source: http://www.cnblogs.com/zhangqingsh/archive/2013/03/19/2968998.html



1. Add Jenkins Source (repository):


$ 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





2. Install/check JDK:


$ Java--version
$ sudo yum install JAVA-1.6.0-OPENJDK


3. Install Jenkins:


$ sudo yum install Jenkins


After the installation is complete, there are the following related directories:



(3.1)/usr/lib/jenkins/:jenkins installation directory, the war package will be placed here.


$ cd/usr/lib/jenkins
$ ll
-rw-r--r--1 root root 52891723 Feb 00:13


(3.2)/etc/sysconfig/jenkins:jenkins configuration files, "Ports", "Jenkins_home" can be configured here. The contents are as follows:


## Path:        Development/Jenkins
## Description: Configuration for the Jenkins continuous build 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"

## Type:        string
## Default:     ""
## ServiceRestart: jenkins
#
# Java executable to run Jenkins
# When left empty, we'll try to find the suitable Java.
#
JENKINS_JAVA_CMD=""

## 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"

## Type:        string
## Default:     "-Djava.awt.headless=true"
## ServiceRestart: jenkins
#
# Options to pass to java when running Jenkins.
#
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true"


## Type:        integer(0:65535)
## Default:     8080
## ServiceRestart: jenkins
#
# Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_PORT="8080"

## Type:        integer(0:65535)
## Default:     8009
## ServiceRestart: jenkins
#
# Ajp13 Port Jenkins is listening on.
# Set to -1 to disable
#
JENKINS_AJP_PORT="8009"

## Type:        integer(1:9)
## Default:     5
## ServiceRestart: jenkins
#
# Debug level for logs -- the higher the value, the more verbose.
# 5 is INFO.
#
JENKINS_DEBUG_LEVEL="5"

## Type:        yesno
## Default:     no
## ServiceRestart: jenkins
#
# Whether to enable access logging or not.
#
JENKINS_ENABLE_ACCESS_LOG="no"

## Type:        integer
## Default:     100
## ServiceRestart: jenkins
#
# Maximum number of HTTP worker threads.
#
JENKINS_HANDLER_MAX="100"

## Type:        integer
## Default:     20
## ServiceRestart: jenkins
#
# Maximum number of idle HTTP worker threads.
#
JENKINS_HANDLER_IDLE="20"

## Type:        string
## Default:     ""
## ServiceRestart: jenkins
#
# Pass arbitrary arguments to Jenkins.
# Full option list: java -jar jenkins.war --help
#
JENKINS_ARGS=""


(3.3)/var/lib/jenkins/: The default jenkins_home. The directory structure is as follows:


$ cd /var/lib/jenkins/
$ ls -lst
total 216
4 -rw-r--r--   1 jenkins jenkins    0 Mar 18 23:59 Fingerprint cleanup.log
4 -rw-r--r--   1 jenkins jenkins    0 Mar 18 18:54 Workspace clean-up.log
8 drwxr-xr-x 180 jenkins jenkins 4096 Mar 18 17:04 fingerprints
8 -rw-r--r--   1 jenkins jenkins 1636 Mar 18 16:41 config.xml
8 -rw-r--r--   1 jenkins jenkins  903 Mar 18 16:41 hudson.maven.MavenModuleSet.xml
8 -rw-r--r--   1 jenkins jenkins 1122 Mar 18 16:41 hudson.plugins.sonar.SonarPublisher.xml
8 -rw-r--r--   1 jenkins jenkins  205 Mar 18 16:41 hudson.plugins.sonar.SonarRunnerInstallation.xml
8 -rw-r--r--   1 jenkins jenkins  196 Mar 18 16:41 hudson.scm.CVSSCM.xml
8 -rw-r--r--   1 jenkins jenkins  692 Mar 18 16:41 hudson.scm.SubversionSCM.xml
8 -rw-r--r--   1 jenkins jenkins  145 Mar 18 16:41 hudson.tasks.Ant.xml
8 -rw-r--r--   1 jenkins jenkins  187 Mar 18 16:41 hudson.tasks.Mailer.xml
8 -rw-r--r--   1 jenkins jenkins  330 Mar 18 16:41 hudson.tasks.Maven.xml
8 -rw-r--r--   1 jenkins jenkins   76 Mar 18 16:41 hudson.tasks.Shell.xml
8 -rw-r--r--   1 jenkins jenkins  215 Mar 18 16:41 hudson.triggers.SCMTrigger.xml
8 -rw-r--r--   1 jenkins jenkins  264 Mar 18 16:41 jenkins.model.JenkinsLocationConfiguration.xml
8 -rw-r--r--   1 jenkins jenkins  907 Mar 18 16:29 nodeMonitors.xml
8 -rw-r--r--   1 jenkins jenkins  159 Mar 18 16:29 hudson.model.UpdateCenter.xml
8 -rw-r--r--   1 jenkins jenkins   46 Mar 18 16:29 queue.xml.bak
8 drwxr-xr-x   2 jenkins jenkins 4096 Mar 18 16:24 updates
4 -rw-r--r--   1 jenkins jenkins    0 Mar 16 10:27 Connection Activity monitoring to slaves.log
8 drwxr-xr-x   6 jenkins jenkins 4096 Mar 13 18:24 workspace
8 drwxr-xr-x  13 jenkins jenkins 4096 Mar 13 17:59 jobs
8 drwx------   2 jenkins jenkins 4096 Feb 28 11:16 secrets
8 -rw-r--r--   1 jenkins jenkins  165 Feb 27 13:29 sonar.xml
8 drwxr-xr-x  14 jenkins jenkins 4096 Feb 27 13:29 plugins
8 -rw-------   1 jenkins jenkins 1679 Feb 27 12:12 identity.key
8 drwxr-xr-x   2 jenkins jenkins 4096 Feb 27 12:12 userContent
8 -rw-r--r--   1 jenkins jenkins   64 Feb 27 12:12 secret.key
4 -rw-r--r--   1 jenkins jenkins    0 Feb 27 12:12 secret.key.not-so-secret


(3.4)/var/log/jenkins/jenkins.log:jenkins log file.



4. Start Jenkins


$ sudo service Jenkins start


An error may occur: "Starting Jenkins-bash:/usr/bin/java:no such file or directory." Indicates that Jenkins cannot be found without java.



Then you need "vi/etc/init.d/jenkins" to add the Java path (as follows):



# Search usable Java. We do this because various reports indicated
# That/usr/bin/java may isn't always point to Java 1.5
# http://www.nabble.com/guinea-pigs-wanted-----hudson-rpm-for-redhat-linux-td25673707.html
The for candidate in/etc/alternatives/java/usr/lib/jvm/java-1.6.0/bin/java/usr/lib/jvm/jre-1.6.0/bin/java/usr/lib/ Jvm/java-1.5.0/bin/java/usr/lib/jvm/jre-1.5.0/bin/java/opt/app/jdk1.7.0_09/bin/java



Do
(x "$JENKINS _java_cmd"] && break
Jenkins_java_cmd= "$candidate"
Done



5. Login Jenkins



If you do not have a specially configured port, use Http://<ip address>:8080/to log in Jenkins and make related configuration (plug-in installation, permissions configuration, View/job creation, and so on).





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.