Gitlab installation and deployment


Introduction to gitlab

Gitlab: it is an online code warehouse hosting software based on GIT. You can use gitlab to build a system similar to GitHub, which is generally used to build git private servers in internal networks such as enterprises and schools.

Function: gitlab is a code management platform that provides code hosting, submission review and problem tracking. It is very important for software engineering quality management.

Version: gitlab is divided into community version (CE) and enterprise version (EE).

Gitlab’s service composition

Nginx: static web server.

The GIT and git – Lab commands are used to modify the list. (Ruby)

Gitlab workhorse: lightweight reverse proxy server. (go)

Logrotate: log file management tool.

PostgreSQL: database.

Redis: cache database.

Sidekiq: used to execute queue tasks in the background (asynchronous execution). (Ruby)

Unicorn: an HTTP server for rack applications. Gitlab rails applications are hosted on this server. (Ruby web server, mainly written in Ruby)

*Gitlab workhorse is an agile reverse agent. It handles some large HTTP requests, such as file upload, file download, GIT push / pull and git package download. Other requests will be reverse proxied to the gitlab rails application, that is, to the unicorn on the back end.


Install gitlab main program

[email protected]:~# apt update && apt upgrade
[email protected]:~# apt install -y curl openssh-server ca-certificates tzdata perl

[email protected]:~# apt install -y postfix
[email protected]:~# curl | sudo bash

[email protected]:~# apt install gitlab-ee


Modify profile

[email protected]:~# vim /etc/gitlab/gitlab.rb

external_url ''

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = ""
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "cby"
gitlab_rails['smtp_password'] = "Cby123.."
gitlab_rails['smtp_domain'] = ""
gitlab_rails['smtp_authentication'] = "plain"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_pool'] = false

[email protected]:~# gitlab-ctl reconfigure

[email protected]:~#  gitlab-ctl restart
ok: run: alertmanager: (pid 63590) 1s
ok: run: gitaly: (pid 63610) 1s
ok: run: gitlab-exporter: (pid 63641) 0s
ok: run: gitlab-workhorse: (pid 63643) 1s
ok: run: grafana: (pid 63659) 0s
ok: run: logrotate: (pid 63676) 1s
ok: run: nginx: (pid 63682) 0s
ok: run: node-exporter: (pid 63718) 1s
ok: run: postgres-exporter: (pid 63728) 0s
ok: run: postgresql: (pid 63737) 0s
ok: run: prometheus: (pid 63746) 1s
ok: run: puma: (pid 63777) 1s
ok: run: redis: (pid 63782) 0s
ok: run: redis-exporter: (pid 63788) 1s
ok: run: sidekiq: (pid 63887) 1s
[email protected]:~#


View root password

[email protected]:~# cat /etc/gitlab/initial_root_password
# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#          If the password shown here doesn't work, you must reset the admin password following

Password: HUd9b632LHN89WXYEVYPssWGpyJrgK7BJLbVLC4VCas=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.
[email protected]:~# 


Common commands

Gitlab CTL start # starts all gitlab components;
    Gitlab CTL stop # stops all gitlab components;
    Gitlab CTL restart # restart all gitlab components;
    Gitlab CTL status # view the service status;
    vim /etc/gitlab/gitlab. RB # modify gitlab configuration file;
    Gitlab CTL reconfigure # recompile gitlab configuration;
    Gitlab rake gitlab: check sanitize = true -- trace # check gitlab;
    Gitlab CTL tail # view log;
    gitlab-ctl tail nginx/gitlab_access.log
    Log address: / var / log / gitlab / # corresponds to the print log of each service 
    Service address: / var / opt / gitlab / # corresponds to the home directory of each service

Linux operation and maintenance Communication Community

Linux operation and maintenance exchange community, Internet news and technology exchange.

75 original content

official account……………………

Zhihu, CSDN, open source China, Sifu, Nuggets, BiliBili, Tencent cloud, Jianshu, today’s headlines