弹性云服务器 ECS-手工部署GitLab(CentOS7.2):操作步骤

时间:2024-08-27 15:44:42

操作步骤

  1. 安装相关依赖包。

    1. 登录弹性云服务器。
    2. 为了更好的获取和更新系统和软件,建议您更新镜像源为华为云镜像源,详细操作,请参见如何使用自动化工具配置华为云镜像源(x86_64和ARM)?
    3. 执行以下命令,安装相关依赖包。

      sudo yum install -y curl policycoreutils-python openssh-server

    4. 依次执行以下命令,设置SSH开机自启动并启动SSH服务。

      sudo systemctl enable sshd

      sudo systemctl start sshd

  2. 安装Postfix来发送通知邮件。

    1. 依次执行以下命令,安装Postfix。

      sudo yum install postfix

    2. 依次执行以下命令,设置Postfix开机自启动并启动Postfix服务。

      sudo systemctl enable postfix

      sudo systemctl start postfix

  3. 添加GitLab软件包仓库并安装软件包。

    1. 执行以下命令,添加GitLab软件包仓库。

      curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

    2. 执行以下命令,安装GitLab。

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

      其中,将“ EXTERNAL_URL”的值设置为访问GitLab服务器的地址,可以设置为服务器的公网IP地址,也可以设置为 域名

      • 执行命令后可在回显信息中查看软件的下载速度和系统预估的下载完成时间。
      • 如果下载速度持续比较缓慢,可以尝试通过“http://tool.chinaz.com/dns”查询“github.com”的响应IP地址,选择TTL值较小的IP。然后在服务器的“hosts”文件中添加相应的本地DNS解析。

      回显如下类似信息:

      Running handlers:
      Running handlers complete
      Chef Client finished, 452/672 resources updated in 01 minutes 38 seconds
      gitlab Reconfigured!
      
             *.                  *.
            ***                 ***
           *****               *****
          .******             *******
          ********            ********
         ,,,,,,,,,***********,,,,,,,,,
        ,,,,,,,,,,,*********,,,,,,,,,,,
        .,,,,,,,,,,,*******,,,,,,,,,,,,
            ,,,,,,,,,*****,,,,,,,,,.
               ,,,,,,,****,,,,,,
                  .,,,***,,,,
                      ,*,.
      
      
      
           _______ __  __          __
          / ____(_) /_/ /   ____ _/ /_
         / / __/ / __/ /   / __ `/ __ \
        / /_/ / / /_/ /___/ /_/ / /_/ /
        \____/_/\__/_____/\__,_/_.___/
      
      
      Thank you for installing GitLab!

  4. 浏览器访问测试。

    1. 使用浏览器访问“http://服务器IP地址”,显示如下页面,说明环境搭建成功。

    2. 首次登录会强制用户修改密码。密码修改成功后,输入新密码进行登录。

support.huaweicloud.com/bestpractice-ecs/zh-cn_topic_0142594569.html