Deployment jenkins + git

Jenkins Profile

Jenkins is an open source software project, continuous integration tool is based on a Java development for continuous monitoring duplication of work, aims to provide an open and easy to use software platform that enables continuous integration software has become possible

 

Install and start thinking:

Installation Preparation: First, to ensure that the system has been installed jdk, preferably more than jdk1.5

Starting a first method, change to the directory stored jenkins.war, enter the following:

命令:java -jar jenkins.war

If you need to modify the port can use the following command:

命令:java -jar jenkins.jar--httpPort=8081

Then in the browser (Firefox recommended) enter localhost: 8081, localhost can be ip of the machine, may be a computer name. It can open jenkins

The second method is to open by tomcat

Tomcat unzip to a directory, such as / usr / local, into the / bin directory under the tomcat, start tomcat

The jenkins.war file into the webapps directory of tomcat, the tomcat startup, will automatically create jenkins directory in the webapps directory, you need to enter in the address bar

localhost:8080/jenkins

 

git commonly used commands

git config --global user.name "name" set the global user name

git config --global user.email mail set global mailbox

git config --global --list lists the user global settings

git add index.html to add files to the staging area

git commit -m "description" submission of documents to the workspace

git status to view the status of the work area

git push git commit code to the server

Get the code to a local git pull

git log to see the operation log

View current branch git branch located

git checkout - file server update files covering local culture

 

Jenkins said above is based on java to do it, so do first before deploying Java environment

(1) 1.Jdk installation

Command: wget http://192.168.130.150/jdk/jdk-8u211-linux-x64.tar.gz # here has just great

Command: mkdir / usr / java

Command: tar -xvf jdk-8u211-linux-x64.tar.gz -C / usr / java /

Command: echo 'export PATH = / usr / java / jdk1.8.0_211 / bin /: $ PATH' >> / etc / profile # set environment variables

Command: echo 'export JAVA_HOME = / usr / java / jdk1.8.0_211' >> / etc / profile # path to the specified environment variable

Command: source / etc / profile # statement to refresh data

Command: java -version # View java version

 

 

2.tomcat installation

Command: wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.29/bin/apache-tomcat-9.0.29.tar.gz

命令: tar -xvf apache-tomcat-9.0.29.tar.gz

命令:mv apache-tomcat-9.0.29 /usr/local/tomcat

命令:rm -rf /usr/local/tomcat/webapps/*

 

3.maven installation

Command: wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

命令: tar -xvf apache-maven-3.6.3-bin.tar.gz

命令:mv apache-maven-3.6.3 /usr/local/maven

Command: echo 'export MAVEN_HOME = / usr / local / maven /' >> / etc / profile # set environment variables

Command: source / etc / profile # refresh data

Command: ln -s / usr / local / maven / bin / mvn / usr / bin / # Create a soft link

Command: mvn --version # View version

 

4.jenkins installation (in the official website to download the war package)

Command: wget http://mirrors.jenkins.io/war-stable/latest/jenkins.war    

命令:cp jenkins.war /usr/local/tomcat/webapps/

Command: /usr/local/tomcat/bin/startup.sh start tomcat

Command: ss -tunlp | grep: 8080 view of the port tomcat

 

Modify the configuration file jenkins

Command: vim /root/.jenkins/hudson.model.UpdateCenter.xml

The original http://updates.jenkins-ci.org/update-center.json    changed  http://mirror.xmission.com/jenkins/updates/update-center.json

Command: /usr/local/tomcat/bin/shutdown.sh # closed tomcat

 

Command: /usr/local/tomcat/bin/startup.sh # open tomcat

 

Enter in the browser address bar http: // ip: 8080 / jenkins

Because I've done in the previous gitlab (default port 8080) and No. tomcat port conflicts, so we have to modify the tomcat port number

Command: vim /usr/local/tomcat/conf/server.xml #tomcat profile

Find the <Connector port = '8080' protocol = "HTTP / 1.1" will replace the port number you Xiangnong 8080, I set 8088

 

 

Then restart tomcat, turn off the restart, and then look at the port number

Command: ss -antulp | grep 8088

 

 

Then the browser to http: // ip: 8080 / jenkins

Command: cat /root/.jenkins/secrets/initialAdminPassword

 

 

 

 

 

 Enter the option, choose to install the plugin, we need to wait for downloads

 

 

 

 Create a user and password

Now regarded deployed, then add nodes

 

(2) adding from node

Add a slave end node as

192.168.175.104      slave端

And server environment as first download jdk

Command: wget http://192.168.130.150/jdk/jdk-8u211-linux-x64.tar.gz

Command: tar -zvxf jdk-8u211-linux-x64.tar.gz

命令:mkdir /usr/local/java

Command: mv /root/jdk1.8.0_211/ / usr / local / java

Command: cp -pv / etc / profile /etc/profile.bak

命令:echo  "export JAVA_HOME=/usr/local/java"  >> /etc/profile

命令:echo  "export PATH=$JAVA_HOME/bin:$PATH" >> /etc/profile

命令:source /etc/profile

命令:ln -s /usr/local/java/jdk1.8.0_211/bin/java /usr/bin

命令:java -version

java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)

 

现在从节点已经做好了,然后添加到服务端

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/zgqbky/p/12037405.html