Home Development Tools git How to set up GitLab on Linux system

How to set up GitLab on Linux system

Apr 06, 2023 pm 12:44 PM

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
Copy after login

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 -
Copy after login

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
Copy after login

4.Install GitLab

Use the following command to install GitLab:

sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
Copy after login

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
Copy after login
Copy after login

中文字幕网址

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
Copy after login

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"
Copy after login

2 .Effective configuration file

After adding the configuration, use the following command to make the configuration file take effect:

sudo gitlab-ctl reconfigure
Copy after login
Copy after login

3.Restart the service

Use the following command to restart the service:

sudo gitlab-ctl restart
Copy after login
Copy after login

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
Copy after login

2.Configure the mail service

After installing the mail service , use the following command to configure:

sudo vim /etc/postfix/main.cf
Copy after login

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
Copy after login

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
Copy after login

[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
Copy after login

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
Copy after login

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
Copy after login
Copy after login

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!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
How to download git projects to local How to download git projects to local Apr 17, 2025 pm 04:36 PM

To download projects locally via Git, follow these steps: Install Git. Navigate to the project directory. cloning the remote repository using the following command: git clone https://github.com/username/repository-name.git

How to update code in git How to update code in git Apr 17, 2025 pm 04:45 PM

Steps to update git code: Check out code: git clone https://github.com/username/repo.git Get the latest changes: git fetch merge changes: git merge origin/master push changes (optional): git push origin master

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

How to generate ssh keys in git How to generate ssh keys in git Apr 17, 2025 pm 01:36 PM

In order to securely connect to a remote Git server, an SSH key containing both public and private keys needs to be generated. The steps to generate an SSH key are as follows: Open the terminal and enter the command ssh-keygen -t rsa -b 4096. Select the key saving location. Enter a password phrase to protect the private key. Copy the public key to the remote server. Save the private key properly because it is the credentials for accessing the account.

Git vs. GitHub: Version Control and Code Hosting Git vs. GitHub: Version Control and Code Hosting Apr 11, 2025 am 11:33 AM

Git is a version control system, and GitHub is a Git-based code hosting platform. Git is used to manage code versions and supports local operations; GitHub provides online collaboration tools such as Issue tracking and PullRequest.

How to return after git submission How to return after git submission Apr 17, 2025 pm 01:06 PM

To fall back a Git commit, you can use the git reset --hard HEAD~N command, where N represents the number of commits to fallback. The detailed steps include: Determine the number of commits to be rolled back. Use the --hard option to force a fallback. Execute the command to fall back to the specified commit.

How to use git commit How to use git commit Apr 17, 2025 pm 03:57 PM

Git Commit is a command that records file changes to a Git repository to save a snapshot of the current state of the project. How to use it is as follows: Add changes to the temporary storage area Write a concise and informative submission message to save and exit the submission message to complete the submission optionally: Add a signature for the submission Use git log to view the submission content

How to merge code in git How to merge code in git Apr 17, 2025 pm 04:39 PM

Git code merge process: Pull the latest changes to avoid conflicts. Switch to the branch you want to merge. Initiate a merge, specifying the branch to merge. Resolve merge conflicts (if any). Staging and commit merge, providing commit message.

See all articles