centos

CentOS中GitLab数据库选择

小樊
44
2025-03-09 12:28:37
栏目: 智能运维

在CentOS中安装GitLab时,可以选择使用 PostgreSQL 作为数据库。自从GitLab 12.1版本开始,后端存储不再支持MySQL,而是仅支持PostgreSQL。以下是安装GitLab并配置PostgreSQL数据库的简要步骤:

安装依赖包

sudo yum -y updatesudo yum install -y curl openssl-devel policycoreutils-python openssh-server perl git nodejs rsync cronie postfix

安装GitLab

cd ~ && sudo yum install -y wget && sudo wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-17.3.1-ce.0.el7.x86_64.rpm/download.rpm

执行安装

rpm -i gitlab-ce-17.3.1-ce.0.el7.x86_64.rpm

配置GitLab使用PostgreSQL

  1. 修改 /etc/gitlab/gitlab.rb 配置文件

    vi /etc/gitlab/gitlab.rb
    
  2. 设置外部URL(如果需要从外部访问GitLab):

    external_url 'http://gitlab.example.com'
    
  3. 配置PostgreSQL

    • 确保PostgreSQL已安装并运行。
    • 创建一个新的数据库、用户和密码供GitLab使用。
  4. 重新配置并重启GitLab

    gitlab-ctl reconfigure
    gitlab-ctl restart
    

请注意,具体的安装步骤和配置可能会因GitLab版本和服务器环境的不同而有所差异。建议参考GitLab的官方文档或相关教程以获取最准确的信息。

0
看了该问题的人还看了