Linux (Centos7) install jenkins (jdk1.8+jenkins2.346), and configure jdk, maven, git, gitee

foreword

You must install jdk before installing jenkins. The latest version of jenkins requires jdk11 or above. Here I install jenkins-2.346+jdk8 (jdk1.8), install git and maven at the same time, and configure it for later use.
The following figure is the matching figure of each jenkins version and the required jdk version

insert image description here

1. jdk installation

-Refer to this link article to install jdk8 (jdk1.8)
JDK installation: https://blog.csdn.net/dontYouWorry/article/details/128919926

Two, maven installation

- Refer to this link article to install maven
maven installation: https://blog.csdn.net/dontYouWorry/article/details/128934720

Three, git installation

1. Install git

yum -y install git

insert image description hereinsert image description here
2. View version

git --version

insert image description here

Fourth, jenkins installation

1. Download the jenkins-rpm package

wget https://repo.huaweicloud.com/jenkins/redhat-stable/jenkins-2.346.3-1.1.noarch.rpm

insert image description here
2. Install

rpm -ivh jenkins-2.346.3-1.1.noarch.rpm

3. Modify the jenkins configuration - add your own jdk path - - If you do not modify the java path, it will fail to start

vim /etc/init.d/jenkins 

insert image description here
4. Modify the jenkins user permission to root

#将JENKINS_USER="jenkins 改为 JENKINS_USER="root"
vim /etc/sysconfig/jenkins

insert image description here

5. Start the jenkins service

#在 /etc/init.d/ 执行
./jenkins start  #启动服务

#其他指令
./jenkins stop    #关闭服务
./jenkins restart #重启服务

insert image description hereinsert image description here

6. Browser access login - - - (http://IP:8080/) Pay attention to the open port
of the firewall before connecting8080

#防火墙开放8080端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
systemctl restart firewalld   #重启

View default login password

cat /var/lib/jenkins/secrets/initialAdminPassword

insert image description here
insert image description hereinsert image description here
There is no need to download plug-ins, because many plug-ins are downloaded too slowly, and it is easy to waste time on download failures. You can download the required plug-ins in a targeted manner later
insert image description hereinsert image description hereinsert image description here
insert image description here

1. Set Chinese display

1. Download the plugin
Click Dashboard>Manage Jenkins> Plugin Manager
to download
Localization: Chinese (Simplified)
Locale
insert image description here
2. First set the language to English display

insert image description here
3. Restart jenkins

#在 /etc/init.d/ 执行
./jenkins restart

insert image description here
4. Reset the language to Chinese display, 保存just click

insert image description here
5. If Chinese is not complete, half Chinese and half English, first set the default language to English, restart Jenkins and then set it to Chinese, that is, repeat steps 2 - 4
*注意: Jenkins may still have incomplete Chinese after an accident or manual restart, continue 步骤2-4can
insert image description hereinsert image description here

2. Plug-in download

Deploy to container(Supports automatic code deployment to tomcat container)
Maven Integration(jenkins uses maven to compile, package, required plug-ins)
Node.js(packages vuerequired plug-ins for front-end projects)
Git (git plug-in, pull code from hosting platform)
Giteeor Githubor Gitlab(gitee plug-in - private code warehouse )
Publish Over SSH(ssh transfer to another server)

3. Port change

1. Change the configuration file

#更改JENKINS_PORT
vim /etc/sysconfig/jenkins

insert image description here
2. The firewall opens the changed port and restarts

#重启
./jenkins restart
#防火墙开放8083端口
firewall-cmd --zone=public --add-port=8083/tcp --permanent
systemctl restart firewalld   #重启

4. Global tool configuration

1. maven configuration
insert image description here

2. jdk configuration
insert image description here

3. git configuration
insert image description here

5. System configuration

Gitee configuration
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/dontYouWorry/article/details/129007966