ubuntu install Jenkins

1. Introduction

Jenkins is an open source automation server designed to automate the repetitive technical tasks involved in continuous integration and delivery of software. Jenkins is Java-based and can be installed from the Ubuntu software package, or by downloading and running its web application ARchive (WAR) file-forming a complete collection of web applications, the file is designed to run on the server.

In this tutorial, we will install Jenkins by adding its Debian package repository, and then use that repository to install the package using apt-get.

prerequisites

To follow this tutorial, you will need:

Install Java SDK

Since the default update source is slow, modify it to the update source of Alibaba Cloud

vim /etc/apt/sources.list

Clear the contents of the file and add the following:

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted
deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu xenial-security main restricted
deb http://mirrors.aliyun.com/ubuntu xenial-security universe
deb http://mirrors.aliyun.com/ubuntu xenial-security multiverse

Officially install java jdk

apt-get update
sudo apt-get install -y openjdk-8-jdk
apt-get clean all

Two, install Jenkins

Note: I am using a separate server here to install Jenkins

The version of Jenkins included in the default Ubuntu package often lags behind the latest version of the project itself. In order to take advantage of the latest fixes and features, we will use the package maintained by the project to install Jenkins.

First, we add the repository key to the system.

wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add -

After adding the key, the system will return OK. Next, we append the Debian package repository address to the server's sources.list:

echo deb http://pkg.jenkins.io/debian-stable binary/| sudo tee /etc/apt/sources.list.d/jenkins.list

When these two are in place, we will run update so that apt-get will use the new repository:

sudo apt-get update

Finally, we will install Jenkins and its dependencies, including Java:

sudo apt-get install -y jenkins

Now that Jenkins and its dependencies are in place, we will start the Jenkins server.

Three, start Jenkins

Using systemctl we will start Jenkins:

sudo systemctl start jenkins

Since systemctl does not display output, we will use its status command to verify whether it started successfully:

sudo systemctl status jenkins

If all goes well, the beginning of the output should show that the service is active and configured to start on boot:

● jenkins.service - LSB: Start Jenkins at boot time
 Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
 Active: active (exited)since Thursday 2019-08-0820:27:37 CST; 33s ago
  Docs: man:systemd-sysv-generator(8)

Now that Jenkins is running, we will adjust the firewall rules so that we can reach Jenkins from a web browser to complete the initial setup.

Fourth, set up Jenkins

Please note that the firewall has been turned off, we will use the server domain name or IP address to access Jenkins's default port 8080:

http://ip_address_or_domain_name:8080

We should see the "Unlock Jenkins" screen showing the location of the initial password

In the terminal window, we will use the cat command to display the password:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

We will copy the 32-character alphanumeric password from the terminal and paste it into the "Administrator Password" field, then click "Continue". The next screen provides options to install suggested plug-ins or select specific plug-ins.

We will click on the "Install suggested plugins" option, which will start the installation process immediately:

After the installation is complete, you will be prompted to set up the first administrative user. You can skip this step and continue with the initial password used above as the admin, but we will take a moment to create the user.

**Note: **The default Jenkins server is not encrypted, so the data submitted using this form is not protected. When you are ready to use this installation, follow the guide How to configure SSL to Jenkins using Nginx reverse proxy. This will protect user credentials and information about the build sent through the web interface.

Create an admin user, define your own password

Confirm instance configuration

Once the first admin user is in place, you should see a "Jenkins ready!" confirmation screen.

Click "Start using Jenkins" to access the main Jenkins dashboard:

View

root@ubuntu:~# sudo netstat -plntu
Activate Internet connection(Server only)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        000.0.0.0:220.0.0.0:*               LISTEN      1020/sshd       
tcp6       00:::22:::*                    LISTEN      1020/sshd       
tcp6       00:::8080:::*                    LISTEN      8944/java       
udp        000.0.0.0:680.0.0.0:*928/dhclient    
udp6       00:::33848:::*8944/java       
udp6       00:::5353:::*8944/java

At this point, Jenkins has been successfully installed.

note:

The default port is 8080, sometimes it needs to be modified as follows due to port occupation:

1 , Check the /etc/init.d/jenkins script, modify the check_tcp_port command of the do_start function, and change the port number from 8080 to 8082:

2 , Modify /etc/default/jenkins file, change port 8080 to 8082

HTTP_PORT=8082

3 , Restart Jenkins

sudo systemctl restart jenkins

in conclusion

In this tutorial, we installed Jenkins using the package provided by the project, started the server, and created an administrative user. At this point, you can start exploring Jenkins.

After completing the exploration, if you decide to continue using Jenkins, please follow the guide, [How to use Nginx reverse proxy to configure Jenkins with SSL,] (http://www.howtoing.com/how-to-configure-jenkins-with-ssl-using-an-nginx-reverse-proxy/) to protect the password and any sensitive system or product information that will be sent on your machine and Plain text between servers.

Reference link for this article:

https://www.jianshu.com/p/845f267aec52

Recommended Posts

ubuntu install Jenkins
ubuntu18.04 install python2
ubuntu18.04 install docker
ubuntu12.04 install python3
ubuntu install nodejs
How to install Jenkins on Ubuntu 16.04
ubuntu 16 install asp.net
ubuntu install leanote
How to install Jenkins on Ubuntu 20.04
How to install Jenkins on Ubuntu 18.04
docker install ubuntu
ubuntu install elasticsearch
ubuntu16.0.1 install pagoda
ubuntu18.04 install python
ubuntu 18.04 install teamviewer
ubuntu install sendmail
Install apache+PHP under Ubuntu
install vscode on ubuntu18
Install node.js under Ubuntu
Install mysql-pytho in Ubuntu
ubuntu install zsh terminal
Install Redis on Ubuntu
Install R4 on ubuntu20
Install postgresql-10 on Ubuntu 18.04
Install python3.6 under Ubuntu 16.04
Install docker on Ubuntu
Ubuntu18.04 install opencv 3.2.0 solution
Install mysql under Ubuntu 16.04
Install Thrift under ubuntu 14.10
Install OpenJDK10 under Ubuntu
Install Caffe under Ubuntu 14.04
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
ubuntu install harbor warehouse
Install mysql on Ubuntu 14.04
Ubuntu16.04 install Mongodb tutorial
Install Django on ubuntu
2018-09-11 Install arduino under Ubuntu
Install Python3 on Ubuntu 14.04
Ubuntu18.04 install Asterisk16.10 + FreePBX15.0
Ubuntu19 install MySQL pit
Install JDK10+ on Ubuntu
pcduino ubuntu install os
Install Jenkins under Centos 7
Install python in Ubuntu
Install JDK in Ubuntu19.10
Install Python3 on Ubuntu 16.04
Install ROS under ROS Ubuntu 18.04[2]
Install Jenkins on centos7
Install MySQL under Ubuntu
Install KDE on Ubuntu16.04.2
ubuntu install nginx server
Install Yarm-PM2 under Ubuntu
Install Docker on Ubuntu18
Install Python3.7 on Ubuntu
Install flashplayer on Ubuntu
ubuntu: install camera driver
ubuntu14.04 install jdk1.8 tutorial
Docker practice (1): install Docker on Ubuntu 16.04
Install VMware Tools in Ubuntu 18.04
ubuntu16.04 install caffe cpu version