Jenkins: The most popular open source free continuous integration tool: java language development, used to monitor continuous repetitive work, including: continuous software version release/test project, monitoring external call execution work.
Jenkins is an open source, extensible continuous integration, delivery, deployment (software/code compilation, packaging, deployment) web-based interface platform, originated from Hudson (Hudson is commercial), Jenkins is written in Java language, It runs in popular servlet containers such as Tomcat, or it can run independently. Usually used in conjunction with version management tools (SCM) and build tools. Commonly used version control tools include SVN, GIT, and build tools include Maven, Ant, and Gradle
The characteristics of Jenkins are shown in the figure below
Only one java -jar jenkins.war, after downloading the file from the official website, run it directly, without additional installation, and without installing a database;
Provide a friendly GUI configuration interface;
Jenkins can obtain and generate a code update list from the code repository (Subversion/CVS) and output it to the compilation output information
Users access Jenkins through the web, and the link addresses of these web pages are permanent link addresses, so you can directly use the link in various documents
When an integration is completed, these tools can tell you the result of the integration in real time
Jenkins can distribute work such as integrated construction to multiple computers to complete;
JUnit/TestNG test report: It is to provide detailed test report function in the form of charts and other forms;
Make Jenkins become more and more powerful;
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo
yum clean all
yum makecache
yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel
which java
ll /usr/bin/java
ll /etc/alternatives/java
You can see that the real path of java is /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/jre/bin/java
vi /etc/profile.d/java8.sh
Add the following content
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
cat /etc/profile.d/java8.sh
# source to make it effective
source /etc/profile.d/java8.sh
If you have other JDK environment installed, you can use the following command to switch the default java environment
alternatives --config java
Download jenkins.repo from the official website, then import the key with rpm --import
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install -y jenkins
Since the yum source of jenkins is abroad, yum installation is too slow, you can download the rpm to the local first, and then yum localinstall can install it locally, saving time
yum localinstall jenkins-2.222.4-1.1.noarch.rpm
vi /etc/sysconfig/jenkins
JENKINS_HOME line
change into
JENKINS_HOME="/data/jenkins"
create/data/jenkins directory
mkdir /data/jenkins
Modify the owner of the directory
chown jenkins /data/jenkins
systemctl enable jenkins
systemctl start jenkins
Jenkins default port 8080, of course you can modify it yourself
netstat -anp | grep 8080
Handling method
cd /data/jenkins/
cp hudson.model.UpdateCenter.xml hudson.model.UpdateCenter.xml_bak
vi hudson.model.UpdateCenter.xml
Was originally
<? xml version='1.1' encoding='UTF-8'?><sites><site><id>default</id><url>https://updates.jenkins.io/update-center.json</url></site></sites>
Replace with the following
<? xml version='1.1' encoding='UTF-8'?><sites><site><id>default</id><url>https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json</url></site></sites>
Then systemctl restart jenkins restarts the service
cat /data/jenkins/secrets/initialAdminPassword
cd /data/
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar -zxvf apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3 maven
vi /etc/profile.d/maven.sh
cat /etc/profile.d/maven.sh
export MAVEN_HOME=/data/maven
export PATH=$PATH:$MAVEN_HOME/bin
source /etc/profile.d/maven.sh
Recommended Posts