Home >Development Tools >git >Set up gitlab server on centos7

Set up gitlab server on centos7

WBOY
WBOYOriginal
2023-05-17 13:29:38949browse

In today's technology field, code management and version control are becoming more and more important. In order to organize and manage code, more and more development teams are beginning to use GitLab for code management. GitLab is a popular Git-based open source code management platform that provides a variety of functions, such as version control, issue tracking, CI/CD, etc.

In this article, we will discuss how to set up GitLab server in CentOS 7. Below are detailed steps and instructions.

Step One: Install the Necessary Dependencies

Before you begin, you need to first install some necessary packages and dependencies to properly install and configure GitLab on CentOS 7. Install them using the following command:

sudo yum update
sudo yum install curl policycoreutils openssh-server openssh-clients 
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo systemctl reload firewalld   

Once these packages are successfully installed, you can proceed to the next step.

Step 2: Install GitLab

The preferred way to install GitLab is to install it from the official source. Let us list the following steps:

  1. Add GitLab official rpm package source
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
  1. Install GitLab

    sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee

The above command will install GitLab EE version, you can choose to install CE (free community version).

  1. Start GitLab service

    sudo gitlab-ctl reconfigure

When executing this command, GitLab will be installed locally and configure the complete GitLab ecosystem.

  1. Verify installation

    sudo gitlab-ctl status

If everything is fine, you should see all installed services running.

Step 3: Configure GitLab

Now that GitLab has been correctly installed and configured in the system, we need to make some necessary configurations to ensure the normal operation of the site. It includes:

  1. Modify GitLab’s configuration file

Run the following command to open the configuration file for editing:

sudo vi /etc/gitlab/gitlab.rb

Add the following content:

external_url 'http://git.yourdomain.com'   #GitLab服务器的域名或IP地址

If you are using HTTPS, you can specify an HTTPS URL to enhance the security of the administrator interface.

  1. Reconfigure GitLab

Once you have made the changes above, reconfigure GitLab:

sudo gitlab-ctl reconfigure

This command will read the changes you made to the server Any changes and apply them to GitLab.

Now, you have successfully configured GitLab.

Step 4: Log in to GitLab

Open a browser of your choice and enter the URL you specified in GitLab. You will see the GitLab login window. Here you need to log in using the default administrator username and password. The administrator username is root, and the default administrator password can be generated during system installation.

Once you log in successfully, you will have access to the GitLab interface, including dashboard, project list, member management, etc.

Summary

In this article, we covered the basic steps to set up a GitLab server in CentOS 7. We understand that installing and configuring GitLab requires multiple tasks, but if you follow the steps above, you can complete the entire process with ease. Once you successfully set up GitLab, using it within your development team can make your version control and code management more efficient.

The above is the detailed content of Set up gitlab server on centos7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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