Based on CentOS 7 build GitLab

⒈ Update Package

1 yum update -y  

⒉ installation and start ssh service

yum install -y curl policycoreutils-python openssh-server
systemctl enable sshd
systemctl start sshd

⒊ configure the firewall

  Open  /etc/sysctl.conf  file, and finally add the following files and save

net.ipv4.ip_forward = 1

  Execute the following command

enable firewalld systemctl 
systemctl Start firewalld enable and start the firewall 

Firewall -cmd --permanent --add-Service = HTTP put through HTTP 
systemctl reload firewalld restart firewall

  In actual use, you can use the  systemctl status firewalld command to view the status of the firewall.

⒋ install postfix

  GitLab need to send mail using postfix. Of course, you can also use the SMTP server details, see  the official tutorial .

  1. Install postfix

yum install -y postfix

  2. Open  /etc/postfix/main.cf  file, find the line in the vicinity of 119  inet_protocols = all, will  all be changed ipv4 and save (on configuration examples of IPv4 write the results also being given written IPv4, into ipv4 normal)

inet_protocols = ipv4

  3. Enable and start postfix

systemctl enable postfix 
systemctl start postfix

⒌ configured swap swap

  Since GitLab consume more resources, we need to create a swap partition, so as to reduce the pressure of physical memory.
  In a production environment, if the server configuration is high enough, the configuration is not necessary swap.

  1. Create a new swap 2 GB size:

dd if=/dev/zero of=/root/swapfile bs=1M count=2048

  2. formatted as a swap file and enable:

mkswap /root/swapfile
swapon /root/swapfile

  3. Add the self-enabled. Open the  / etc / fstab  file, add the following to the end of the file and save it

/root/swapfile swap swap defaults 0 0

⒍ installation GitLab

  1. modify the software source for domestic source

  Due to the network environment, the repo source modified to Tsinghua University .

  In  /etc/yum.repos.d  the new directory  gitlab-ce.repo  file and save it. It reads as follows:
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1

  2. Refresh yum

  Yum just the modified source, to regenerate the cache:
(This step is performed for a long time, it normally takes about 3 to 5 minutes, please wait)

yum makecache

  3. Install GitLab

yum install -y gitlab-ce

⒎ initialization GitLab

  1. Open  /etc/gitlab/gitlab.rb  file, found near line 13  external_url 'http://gitlab.example.com', the single quotes changed their domain name (bring protocol header, no slash at the end), and press  Ctrl + S Save.

  E.g:

external_url 'http://www.coreqi.cn'

  2. especially important! Using the following command initializes GitLab: This step is performed for a long time, it normally takes about 5 to 10 minutes, please wait)

sudo gitlab-ctl reconfigure
 
  So far, we have successfully built GitLab on CentOS 7.
  • In actual production, it is recommended to use 2-core server 4 GB or more configurations. Click here to  view the configuration and number of people can carry GitLab official recommended correspondence table.

Guess you like

Origin www.cnblogs.com/fanqisoft/p/11289941.html