Linux + Git + Maven + Jenkins + Neuxs automated compilation environment setup
Recently, the complete Git + Maven + Jenkins + Nexus code library + automated compilation environment was built, and the existing information was found to be scattered, So I reorganized it, in addition, I wrote an environment-building document to share with you.
Machine environment: Ubuntu-12.10-desktop-i386.iso-32-bit System
Before installation, ensure that JDK has been installed on the machine and JAVA_HOME has been set.
1. Install Maven
This case uses apache-maven-3.0.5-bin.tar.gz.
Maven installation is relatively simple. You only need to decompress it in windows or linux, and set the environment variable to use it.
1. decompress the downloaded Maven tar package. For example, extract it to/home/sysadmin/evn_pufa.
2: Configure environment variables, edit the/etc/profile file, and add the following code:
MAVEN_HOME =/home/sysadmin/evn_pufa/apache-maven-3.0.5
Export MAVEN_HOMEexport PATH =$ {PATH }:$ {MAVEN_HOME}/bin
3: Save the file and run the following command to make the environment variable take effect.
Source/etc/profile
4: Run mvn-v to check whether the installation is successful. if the version information is displayed, the installation is successful.
5: After installing Maven, you usually need to configure the settings. xml file of Maven, which is used to configure the storage location of the local library, remote Repository Information and other configurations. The file is in apache-maven-3.0.5/conf/settins. xml
2. Install git
In this case, git-1.8.3.4.tar.gz is installed:
You can also use the git command that comes with Ubuntu to automatically download and install apt-get install git, but this method cannot download the latest git version.
1. Download git and decompress the downloaded tar package.
In this case, git-1.8.3.4.tar.gz is the source code package.
Tar-zxvf git-1.8.3.4.tar.gz
Cd git-1.8.3.4
2: The installation method is to uninstall the INSTALL file and follow the instructions to complete the installation. The following command
Install Git in/usr/local/bin.
Make prefix =/usr/local all (compile)
Sudo make prefix =/usr/local install (installation)
3: Check whether git is successfully installed.
Cd/usr/local/bin
Git -- version
If the version information is displayed, the installation is successful.
Note that when you execute the make prefix =/usr/local all (compile operation) command, errors such as curl. h is not a directory may be reported because the related function libraries are not installed on this machine.
The following are common installation commands for function libraries:
Sudo apt-get install curl
Sudo apt-get install libcurl4-gnutls-dev
Sudo apt-get install expat
Sudo apt-get install libexpat-dev
Sudo apt-get install libssl-dev
Sudo apt-get install openssh-server
Install nexus
The package is installed on the jetty server of nexus-2.7.0-06-bundle.tar.gz. You can also download and install the war package from the official website.
1: unzip tar-zxvf nexus-2.7.0-06-bundle.tar.gz-C./nexus
2: Start nexus
Cd./nexus-2.7.0-06/bin
./Nexus start
3: Check whether the instance has been started.
Cd./nexus-2.7.0-06/bin
./Nexus status
Or directly access localhost: 8081/nexus
4: Stop nexus
Cd./nexus-2.7.0-06/bin
./Nexus stop
Note the problems that may occur during installation:
1: RUN_AS_USER = "username" is not configured. It is recommended that you do not use root as the username for nexus.
Useradd new username
Passwd Password
Cd./nexus-2.7.0-06/bin
Vim nexus -- modify RUN_AS_USER = "username"
2: JDK1.7 or later is required for the latest Nexus version.
3: If you want to create a new nexus, but the jar on the repository must be used again, you can modify it in the plexus. properties file.
Nexus-work = E:/build_workspace/sonatype-work/nexus
File located at:./nexus-2.7.0-06/nexus/WEB-INF/plexus. properties
4. Install Jenkins
Jenkins is a war package directly placed under the application server, which can be accessed by the startup server.
For example, in this case, place Jenkins. war directly under tomcat's webapps and then start. Jenkins automatically creates a Jenkins directory under webapps at startup, so you need to add/Jenkins
Example: localhost: 8080/Jenkins
To configure Jenkins. The configuration of a locally deployed project http: // 192.168.2.2: 8083/jenkins is used as an example.
Click Manage JenkinsConfigure System to go to the System configuration page.
You need to configure the following items:
1: configure the settings. xml file of Maven in Maven Configuration.
2: The product compiled by SSH remote hosts in daily compilation usually needs to be saved to a machine, where the information of this machine is configured.
3: Configure JDK for compilation
4: Configure Git location in Git
5: Configure Maven location
6: Configure Maven Project Configuration to configure JVM parameters and local database location during Maven Compilation
Distributed building and deployment of Jenkins-nodes
Maven official guide _ Chinese full version clear PDF
Maven 3.1.0 release, Project Build Tool
Install Maven in Linux
Maven3.0 configuration and simple use
Set up sun-jdk and Maven2 in Ubuntu
Get started with Maven