Table of contents
Official website address: Jenkins
Installed paths in the jenkins server: jdk, git, maven
1. Install jdk
First retrieve the list containing java
yum list java*
Retrieve the list for 1.8
yum list java-1.8*
Install all files for 1.8.0
yum install java-1.8.0-openjdk* -y
Use the command to check whether the installation is successful
java -version
2. Install maven
- download
wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
- Unzip
tar -zxvf apache-maven-3.6.3-bin.tar.gz
- Configuration variable environment
Edit vim /etc/profile and enter the following:
export MAVEN_HOME=/root/data/apache-maven-3.6.3
export MAVEN_HOME
export PATH=$PATH:$MAVEN_HOME/bin
- Make the configuration effective
source /etc/profile
- Check the version information to see if the installation is successful. The success is as follows:
mvn -v
- Configure maven local warehouse path
Enter the conf directory of the decompressed apache-maven-3.6.3 and edit the settings.xml configuration file:
cd apache-maven-3.6.3/conf
- Edit the settings.xml file:
vim settings.xml
- Configure the Alibaba Cloud image download address
Find the mirrors tag and add the Alibaba Cloud mirror download address:
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
Save and exit settings.xml
wq!
3. Install Git
yum -y install git
default path
/usr/bin/git
4. Install jenkins
Official website address: Jenkins
- Use the wget command to download the Jenkins rpm file:
wget https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.190.3-1.1.noarch.rpm
- Install jenkins using rpm -ivh command
rpm -ivh jenkins-2.190.3-1.1.noarch.rpm
- Start the jenkins service
systemctl start jenkins
- Check jenkins status
systemctl status jenkins
Precautions
如果启动成功不能访问,查看防火墙或者云服务器安全组开放对应端口
- Check the firewall status:
systemctl status firewalld
Note: You can see "active (running)" below, which means the firewall has been turned on.
- Turn off firewall
systemctl stop firewalld
- Check the firewall status:
Note: If you see "inactive (dead)" below, it means that the firewall has been turned off.
- Enter ip+8080 in the browser to visit:
View password:
systemctl stop firewalld
Jenkins start
#systemctl start jenkins
Restart
systemctl restart jenkins
stop
systemctl stop jenkins
View jenkins process
ps -ef|grep jenkins
jenkins port modification
The degree should not be less than 2000
vim /usr/lib/systemd/system/jenkins.service
# 修改为想要的端口
Environment="JENKINS_PORT=8989"
# 重新加载配置文件
systemctl daemon-reload
Modify jenkins memory
vi /etc/sysconfig/jenkins
turn upJENKINS_JAVA_OPTIONS="-Djava.awt.headless"
changed to
JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Xms256m -Xmx512m -XX:MaxNewSize=256m -XX:MaxPermSize=256m"