GitLab is a web application based on the Git version control system, designed to manage code libraries, code review, release and collaboration, etc. It is an open source project management platform that is very suitable for team collaboration. This article will introduce how to set up GitLab on a Linux system, how to perform Chinese culture, and use the email notification function.
Environment preparation
1. Operating system: CentOS 7 or Ubuntu 16.04
2. Database: PostgreSQL or MySQL
3. Mail service: can be used Mail services such as Postfix or Exim
4. Domain name: It is recommended to use a second-level domain name, such as gitlab.example.com
Install GitLab
1. Install the necessary software packages
Use the following command to install the necessary packages:
sudo yum install curl policycoreutils openssh-server openssh-clients postfix
2. Add GitLab’s GPG Key
Use the following command to add GitLab’s GPG Key to the system:
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add -
3. Add GitLab source
Use the following command to add GitLab source:
sudo curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
4.Install GitLab
Use the following command to install GitLab:
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
Note: EXTERNAL_URL needs to be changed to your second-level domain name.
5. Start the GitLab service
After the installation is complete, use the following command to start the GitLab service:
sudo gitlab-ctl reconfigure
中文字幕网址
After the installation of GitLab is complete , the default language is English. In order to better adapt to the use of Chinese, we need to Chinese-culture GitLab.
1. Modify the configuration file
Add the following configuration in the GitLab configuration file:
sudo vim /etc/gitlab/gitlab.rb
Add the following code at the end of the file:
## Chinese Language gitlab_rails['translations'] = { 'zh-CN' => 'Simplified Chinese' } gitlab_rails['gitlab_default_theme'] = 2 gitlab_workhorse['auth_backend'] = "http://127.0.0.1:8080"
2 .Effective configuration file
After adding the configuration, use the following command to make the configuration file take effect:
sudo gitlab-ctl reconfigure
3.Restart the service
Use the following command to restart the service:
sudo gitlab-ctl restart
Email notification configuration
GitLab supports the email notification function. GitLab's email notification function can be implemented by configuring the email service.
1.Install the mail service
Use the following command to install the Postfix mail service:
sudo yum install postfix
2.Configure the mail service
After installing the mail service , use the following command to configure:
sudo vim /etc/postfix/main.cf
Add the following configuration in the configuration file:
relayhost = [smtp.example.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt smtp_use_tls = yes
The relayhost needs to be filled in according to the actual situation.
3. Add authentication information
Add authentication information in the /etc/postfix/sasl_passwd file:
[smtp.example.com]:587 your_username:your_password
[smtp.example.com]:587 needs to be based on actual conditions Fill in the situation.
4. Reload the configuration
Use the following command to reload the configuration:
sudo postmap /etc/postfix/sasl_passwd sudo systemctl reload postfix
5. Modify the GitLab configuration
Add in the GitLab configuration file The following configuration:
gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.example.com" gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_user_name'] = "your_username" gitlab_rails['smtp_password'] = "your_password" gitlab_rails['smtp_domain'] = "example.com" gitlab_rails['smtp_authentication'] = :login gitlab_rails['smtp_enable_starttls_auto'] = true
Among them, smtp_address, smtp_user_name, smtp_password, and smtp_domain need to be filled in according to the actual situation.
6. Restart the GitLab service
Use the following command to restart the GitLab service:
sudo gitlab-ctl restart
At this point, the configuration of GitLab's email notification function is completed.
Summary
This article introduces how to build GitLab on a Linux system and configure its in-progress culture and email notification functions. Because GitLab provides a wealth of functions and extensions, it has become an open source project management platform that is very suitable for team collaboration. I hope this article can be helpful to everyone.
The above is the detailed content of How to set up GitLab on Linux system. For more information, please follow other related articles on the PHP Chinese website!