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