在CentOS上安装GitLab时,可以选择使用MySQL或PostgreSQL作为数据库。以下是相关介绍:
sudo yum install -y mysql-server mariadb
sudo systemctl start mysqld
sudo systemctl enable mysqld
sudo mysql_secure_installation
/etc/gitlab/gitlab.rb
文件,设置MySQL的连接信息:gitlab_rails['db_host'] = "localhost"
gitlab_rails['db_port'] = 3306
gitlab_rails['db_user'] = "gitlab"
gitlab_rails['db_password'] = "your_mysql_password"
gitlab_rails['db_name'] = "gitlabhq_production"
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo yum install -y postgresql-server
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -u postgres psql
CREATE DATABASE gitlabhq_production;
CREATE USER gitlab WITH PASSWORD 'your_postgresql_password';
ALTER ROLE gitlab SET client_encoding TO 'utf8';
ALTER ROLE gitlab SET default_transaction_isolation TO 'read committed';
ALTER ROLE gitlab SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production TO gitlab;
\q
/etc/gitlab/gitlab.rb
文件,设置PostgreSQL的连接信息:gitlab_rails['db_host'] = "localhost"
gitlab_rails['db_port'] = 5432
gitlab_rails['db_user'] = "gitlab"
gitlab_rails['db_password'] = "your_postgresql_password"
gitlab_rails['db_name'] = "gitlabhq_production"
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
以上是在CentOS上为GitLab选择MySQL或PostgreSQL数据库的方法,具体选择哪种数据库可以根据个人或组织的需求和偏好来决定。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>