Rate This Document
Findability
Accuracy
Completeness
Readability

x86 Environment

You need to set up either the Jenkins or GitLab environment. Do not install both of them on the same server. The following describes how to install the GitLab environment. The operations are for reference only.

Procedure

  1. Download the GitLab installation package.
    wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-16.9.1-ce.0.el7.x86_64.rpm

    If the GitLab installation package cannot be downloaded by running this command, you can download it through the link and then upload it to the server for subsequent installation operations.

  2. Install GitLab.
    yum install -y git tar policycoreutils-python openssh-server 
    rpm -ivh gitlab-ce-16.9.1-ce.0.el7.x86_64.rpm

    If the installation is successful, the following information is displayed:

  3. Change the IP address and port.
    1. Open and edit the GitLab configuration file.
      vi /etc/gitlab/gitlab.rb
    2. Change the IP address and port for external access.
      external_url 'http://IP address:port'
      • IP address: IP address of the server where GitLab is installed
      • Port: port of the server where GitLab is installed

      Change the values to the actual IP address and port to be accessed.

      The port to be accessed cannot be occupied. If it is in use, specify another port that falls within the port range allowed by the firewall.

      1. Query the OS firewall status of the server.
        systemctl status firewalld

        If the firewall is enabled (active), perform 3.b.ii to 3.b.v to enable the port. If the firewall is disabled, skip the following operations in this step.

      2. Check whether the port is enabled. If "no" is displayed, the port is not enabled.
        firewall-cmd --query-port=port/tcp
      3. Permanently enable the port. If "success" is displayed, the port is enabled.
        firewall-cmd --add-port=port/tcp --permanent
      4. Reload the firewall configuration.
        firewall-cmd --reload
      5. Re-check whether the port is enabled. If "yes" is displayed, the port is enabled.
        firewall-cmd --query-port = port/tcp
  4. Reload the configuration.
    gitlab-ctl reconfigure

    The re-configuration may take a long time.

    Figure 1 Reconfiguring
  5. Configure GitLab to automatically start upon system startup.
    systemctl enable gitlab-runsvdir.service 
    systemctl start gitlab-runsvdir.service 

    To disable automatic GitLab startup, run the systemctl disable gitlab-runsvdir.service command.

  6. Start GitLab.
    gitlab-ctl restart

    If the startup is successful, the following information is displayed, as shown in Figure 2.

    Figure 2 Starting GitLab
  7. Access GitLab on the website.
    http://IP address:port/
    Figure 3 Accessing GitLab
  8. View the GitLab version.
    cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

    The version should be 16.9.1 if the package version is 16.9.1.

  9. Log in to GitLab. The default user name for logging in to GitLab is root. The password is stored in the configuration file /etc/gitlab/initial_root_password.

    View the password.

    cat /etc/gitlab/initial_root_password
    Figure 4 Viewing the password