GitLab在CentOS上安装时,推荐使用PostgreSQL作为其主要的数据库。以下是详细的安装和配置步骤:
sudo yum update -y
sudo yum install -y curl openssh-server ca-certificates
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install -y gitlab-ce
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -u postgres psql
CREATE DATABASE gitlabhq_production;
CREATE USER gitlab WITH PASSWORD 'gitlab123';
GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production TO gitlab;
\q
编辑 /etc/gitlab/gitlab.rb
文件,添加或修改以下配置:
gitlab_rails['db_adapter'] = 'postgresql'
gitlab_rails['db_encoding'] = 'utf8'
gitlab_rails['db_host'] = 'localhost'
gitlab_rails['db_database'] = 'gitlabhq_production'
gitlab_rails['db_username'] = 'gitlab'
gitlab_rails['db_password'] = 'gitlab123'
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
Bytebase是一个可以帮助自动化数据库变更的工具,可以与GitLab集成,实现数据库CI/CD工作流。
以上步骤可以帮助您在CentOS上成功安装和配置GitLab,并使用PostgreSQL作为其数据库。