Jenkins builds the environment on the Linux platform, as well as Jenkins installation permissions issues

Source: Internet
Author: User
Tags file permissions

First assume that your machine has finished jdk,maven, and already have Tomcat, so this step is not discussed here.

There are two ways to install Jenkins: the first is on the official website as follows:

Jenkins Download URL:

The http://jenkins-ci.org/download of the war package is placed directly inside the Tomcat container, which is a simple installation procedure, no more speaking.

The second type of installation:

I believe a lot of people have the same problem building the Jenkins environment, and now I am sharing my experience with the building of the environment:

First step: Install Jenkins:

Wget-q-o-https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add-sudo sh-c ' echo deb http://pkg.jenkins.io/debian-stable binary/>/ETC/APT/SOURCES.LIST.D/JENKINS.L Ist ' sudo apt-get updatesudo apt-get Install Jenkins

To upgrade the Jenkins version:
sudo apt-get updatesudo apt-get Install Jenkins

After installing the Jenkins,jenkins installer will create a Jenkins user to run the Jenkins service, typically starting a daemon service by default, the relevant configuration file in: /etc/init.d/jenkins;
Default port number: 8080, you can modify the port number in the configuration file
http_port=8080
Start Jenkins:sudo service Jenkins Start|stop

Generate log file Address: /var/log/jenkins/jenkins.log

To the end of this Jenkins installation.

Reference Document: Https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu





Step Two: Automate build settings: Automatically download code from the source repository, compile, package, and deploy to the container.

After the build is complete, the shell configuration is executed:

#!/bin/bash
Tomcat_pid= ' lsof-n-p-t-i:9080 '
[-N "$tomcat _pid"]&& kill-9 $tomcat _pid
Tomcat_dir= "/home/mission/apache-tomcat-7.0.47/webapps"
CD $tomcat _dir
[!-d "Bak"]&& mkdir "bak"
If [-F "Egs.war"];then
CP Egs.war "Bak/egs.war.bak";
Fi
If [-F Egs.war];then RM-RF egs*;
Else
echo "No Egs.war is existed";
Fi
CP "/var/lib/jenkins/workspace/egs/target/egs.war" "/home/mission/apache-tomcat-7.0.47/webapps/egs.war"
Cd..
./bin/startup.sh

If you encounter a problem with no permissions: such as no permissions in the Tomcat directory can not delete files, or copy files and other column operations, this occurs because of file permissions problems: for example,

This file is not owned by Jenkins and the owning group of the file does not contain Jenkins. The workaround for this situation is to change the array of this file: Execute chown, change the genus, belong to the master.





Jenkins builds the environment on the Linux platform, as well as Jenkins installation permissions issues

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.