GitLab Server tutorial in Ubuntu 16.04, 16.04 gitlab

Source: Internet
Author: User

GitLab Server tutorial in Ubuntu 16.04, 16.04 gitlab

I. Members of the "git" Family

First, I solve a problem that is easy to confuse, and I often confuse it:

Git is a version control system, a command, and a tool.

Gitlib is a development library used to implement git functions.

Github is an online code hosting repository based on git. It contains a website interface that is open to the Internet.

Gitlab is an online code repository hosting software based on git. You can use gitlab to build a system similar to github. It is generally used to build git private servers on internal networks such as enterprises and schools.

Ii. GitLab installation requirements

Hardware requirements

Storage

The size of the bucket depends on the size of the Git repository you will store. However, according to the rule of thumb (rule of thumb), you should consider leaving more space to store the backup of the Git repository.

If you want to use elastic storage space, you can consider using the LVM architecture when allocating partitions. In this way, you can add hard disks to increase storage space as needed.

In addition, you can also attach a volume that supports NFS, such as NAS, SAN, AWS, and EBS.

If your server has enough memory and CPU processing performance, GitLab's response speed is mainly limited by the hard disk seek time. Using a faster hard drive (7200 RPM) or an SSD hard drive will greatly improve GitLab's response speed.

CPU

· 1 The core CPU supports a maximum of 100 users, and all the workers and background tasks work in the same core, resulting in a slow response to the GitLab service.

· 2 core support of 500 users, which is also the lowest standard officially recommended.

· 4 Core Support 2,000 users.

· 8 core support for 5,000 users.

· 16 core supports 10,000 users.

· 32 cores support 20,000 users.

· 64 cores support 40,000 users.

Memory

GitLab installation requires at least 4 GB of available memory (RAM + Swap )! Because the operating system and other running applications also use memory, you must note that the current server has at least 4 GB of available memory before installing GitLab. if the memory size is less than 4 GB, various strange problems may occur during reconfigure, and 500 errors may often occur during use.

· 1 GB physical memory + 3 GB swap partition is the lowest requirement, but we strongly oppose this configuration.

· 2 GB physical memory + 2 GB swap partition supports 100 users, but the service response will be slow.

· The 4 GB physical memory supports 100 users, which is also officially recommended.

· 8 GB physical memory supports 1,000 users.

· The 16 GB physical memory supports 2,000 users.

· 32 GB physical memory supports 4,000 users.

· 64 GB physical memory supports 8,000 users.

· 16,000 GB physical memory supports users.

· 32,000 GB physical memory supports users.

Even if your server has enough RAM, allocate at least 2 GB swap partition to the server. Because swap partitions can reduce the chance of GitLab errors when your available memory fluctuates.

Note: when viewing the process (top or htop), the 25 workers of Sidekiq will find that each worker is displayed separately, but they are allocated with shared memory, this is because Sidekiq is a multi-threaded program.

Iii. Operating GitLab server on Ubuntu 16.04

Introduction: Building GitLab servers in Ubuntu 16.04 operating systems (reference: https://about.gitlab.com/downloads/#ubuntu1604)

1. Install the dependency package and run the command

Non-root User: sudo apt-get install curl openssh-server ca-certificates postfix

After the email configuration is completed, select the Internet option (without the Smarthost option)

Details

Curl: an open source file transmission tool that uses the URL syntax in the command line mode.

Openssh-server: provides open-source encryption and communication software.

Ca-certificates: Currently, many websites and services Use HTTPS for link encryption to prevent information theft and tampering on intermediate transmission nodes. To enable HTTPS, a CA certificate is required to ensure that the encryption process is trusted.

Postfix: email server

2. Using the image of Tsinghua University (https://mirror.tuna.tsinghua.edu.cn/help/gitlab-ce/) to install the main program.

First, trust GitLab's GPG public key:

Curl https://packages.gitlab.com/gpg.key 2>/dev/null | sudo apt-key add-&>/dev/null

(If an access timeout error occurs during the download process, use the curl-sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash and directly jump into gitlab-ce for installation)

Then, the root user creates and opens the file/etc/apt/sources. list. d/gitlab-ce.list using vi and adds:

Deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu xenial main

Finally, install gitlab-ce:

Sudo apt-get update

Sudo apt-get install gitlab-ce

3. Execute the configuration and start gitlab Server

Sudo gitlab-ctl reconfigure

4. To make the GitLab community edition Web interface accessible through the network, we need to allow port 80 through the firewall, which is the default port of GitLab community edition. To do this, run the following command (this operation can be omitted)

Sudo iptables-a input-p tcp-m tcp -- dport 80-j ACCEPT

5. Check whether GitLab has been installed and started correctly. Enter the following command:

Sudo gitlab-ctl status

GitLab runs normally if the following startup results are obtained:

Run: gitlab-workhorse: (pid 1148) 884 s; run: log: (pid 1132) 884 s

Run: logrotate: (pid 1150) 884 s; run: log: (pid 1131) 884 s

Run: nginx: (pid 1144) 884 s; run: log: (pid 1129) 884 s

Run: postgresql: (pid 1147) 884 s; run: log: (pid 1130) 884 s

Run: redis: (pid 1146) 884 s; run: log: (pid 1133) 884 s

Run: sidekiq: (pid 1145) 884 s; run: log: (pid 1128) 884 s

Run: unicorn: (pid 1149) 885 s; run: log: (pid 1134) 885 s

6. Enter https: // 127.0.0.1 in the address bar of the browser to access the GitLab Web page.

Note: When logging on to the web page for the first time, you must set a password for the root user.

7. Some gtilab commands

Sudo gitlab-ctl stop

Enable sudo gitlab-ctl start

Sudo gitlab-ctl restart

View the status of sudo gitlab-ctl status

Sudo gitlab-ctl reconfigure confirm the configuration (it must be executed after the configuration is modified)

Sudo gitlab-ctl tail view logs

8. Uninstall gitlab

Perform the following four steps:

Sudo gitlab-ctl uninstall

Sudo dpkg-r gitlab-ce

Sudo rpm-e gitlab-ce

Reboot (restart)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.