Linux Build Jenkins Platform

Source: Internet
Author: User

In order to make continuous integration with the previous ant+jenkins, a Jenkins platform needs to be built in a Linux environment. There are many examples of installation on the Internet, I mainly record the problems I encountered, really is particularly melancholy, every time I encountered a lot of problems.

Mainly divided into three pieces of content, specifically as follows:

* Installation

* Problems and solutions,

One Install Jenkins

1 First confirm that the machine has installed the JDK, confirm the way: Enter java-versionon the Linux machine, if the system can recognize the Java command, it means that the JDK is installed, as follows

Get the Java version of the 1.7.0_79, note: Some versions of Jenkins cannot use the 1.6 jdk

2 Installing Jenkins

A Offline Installation:

① Download the Jenkins.war package. Jenkins official Address:http://Jenkins-ci.org/(Latest War package: Http://mirrors.jenkins-ci.org/war/latest/jenkins.war)

② Download a tomcat container in the WebApps to put Jenkins.war, do not unzip.

③ Execute java-jar jenkins.war in cd/opt/soft/tomcat/webapps/

④ See if there is an exception to the log, visit http://ip:8080 to see the Jenkins interface and Jenkins installed successfully.

B Online Installation

Use the Yum command to install online and start with the service command, as follows:

Wget-o/etc/yum.repos.d/jenkins.repo http://jenkins-ci.org/redhat/jenkins.repo   rpm--import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key           Yum Install Jenkins  
[[Email protected] run]# Service Jenkins start
Starting Jenkins [OK]
[[Email protected] run]# Service Jenkins Status
Jenkins (PID 23873) is running ...

Browser access to http://ip:8080 to see the Jenkins interface, Jenkins installation success

Two problems encountered

Issue 1:User Jenkins does not exist when performing yum install Jenkins

FIX: There is no Jenkins user on this machine, need to use AddUser command to create the user, AddUser command need to cooperate with change passwd and so on permission bit complete

[[Email protected] ~/etc/passwd       #是因为该文件加了权限位, no write operation
[Email protected] etc]# lsattr passwd #进行确认
----I--------e-passwd
[Email protected] etc]# chattr-i passwd #去掉权限位
[Email protected] etc]# lsattr passwd #进行确认
-------------E-PASSWD
[Email protected] etc]# AddUser Jenkins #即可创建成功jenkins用户

Issue 2: Modify the Port of Jenkins

Resolution: After completing the online installation of Jenkins, check the/usr/lib/jenkins/jenkins.war; View/etc/sysconfig/jenkins is Jenkins's configuration file

To modify the port number of a Jenkins file:

Vim/etc/sysconfig/jenkins Edit the file, modify the following two ports

Jenkins_port= "8001"

Jenkins_ajp_port= "8009"

Save the file and exit, restart Jenkins (service Jenkins restart), Access http://ip:8001 in the browser, and open the Jenkins page.

Problem 3:jenkins Start-up log error:

Waring:could not intialize the host network interface on Nullbecause of a error:101/udp

Java.net.unknownhostexception:101/udp

Cause: Perform hostname on Linux and get 101/udp. Normal should be through the hostname to obtain the corresponding machine IP, but obviously 101/udp in the resolution does not pass, so unable to locate the IP, resulting in an error.

FIX: Update hostname. Execute the statement for hostname bjdhj-120-215.58os.org (define a reasonable hostname name yourself), use other machines to ping the hostname to see if the corresponding IP can be properly obtained.

Start Jenkins.war again, the log is normal, you can access the Web page.

Issue 4: Not correct stop Jenkins

[[Email protected] ~]# Service Jenkins stop
Shutting down Jenkins [failure]

Resolve the 1:java version conflict, verify that there are java1.6 java1.7 or other, uninstall, and keep only one

Resolution 2: Reinstall Jenkins, then execute the Yum install Jenkins again.

Resolution 3: I was re-installed OK, but I always feel that there are other places to solve this problem, so the first to keep the pit.

Linux Build Jenkins Platform

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.