centos installation jenkins

Table of contents

1. Install jdk

2. Install maven

3. Install jenkins

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*   

![][img-0]

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

  1. download
wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
  1. Unzip
tar -zxvf apache-maven-3.6.3-bin.tar.gz
  1. 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
  1. Make the configuration effective
source /etc/profile
  1. Check the version information to see if the installation is successful. The success is as follows:
mvn -v
  1. 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
  1. Edit the settings.xml file:
vim settings.xml

  1. 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

  1. 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
  1. Install jenkins using rpm -ivh command
rpm -ivh jenkins-2.190.3-1.1.noarch.rpm
  1. Start the jenkins service
systemctl start jenkins
  1. Check jenkins status
systemctl status jenkins

Insert image description here

Precautions

如果启动成功不能访问,查看防火墙或者云服务器安全组开放对应端口

  1. Check the firewall status:
systemctl status firewalld

Note: You can see "active (running)" below, which means the firewall has been turned on.
Insert image description here

  1. Turn off firewall
systemctl stop firewalld

  1. Check the firewall status:

Note: If you see "inactive (dead)" below, it means that the firewall has been turned off.

  1. 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"

おすすめ

転載: blog.csdn.net/caidingnu/article/details/129467080