2024年11月CentOS系统安装GitLab的步骤(2)

发布时间:

  ⑴、建立gitlab数据库并授权

  ⑵# Login to MySQL

  ⑶mysql -u root -p

  ⑷# Create a user for GitLab. (change $password to a real password

  ⑸mysql》 CREATE USER ‘gitlab’‘localhost’ IDENTIFIED BY ‘gitlab’;

  ⑹# Create the GitLab production database

  ⑺mysql》 CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf` COLLATE `utf_unicode_ci`;

  ⑻# Grant the GitLab user necessary permissopns on the table.

  ⑼mysql》 GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO ‘gitlab’‘localhost’;

  ⑽# Quit the database session

  ⑾mysql》 q

  ⑿、克隆gitlab源

  ⒀# Clone GitLab repository

  ⒁cd /home/git

  ⒂sudo -u git -H git clone gitlab

  ⒃# Go to gitlab dir

  ⒄cd /home/git/gitlab

  ⒅# Checkout to stable release

  ⒆sudo -u git -H git checkout --stable

  ⒇Configure it

  ⒈cd /home/git/gitlab

  ⒉# Copy the example GitLab config

  ⒊sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml

  ⒋# Make sure to change “localhost” to the fully-qualified domain name of your

  ⒌# host serving GitLab where necessary

  ⒍sudo -u git -H vim config/gitlab.yml

  ⒎# Make sure GitLab can write to the log/ and tmp/ directories

  ⒏sudo chown -R git log/

  ⒐sudo chown -R git tmp/

  ⒑sudo chmod -R u+rwX log/

  ⒒sudo chmod -R u+rwX tmp/

  ⒓# Create directory for satellites

  ⒔sudo -u git -H mkdir /home/git/gitlab-satellites

  ⒕# Create directories for sockets/pids and make sure GitLab can write to them

  ⒖sudo -u git -H mkdir tmp/pids/

  ⒗sudo -u git -H mkdir tmp/sockets/

  ⒘sudo chmod -R u+rwX tmp/pids/

  ⒙sudo chmod -R u+rwX tmp/sockets/

  ⒚# Create public/uploads directory otherwise backup will fail

  ⒛sudo -u git -H mkdir public/uploads

  ①sudo chmod -R u+rwX public/uploads

  ②# Copy the example Puma config

  ③sudo -u git -H cp config/puma.rb.example config/puma.rb

  ④# Configure Git global settings for git user, useful when editing via web

  ⑤# Edit user.email aording to what is set in gitlab.yml

  ⑥sudo -u git -H git config --global user.name “GitLab”

  ⑦sudo -u git -H git config --global user.email “gitlablocalhost”

  ⑧上面就是CentOS安装配置GitLab的方法介绍了,在安装GitLab前需要配置GitLab环境,需安装安装epel与基础依赖库及软件,再配置GitLab数据库。