GitLab is a web-based Git warehouse management tool that integrates Git warehouse, code management, issue tracking, CI/CD, Wiki, construction and testing functions on one platform. It supports the management of multiple projects, has powerful branching and merging functions, and also provides a complete API interface for integration with other tools or projects. In this article, we will introduce how to install GitLab on CentOS using a one-click script.
1. Preparation before installation
Before you start installing GitLab, you need to install some necessary software packages and set the correct time zone. Enter the following command:
yum -y install curl policycoreutils openssh-server openssh-clients systemctl enable sshd systemctl start sshd firewall-cmd --permanent --add-service=http --add-service=https systemctl reload firewalld yum -y install postfix systemctl enable postfix systemctl start postfix timedatectl set-timezone Asia/Shanghai
2. Install GitLab
We can install GitLab through the following script:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee
The above command will download the installation package from the GitLab official website, The installation package will be automatically added to the system's software sources. The EXTERNAL_URL
variable here specifies the access URL address of GitLab. This variable needs to be set according to the actual situation.
After the installation is completed, GitLab will automatically start and listen on the ports of the HTTP and HTTPS protocols. We can check the status of GitLab through the following command:
sudo gitlab-ctl status
If the status is normal, then GitLab can be accessed by accessing a specified URL address (such as http://gitlab.example.com).
3. Frequently Asked Questions
By default, GitLab will listen on the ports of the HTTP and HTTPS protocols, which are 80 and 443 respectively. If we need to modify the listening port, we can modify it in the /etc/gitlab/gitlab.rb
file. For example, change the HTTP port number to 8080:
external_url "http://gitlab.example.com:8080"
After the modification is completed, you need to execute the following command to make the configuration take effect:
sudo gitlab-ctl reconfigure
By default, GitLab’s data storage path is /var/opt/gitlab
. If we need to modify the data storage path, we can do so in /etc/gitlab /gitlab.rb
file. For example, change the data storage path to /opt/gitlab
:
git_data_dir "/opt/gitlab/git-data"
After the modification is completed, you need to execute the following command to make the configuration take effect:
sudo gitlab-ctl reconfigure
4. Summary
Through the introduction of this article, we can see that installing GitLab on CentOS is very simple and only requires one line of script and a few commands to complete. GitLab has powerful code management and project management functions that can help developers improve efficiency and reduce errors. At the same time, GitLab also provides a rich API interface and plug-in system, which can be integrated with other projects or tools to achieve a more efficient development process.
The above is the detailed content of How to install gitlab on centos with one click? Method introduction. For more information, please follow other related articles on the PHP Chinese website!