Linux environment deployment records (3) and linux environment deployment records
Install Jenkins
To be compatible with the jdk1.7 production environment, we know from the official website that Jenkins must be a version earlier than 1.6, So download the jenkins-1.596.3-1.1.noarch.rpm to local installation:
# Move to rpm package directory rpm-ivh jenkins-1.596.3-1.1.noarch.rpm
After the installation, modify the Jenkins configuration file:
vi /etc/sysconfig/jenkins
Modify the following two items according to the actual situation. tomcat usually occupies ports 8080 and 8009:
Remember to enable the corresponding port in the firewall and restart Jenkins:
service jenkins restart
Open the browser and enter http: // IP: port to see that Jenkins has been started:
Jenkins Configuration
For Jenkins configuration, the official documentation and web blog have already been very detailed. Here we will only introduce the most basic configuration, so that Jenkins can work as soon as possible.
Click Create a new task and enter the task name. Here, the maven project is used as an example:
Enter the Project Name and description:
Svn is used for source code management. Note that the svn address should be provided directly to the Development Branch instead of the entire repository; otherwise, it cannot be constructed:
Build a trigger and use the round-robin SVN update. Once an update is detected, the build is triggered. The calendar is a round-robin cycle. Here, it is set to 50 minutes ,:
To build this column, you are prompted that Jenkins requires the Maven installation path. Click the system configuration:
Find the Maven column, click the Maven installation button, and enter the name and path in the input box:
After saving the file, do not worry about starting the build. Otherwise, the directory cannot be created or deleted due to insufficient permissions. You need to add jenkins to the sudoer list first:
vi /etc/sudoers
To allow jenkins users to allow any command:
Next, you can click "build now" in the left-side navigation bar and troubleshoot the problem step by step based on the build prompt:
To better execute shell scripts in the pre-build and post-build phases, jenkins needs to execute shell commands as root.
Modify the Jenkins configuration file:
vi /etc/sysconfig/jenkins
Set$ JENKINS_USER:
Then, change the owner of the Jenkins-related path to root:
chown -R root:root /var/lib/jenkinschown -R root:root /var/cache/jenkinschown -R root:root /var/log/jenkins
Restart Jenkins and you can see that the user has changed:
service jenkins restartps -ef | grep jenkins