Set up gitlab server


About gitlab

GitLabIt’s usingRuby On RailsAn open source version management system to realize a self managed git project warehouse, which can access public or private projects through web interface. It has similar functions to GitHub, which can browse source code, manage defects and comments. You can manage team access to the repository, which is very easy to browse submitted versions and provide a file history library. Team members can use the built-in simple chat program (wall) to communicate. It also provides a code snippet collection function, which can easily realize code reuse and facilitate future search when necessary.

GitHub is an open source community. If you want to put your company's projects on it, you have to pay for it. If you don't pay for it, you have to open source. Gitlab is a local project management warehouse. Since it's local, you can play as you like


  • Community Edition based onMIT LicenseOpen source is free
  • No user, collaboration and warehouse restrictions
  • Protect the source code security of the project
  • Manage warehouses, users and access rights


  • Official website:
  • Domestic image:


1) . install and configure necessary dependencies

If you installPostFixSend email. If you don’t need to send email, you can skip the second step, please selectSite settingsMedium. Instead of using suffixes, you can also use props or configuration customizationSMTPServer and it is configured asSMTPThe server. stayCentOSThe following command will be turned on at the system firewallHTTPandSSHvisit.

sudo apt-get install curl openssh-server ca-certificates postfix  

2) . switch the image of Tsinghua University

Trust firstGitLabOfGPGPublic key

curl 2> /dev/null | sudo apt-key add - &>/dev/null  

Choose yourDebian/UbuntuVersion, text box contents written in/etc/apt/sources.list.d/gitlab-ce.list ubuntu14.04Please skip to the domestic image for other versions as follows/etc/apt/sources.list.d/gitlab-ce.listThis file does not exist by default. You need to create and add the following configurationvim /etc/apt/sources.list.d/gitlab-ce.listAdd the following

deb trusty main  

Update source after adding and install gitlab

sudo apt-get update  
sudo apt-get install gitlab-ce  

3) . configuration

  • Profile:/etc/gitlab/gitlab.rb
  • Modify domain name: VIM/etc/gitlab/gitlab.rbfile
//Find this line and fill in your domain name
external_ URL 'your domain name'
  • Configure notification mailbox: VIM/etc/gitlab/gitlab.rbfile
#Sending application email via SMTP
gitlab_rails['smtp_enable'] = true  
gitlab_rails['smtp_address'] = ""  
gitlab_rails['smtp_port'] = 25  
gitlab_rails['smtp_user_name'] = "[email protected]"  
gitlab_rails['smtp_password'] = "xxpassword"  
gitlab_rails['smtp_domain'] = ""  
gitlab_rails['smtp_authentication'] = :login  
gitlab_rails['smtp_enable_starttls_auto'] = true

##Modify the sender of gitlab configuration
gitlab_rails['gitlab_email_from'] = "[email protected]"  
user["git_user_email"] = "[email protected]"

If the execution is unsuccessful, check the configuration and memory, and executegitlab-ctl reconfigureRecompile start

4) . page configuration

apt-getInstallation inherited by defaultNginxIf you need servers running in other environments, you need to modify yourGitLab NginxThe basic configuration can be modified directly on the website without changing the configuration file

Set up gitlab server

usegitlab-ctl helpsee more commands


  • Document address :
  • Reprint please indicate the source :
  • Friendship links :