乐趣区

关于gitlab:在Anolis-中安装极狐GitLabjh

本文作者:徐晓伟

基于 Anolis 龙蜥 8.4 和 极狐 GitLab 官网仓库脚本 装置 / 配置 极狐 GitLab-jh

阐明与文档

  1. 龙蜥官网:https://openanolis.cn/
  2. 龙蜥 Anolis 零碎是阿里云团队开发
  3. 龙蜥 Anolis 零碎与 CentOS 软件生态兼容
  4. 本文以 Anolis 8、GitLab EE 企业版为例进行阐明( 如果应用的是 Anolis 7,须要将下方链接中的参数 8 改为 7
  5. GitLab 官网 CentOS 装置文档,应用国内 IP 拜访时,会跳转到极狐 GitLab
  6. 极狐 GitLab CentOS 装置文档

装置阐明

  1. 官网文档中 CentOS 装置阐明中,应用 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash 装置 CentOS yum 源,之后就能够应用 sudo yum -y install gitlab-ee 进行装置了
  2. 执行 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash 运行的脚本内容可在 https://packages.gitlab.com/gitlab/gitlab-ee/install#bash-rpm 中查看,脚本中下载 yum 源的地址是 https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/config_file.repo?os=${os}&dist=${dist}&source=script,由从地址可知,下载时会应用以后零碎的名称作为参数
  3. 因为龙蜥零碎与 CentOS 软件生态兼容,能够本人构建下载链接并手动下载 yum 源,放入到 /etc/yum.repos.d/ 文件夹中即可

装置

  1. 查看零碎版本

    cat /etc/redhat-release
    # 返回后果
    [root@alios8 ~]# cat /etc/redhat-release 
    Anolis OS release 8.4
    [root@alios8 ~]# 
  2. 依据下面的内容,能够看到应用的是龙蜥 8,对应的 CentOS 版本也是 8
  3. 构建 yum 源链接并下载到 /etc/yum.repos.d/ 文件夹中

    1. 尝试获取后果

      # 应用 curl 须要在申请头中增加标识 User-Agent
      curl 'https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/config_file.repo?os=centos&dist=8&source=script' --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36'
    2. yum 源下载到 /etc/yum.repos.d/gitlab_gitlab-ee.repo

      # 应用 curl 须要在申请头中增加标识 User-Agent
      sudo curl 'https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/config_file.repo?os=centos&dist=8&source=script' --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36' > /etc/yum.repos.d/gitlab_gitlab-ee.repo
    3. 更新 yum 源(首次更新,可能会提醒须要下载并导入 gpgkey)

      # 更新 yum 源
      yum makecache
      # yum makecache -y
      
      # 清空 yum 源后再更新 yum 源
      # yum clean all && yum makecache
      # yum clean all && yum makecache -y
      # 更新命令及后果,为了不便,应用了 -y 进行确定
      
      [root@alios8 ~]# yum makecache -y
      AnolisOS-8 - AppStream                                                                                                     5.9 MB/s |  10 MB     00:01    
      AnolisOS-8 - BaseOS                                                                                                        3.3 MB/s | 7.9 MB     00:02    
      AnolisOS-8 - PowerTools                                                                                                    4.3 MB/s | 2.1 MB     00:00    
      gitlab_gitlab-ee                                                                                                           105  B/s | 862  B     00:08    
      gitlab_gitlab-ee                                                                                                           790  B/s | 3.1 kB     00:04    
      Importing GPG key 0x51312F3F:
       Userid     : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
       Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F
       From       : https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey
      gitlab_gitlab-ee                                                                                                           698  B/s | 3.8 kB     00:05    
      Importing GPG key 0xF27EAB47:
       Userid     : "GitLab, Inc. <support@gitlab.com>"
       Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47
       From       : https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey/gitlab-gitlab-ee-3D645A26AB9FBD22.pub.gpg
      gitlab_gitlab-ee                                                                                                            97 kB/s | 1.5 MB     00:15    
      gitlab_gitlab-ee-source                                                                                                     78  B/s | 862  B     00:11    
      gitlab_gitlab-ee-source                                                                                                    465  B/s | 3.1 kB     00:06    
      Importing GPG key 0x51312F3F:
       Userid     : "GitLab B.V. (package repository signing key) <packages@gitlab.com>"
       Fingerprint: F640 3F65 44A3 8863 DAA0 B6E0 3F01 618A 5131 2F3F
       From       : https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey
      gitlab_gitlab-ee-source                                                                                                    953  B/s | 3.8 kB     00:04    
      Importing GPG key 0xF27EAB47:
       Userid     : "GitLab, Inc. <support@gitlab.com>"
       Fingerprint: DBEF 8977 4DDB 9EB3 7D9F C3A0 3CFC F9BA F27E AB47
       From       : https://packages.gitlab.com/gitlab/gitlab-ee/gpgkey/gitlab-gitlab-ee-3D645A26AB9FBD22.pub.gpg
      gitlab_gitlab-ee-source                                                                                                     21  B/s | 296  B     00:13    
      Metadata cache created.
      [root@alios8 ~]# 
  4. 装置
  5. 增加 gitlab-jh 仓库
gpgcheck=0  
releasever=7  
  
sudo cat << EOF | sudo tee /etc/yum.repos.d/gitlab-jh.repo  
[gitlab-jh]  
name=JiHu GitLab  
baseurl=$REPO_URL/repository/el/$releasever/  
gpgcheck=$gpgcheck  
gpgkey=$REPO_URL/repository/raw/gpg/public.gpg.key  
priority=1  
enabled=1  
EOF  
  
cat /etc/yum.repos.d/gitlab-jh.repo
  • 更新本地软件包缓存
yum makecache

# 清空后执行
# yum clean all && yum makecache
  • 装置 GitLab-jh

    sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-jh
  • 其余命令与装置 gitlab 雷同

  1. 前面就能够间接应用后面的文档 CentOS 7 中装置 GitLab 进行配置了
退出移动版