Foreword
Jenkins is built notebook.
JDK
1. jdk Download https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html , gz download package, e.g. jdk-8u221-linux-x64.tar.gz
2. uploaded to the server, such as the path / app / jdk
3. Extract
tar -zxvf jdk-8u221-linux-x64.tar.gz
4. Modify the environment configuration, edit profile
vim /etc/profile
Press i to enter edit mode, add to the file
export JAVA_HOME=/app/jdk1.8.0_221
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin:
Press esc to exit the editor, press shift + zz save and exit, if a lot of error correction, press esc to exit the editor, press:! Enter the edit command, enter q + enter to exit without saving
source / etc / profile file to reload
5. View the java version number, if you see the configuration is successful
java -version
MAVEN
1. to http://maven.apache.org/download.cgi download archive, upload / app directory, execute the command or direct download
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.tar.gz
2. Extract
tar zxvf apache-maven Over 3.6 . 2 bin. tar .gz
3. Edit profile
vim /etc/profile
Appends
export MAVEN_HOME=/app/apache-maven-3.6.2
export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin
Press esc and shift + zz save and exit
source / etc / profile file to reload
4. Check the version number mvn
mvn -version
GIT
1. to https://github.com/git/git/releases download the latest Or, execute the command
wget https://github.com/git/git/archive/v2.23.0.tar.gz
2. Extract
tar zxvf v2. 23.0 . tar .gz
3. Compile install
make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install
4. Edit profile
vim /etc/profile
Additional modifications to the file
export PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:/usr/local/git/bin
Press esc and shift + zz save and exit
Implementation of source / etc / profile file to reload
5. View version
git --version
6. Configure User Name
git config --global user.name "xxxx" git config --global user.email "[email protected]"
7. The generated secret key
cd ~/ mkdir .ssh cd .ssh ssh-keygen -t rsa -C "[email protected]"
8. Run, to obtain a public key, the public key is added to the secret key inside the repository git
cat ~/.ssh/id_rsa.pub
9. Test clone warehouse
git clone ssh://xxxxxxx.git
Jenkins
1 to https://jenkins.io/zh/doc/book/installing/ download war package, download or execute command
wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war
2. Upload the path to the app, start
nohup java -jar -Dhudson.util.ProcessTree.disable=true /app/jenkins.war --httpPort=9090 > /app/root.log
3. browser to open http: // xxxxxxxxx: 9090, install all the plug-ins
4. System Management - Global configuration tools, are provided server path jdk, git, maven of
5. System Management - the system is provided, typically compiled to be transmitted to another server deployment, so to configure ssh
6. New automatic deployment tasks, select maven
6. In the task, add the git repository configuration
Add Credential
The private key on the server to fill
7. Add a post-build action, select the configuration settings in the global configuration ssh, add a remote shell script, noting that the script inside path is recommended to use absolute paths