preface

The front end boss of the company left the company for some reasons. He left in a hurry. I had little contact with this aspect before, and I had only a half-knowledge of it. In these two days, WHILE learning, I began to build, while recording the whole process of building.

In this series of articles, from setting up Gitlab, to installing and registering Gitlab-Runner, to combining the two to deploy a simple project, you will learn how to automate the packaging and deployment of your projects on Gitlab.

There are four articles in the series, including:

  1. How to install Gitlab on Aliyun
  2. Install GITLAB – RUNNER
  3. LINUX login without password
  4. Deploy GITLAB’s projects using Gitlab-Runner

As I have been doing is the front end, I am not skilled for Linux, if there is a mistake, please point out.

原文 address: ali cloud installation Gitlab notes

Pre – work

  1. One Ali Cloud server (more than 2 cores with 4G)
  2. Configure the security group rules for the inbound direction of the server. I have configured port 8888 here (ali Cloud security group allows all access by default, so no configuration is required).

Step1: install and configure the necessary dependencies

Access the Gitlab installation address and select the installation mode of the corresponding system. Mine is CentOS 7.6, so select CentOS 7.x.

How to see what system you are:

lsb_release -a
Copy the code

On CentOS 7(and RedHat/Oracle/Science Linux 7), use the following command to enable HTTP and SSH access in the system firewall.

sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
Copy the code

When the sudo firewall-cmd –permanent –add-service= HTTP command is executed, an error message is displayed indicating that FirewallD is not running, indicating that the firewall is not running. Run the following command to enable the firewall:

systemctl start firewalld.service
Copy the code

Next, install the Postfix mail notification service. If you want to use another solution, skip this step and configure an external SMTP server after installing GitLab.

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
Copy the code

Job for postfix.service failed because the control process exited with error code. See “systemctl status postfix.service” and “journalctl -xe” for details. The solution is to modify the /etc/postfix/main.cf configuration, using:

vi /etc/postfix/main.cf
Copy the code

Go to edit ‘main.cf’ and press I to enter the modifications:

Inet_interfaces = all inet_protocols = ipv4 or allCopy the code

After the modification is complete, press Esc, :, W, q, and press Enter to save the modification and restart the service.

sudo systemctl restart postfix
Copy the code

Step2: add the GitLab package repository and install the package

Set the firewall:

# Enable port 8888
firewall-cmd --zone=public --add-port=8888/tcp --permanent
Restart the firewall
systemctl restart firewalld
Copy the code

Add a repository for GitLab packages

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
Copy the code

Next, install the Gitlab package:

sudo EXTERNAL_URL="https://gitlab.example.com" yum install -y gitlab-ee
Copy the code

https://gitlab.example.com change the URL for GitLab instance you want to visit. The installation automatically configures and starts GitLab for that URL.

I don’t have a domain name here, I just use IP + port number form:

sudo EXTERNAL_URL="xx.xx.xxx.xx:8888" yum install -y gitlab-ee
Copy the code

And then wait to install

If you want to change the domain name or IP address after the installation, you need to change external_url in /etc/gitlab/gitlab.rb in the same way as you changed /etc/postfix/main.cf.

Then reconfigure the service

gitlab-ctl reconfigure
Copy the code

Step3: login

After the above, installation and setup, you can access the domain name or IP.

To open xx.xx.xxx.xx:8888, you need to set the password of the root account, and then log in as the root account.

I forgot the screenshot here, so I’ll attach a screenshot set by the user

The attached:

Common Gitlab commands:

// Start sudo gitlab-ctl start // Stop sudo gitlab-ctl stop // Restart sudo gitlab-ctl restart // Check the status of sudo gitlab-ctl status // Make the configuration change take effect sudo gitlab- CTL reconfigureCopy the code

Reference:

Fast mirror Failed to set locale, defaulting to C解决