Get the App
SLTechnology News&Howtos  ›  Database  › 

GitLab ce community version modified to mysql configuration (yum)

Shulou Source: shulou.com Published: 2022-06-01 15:40:50 10月01日 Update

Replace Gitlab database with mysql database

Note: I only succeeded in the 8.9.9 version of the experiment, because this 8.9.9 can be Chinese, the latest modification of mysql according to this method has a problem, see the comments, there is a netizen installed the latest.

Install Mysql first. I'm testing it here, so I installed 5.6with Yum.

Edit yum.repo

[mysql56-community]

Name=MySQL 5.6Community Server

Baseurl= http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/

Enabled=1

Gpgcheck=0

Run directly after saving

Yum install mysql-community-server-y installation

The installation is complete.

/ etc/init.d/mysqld start starts mysql

Mysql_secure_installation initialization

Mysql-u root-p connection

CREATE DATABASE gitlab DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; creates a library gitlab

Grant all privileges on gitlab.* to gitlab@ "%" identified by 'gitlab123' withgrant option; establishes a connection to the user

Flush privileges; refresh

First install the mysql2 package, which is used by ruby to connect to the database.

Cd / opt/gitlab/embedded/bin/

. / gem install-i/opt/gitlab/embedded/service/gem/ruby/2.1.0 mysql2

There is an error that requires installing the mysql-devel package

Yum install mysql-devel-y install it

Then the configuration is modified.

Vi / opt/gitlab/embedded/service/gitlab-rails/.bundle/config

Vi/etc/gitlab/gitlab.rb

Postgresql ['enable'] = false

Gitlab_rails ['db_adapter'] = "mysql2"

Gitlab_rails ['db_encoding'] = "utf8"

Gitlab_rails ['db_database'] = "gitlab"

Gitlab_rails ['db_pool'] = 10

Gitlab_rails ['db_username'] = "gitlab"

Gitlab_rails ['db_password'] = "gitlab123"

Gitlab_rails ['db_host'] = "127.0.0.1"

Gitlab_rails ['db_port'] = 3306

The configuration is modified.

Gitlab-rakegitlab:check performs a check

Wrong report?

Cd / opt/gitlab/embedded/bin/

. / gem install-i/opt/gitlab/embedded/service/gem/ruby/2.1.0 mysql2-v "0.3.20" execute this to install 0.3.20 as well.

Gitlab-rake gitlab:check check again: error again

Gitlab-ctl reconfigure runs this to make our modified gitlab.rb file effective

Gitlab-rake gitlab:check retest:

Gitlab-rake gitlab:setup creates new content in db and sets the administrator account

Enter yes (this will create the necessary database tables and generate the database.

You will lose any previous data stored in the database.)

After entering yes

Retest: gitlab-rake gitlab:check

Restarted the service

Gitlab-ctl stop

Gitlab-ctl start

I still reported an error after reboot. I've been looking for it for a long time.

Sudo chmod-Rug+rwX,o-rwx / var/opt/gitlab/git-data/repositories

Chmod-R ug-s/var/opt/gitlab/git-data/repositories

Find/var/opt/gitlab/git-data/repositories-type d-print0 | sudo xargs-0 chmod gears

After executing the above three commands, the permissions do not seem to be correct.

The good states are as follows:

Then revisit will be the same as our newly installed gitlab. You need to re-enter the setting password.

Create a git client to take a look:

# mkdir test2 # cd test2 # git clone https://192.168.61.129/root/test.git # ls # cd test/ # ls # touch test.txt # vi test.txt # git status # git commit-m "test" # git push-u origin master

Check the available data:

Finally, I'll test it again:

Gitlab-rake gitlab:check

Tags: Data database detection input configuration error check run version wrong necessary success command client client password that is file new content method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn NVidia Shulou Tech Info Xiaomi