gitlab+jenkins installation

This installation configuration takes centos7 as an example. Try to have as much memory as possible and as many cores as possible. At least 4g of memory and at least 4 cores will run very slowly.

Gitlab Community Edition installation package address: gitlab/gitlab-ce – Packages · packages.gitlab.com

gitlab installation

192.168.100.12 Server IP installed by gitlab

downloadanzhuangb

When installing, it is recommended to use wget directly instead of using yum source, which will occupy certain resources.

Find the corresponding version and install it. I am centos7, so I choose the el7 version.

Use wget to download directly from the server. If you don’t have the wget command, just install it.

[root@localhost ~]# yum -y install wget
[root@localhost ~]# wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-16.2.8-ce.0.el7.x86_64 .rpm/download.rpm
#Install gitlab-ce
[root@localhost ~]# yum -y localinstall gitlab-ce-16.2.8-ce.0.el7.x86_64.rpm

Modify gitlab configuration file

[root@localhost ~]# vim /etc/gitlab/gitlab.rb
#Use the vim search function to find the content of the following comment lines and modify them. Remember to remove the comment symbols.
#external_url 'http://your ip address or domain name'
#Add these two lines
user['username'] = "git"
user['group'] = "git"

#Load the gitlab configuration file and restart the gitlab service to make the changes take effect
[root@test100 tmp]# gitlab-ctl reconfigure

The directory of password is the temporary password of gitlab

Start gitlab

Let’s start the gitlab service first

[root@localhost ~]# gitlab-ctl start

gitlab start, stop, restart
#gitlab-ctl start
#gitlab-ctl status
#gitlab-ctl stop
#gitlab-ctl restart

After starting the service, let’s visit

The account is root

The password is the password in the password file above. Just copy it over.

Modify to Chinese page

After entering, the page was in English, which was not very friendly to an English-speaking person like me, so I chose to change it to Chinese.

First step

Step 2 (don’t forget to click save to save)

Reset root password

The most important thing is of course to change the root password. As I just said, the password will be reset in 24 hours.

After saving, you will jump to the login page.

If used internally within the company, the registration mechanism can be turned off to improve security.

I won’t impose any restrictions now

The rest is just a click of the mouse, so I won’t explain too much. You can do some research on your own and check out the official website documentation.

jenkins installation

192.168.100.11 Server IP installed by jenkins

jenkins domestic Tsinghua source address: https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/

You need to install jdk first, because jenkins is a java project

My version of Jenkins does not support jdk1.8, so I need to download a higher version. I directly used yum to install version 11, eliminating the need for configuration.

[root@localhost ~]# wget --no-check-certificate https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-2.361.3-1.1.noarch.rpm
[root@localhost ~]# yum -y install java-11-openjdk
[root@localhost ~]# yum -y localinstall jenkins-2.361.3-1.1.noarch.rpm

Start the jenkins service

The service starts slowly. If it cannot start for a long time, please restart the machine and start the service again.

[root@localhost ~]# systemctl start jenkins
[root@localhost ~]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
   Active: active (running) since Thursday 2023-10-19 08:48:04 CST; 12h ago

[root@localhost ~]# netstat -nplt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 8941/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 9190/master
tcp6 0 0 :::8080 :::* LISTEN 52115/java
tcp6 0 0 :::22 :::* LISTEN 8941/sshd
tcp6 0 0 ::1:25 :::* LISTEN 9190/master

If necessary, you can modify the jenkins http port. Please view the configuration file for details.

[root@localhost ~]# vim /etc/sysconfig/jenkins

JENKINS_PORT="8080"

Access jenkins and initialize jenkins

At the beginning, it is recommended to install the recommended plug-ins directly.

Wait for the plug-in installation to complete

Both gitlab and jenkins have been installed

The knowledge points of the article match the official knowledge archives, and you can further learn relevant knowledge. Cloud native entry-level skills treeContinuous integration and deployment (Jenkins)Use helm to install Jenkins16752 people are learning the system