安裝數據庫
sudo yum install -y postgresql-server
sudo postgresql-setup initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql
創建數據庫和用戶
sudo -u postgres psql
CREATE DATABASE gitlabhq_production;
CREATE USER gitlab WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production TO gitlab;
\q
配置GitLab連接
編輯 /etc/gitlab/gitlab.rb
:
gitlab_rails['db_adapter'] = 'postgresql'
gitlab_rails['db_host'] = 'localhost'
gitlab_rails['db_port'] = 5432
gitlab_rails['db_user'] = 'gitlab'
gitlab_rails['db_password'] = 'your_password'
gitlab_rails['db_name'] = 'gitlabhq_production'
重啟GitLab
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
shared_buffers
、work_mem
)。