[02] On the front-end engineering GitLab locally deployed

Outline

This article first to warm it, we set up a GitLab environment in its own virtual machine, and then himself be hard toss. Specific steps are as follows structures.

 

System Environment

System: CentOS 8.1

Memory: 4G start

HDD: 50G (only for the test environment)

IP:192.168.0.104

 

Specific steps

A, CentOS 8.1 installation

1, to CentOS official website (https://www.centos.org/) download the latest version of the installation image, as shown below:

2, using VirtualBox virtual machine installation of CentOS 8.1. First select the new virtual machine in VirtualBox, and then enter the information related to the virtual machine from the pop-up panel, including the name of the virtual machine, storage directory, type of virtual machine, the virtual machine memory, hard disk size, click OK to complete the set after initially created a virtual machine, as follows:

3, after the initialization of the virtual machine is not associated with a mirror, so we are going to associate mirror. Click [Setup] menu, then select [Storage] tab, open the Storage Settings Panel, as follows:

In this panel controller option "No disc" words, and then click on the map to be selected and the associated image file, as I follow:

To complete the related operations after the image file and click OK.

4, the panel disposed in the same system] [tab selected, and then starts to drive the first start, as shown below:

5. Click [START] menu button to install virtual machines, as follows:

6. Click the Start button, virtual machine CentOS 8.1 installation process and the fact that we ordinary CentOS system is installed there is no difference, we just need to install some of the information we need for simple configuration, for example, I configured the installed Desktop options, as shown below (this process if there are some parameters do not understand, can directly online to find information, the data is very large, do not need to repeat the description here):

If you click on the restart and then re-entered into the installation interface, we only need to click on the top of the [control] menu, and then open the Settings panel, under the Storage tab will be added to our previous CentOS mirror disk to uninstall, because this time the system has been installed, it is not necessary to the existence of the. After uninstall restart the virtual machine can be normal access to the system, as follows:

7, as shown above, CentOS 8.1 system is successfully installed.

Two, GitLab deployment

Through the above operation we have completed the installation of CentOS 8.1 virtual machine, then began to deploy GitLab. Use tools such as XShell connection installed CentOS 8.1 virtual machine, if it is found in the connection process is 10.0.2.15 IP virtual machine or virtual machine they not IP information, which we need to configure the network card information and start a virtual machine, specific steps please refer to the information network.

After the virtual machine network is normal, we are going to be GitLab configuration.

1, GitLab installation documentation can be directly deployed in fact Tell me what network, which describe very clearly at the following address:

https://about.gitlab.com/install/#centos-8

2. First, we use the following command to open the firewall HTTP, HTTPS, SSH channels, as follows:

sudo dnf install -y curl policycoreutils openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
# Check if opening the firewall is needed with: sudo systemctl status firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld

3, then the following command to install Postfix message feature is achieved, as follows:

sudo dnf install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

4, followed gitlab installed and configured, as follows:

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://localhost" dnf install -y gitlab-ee

5, the installation is complete, using the following command to install Vim editor:

yum install vim -y

6, use the following command to configure IP and port access gitlab:

vim /etc/gitlab/gitlab.rb

We will be installed into the virtual machine specified localhost IP, port further specify a port, as shown in FIG. After the amendment is successful, use the following commands to validate the configuration, and restart gitlab:

gitlab-ctl reconfigure
gitlab-ctl restart

7, open port 8088 with the following command:

firewall-cmd --zone=public --list-ports #查看开放端口
firewall-cmd --zone=public --add-port=8088/tcp --permanent #开放8088端口
firewall-cmd --reload   #重新加载配置
#如果不需要,也可以直接关闭防火墙
systemctl stop firewalld.service

8, through the browser address " http://192.168.0.104:8088/ " address to access gitlab, first access will be redirected to the password change interface, the initial account is:

初始账户: root 密码:5iveL!fe

After logging in to change the password, the page will automatically log in to the interface, we log in with the new password to enter into GitLab deployment, as follows:

9, use the following command into the virtual machine network card settings directory, set the virtual machine a static IP, as follows:

cd /etc/sysconfig/network-scripts/
vi ifcfg-enp0s3

Then make the following changes in the file:

TYPE="Ethernet"
PROXY_METHOD="none"
BROWSER_ONLY="no"

#动态ip
#BOOTPROTO="dhcp"

#静态IP
BOOTPROTO=static
IPADDR=192.168.0.104 ## 你想要的静态ip
NETMASK=255.255.255.0 #子网掩码为物理机子网掩码(subnet mask) 
GATEWAY=192.168.0.1 #跟物理机网关相同

DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp0s3"
UUID="0dd666ac-c97e-4b6a-898e-0765ba16246d"
DEVICE="enp0s3"
ONBOOT="yes"

Save and exit, use the following commands to restart the card:

nmcli c reload

At this point, the virtual machine static IP settings successful.

10, using the following command mailbox configuration:

vim /etc/gitlab/gitlab.rb

Then add the following information in the configuration file:

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "ddddddddddwwwww"
gitlab_rails['smtp_domain'] = "smtp.qq.com"
gitlab_rails['smtp_authentication'] = :login
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['gitlab_email_from'] = '[email protected]'

#修改gitlab配置的发信人
gitlab_rails['gitlab_email_from'] = "[email protected]"
user["git_user_email"] = "[email protected]"  # 必须是一个具体的邮箱。不能瞎编

After saving the configuration, use the following commands to configure and gitlab restart to take effect:

gitlab-ctl reconfigure
gitlab-ctl restart

After a successful restart, use the following command to open 465 port of the virtual machine, the following:

firewall-cmd --zone=public --list-ports #查看开放端口
firewall-cmd --zone=public --add-port=465/tcp --permanent #开放465端口
firewall-cmd --reload   #重新加载配置
#如果不需要,也可以直接关闭防火墙
systemctl stop firewalld.service

Then use the following commands to configure a test mailbox:

gitlab-rails console
Notify.test_email('[email protected]','X北辰北','测试邮件').deliver_now

If the following error message appears, because we do not open SMTP mail service result in:

We opened QQ mailbox settings interface, and then switch to the [account] tab, select the bottom of the page to open the corresponding service, we will open a period of authorization code, authorization code and then we will stick to gitlab configuration file, re-make the entry into force and start gitlab, as follows:

Use command to open gitlab configuration file, replace the configuration file in e-mail password authorization code generated:

Then the same, use the following command to validate the configuration and restart gitlab:

gitlab-ctl reconfigure
gitlab-ctl restart

Gitlab after the restart, we use the above test command to test again, if the message is sent successfully, it indicates that the mailbox is successfully configured, as follows:

11, open the "C: \ Users \ username \ .ssh" directory, copy the file id_rsa.pub inside information pasted into gitlab, to complete the ssh configuration gitlab, and then we are going to be tested.

12, we gitlab create a new project, and then git clone it locally, as follows:

Then modify the inside of their new README file or a html page, use git to submit it, if successfully submitted, then we gitlab so far completed a basic configuration, the following:

At this point our GitLab successful installation and deployment environment.

 

to sum up

This article, while successful deployment GitLab, we also configured the mail, when we submit code, mailbox will receive appropriate message.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Published 147 original articles · won praise 258 · views 310 000 +

Guess you like

Origin blog.csdn.net/qq_35117024/article/details/105373650