Jenkins detailed installation tutorial

I. Introduction

This article mainly introduces two ways to quickly build jenkins

2. Introduction to Jenkins

Jenkins is an open source software project. It is a continuous integration tool developed based on Java. It is used to monitor continuous and repetitive work. It aims to provide an open and easy-to-use software platform to make continuous integration of software possible.

3. According to the preparatory work

1. The docker has been installed
2. Or the pagoda panel has been installed

4. Installation method

Method 1: Docker installation
  1. Download the jenkins image
docker pull jenkins/jenkins

2. Create a jenkins mount directory and assign permissions

mkdir -p /var/jenkins_mount
chmod 777 /var/jenkins_mount

3. Create and start the Jenkins container

docker run -d -p 10240:8080 -p 10241:50000 -v /var/jenkins_mount:/var/jenkins_home -v /etc/localtime:/etc/localtime --name myjenkins jenkins/jenkins

-d 标识是让 docker 容器在后台运行
-p 10240:8080 将镜像的8080端口映射到服务器的10240端口
-p 10241:50000 将镜像的50000端口映射到服务器的10241端口
-v /var/jenkins_mount:/var/jenkins_mount /var/jenkins_home目录为容器jenkins工作目录,我们将硬盘上的一个目录挂载到这个位置,方便后续更新镜像后继续使用原来的工作目录。这里我们设置的就是上面我们创建的 /var/jenkins_mount目录
--name定义一个容器的名字,如果没有指定,那么会自动生成一个随机数字符串当做UUID

4. Configure mirror acceleration, enter the hudson.model.UpdateCenter.xml file under /var/jenkins_mount/, and modify it to the following content

<?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>

5. The first visit to jenins (ip: 10240) needs to be unlocked
[the transfer of the external link image failed, the source site may have an anti-leeching mechanism, it is recommended to save the image and upload it directly (img-Nsd1BtrK-1614666167298) (/img/bVcO6N5)]
input cat /var/jenkins_mount/secrets/initialAdminPasswordget unlock code

6. Install the plug-in (choose to install the recommended plug-in)
insert image description here

7. After the installation is complete, it will automatically jump to the creation user interface
8. After the creation is complete, enter the home page
insert image description here

Method 2: Pagoda panel installation

1. In the pagoda panel, follow the java project manager
2. Open the java project manager and choose to install tomcat8
insert image description here

3. Enter the /www/server/tomcat8/webapps directory, and then select remote download according to the jenkins war package (download address: http://mirrors.jenkins.io/war-stable/latest/jenkins.war)
4. Browser input Address: ip:8082/jenkins 5.
Repeat 6 and 7 of method 1 to complete the configuration

V. Summary

This article also sorts out the method of installing jenkins online, and the method of using jenkins will be updated later

Guess you like

Origin blog.csdn.net/m0_37572422/article/details/114284346