Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The process of Gitlab migrating database mysql under Centos7

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Chapter 1 system preparation

[root@test ~] # cat / etc/redhat-releaseCentOS Linux release 7.2.1511 (Core) [root@test ~] # uname-r3.10.0-327.el7.x86_641.1 add the image of Ali Cloud

Cd / etc/yum.repos.d# backup original image mv CentOS-Base.repo CentOS-Base.repo.backup # add Aliyun Base source wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo # add Aliyun epel source wget https://mirrors.aliyun.com/repo/epel-7.repo# clear cache yum clean all & & yum makecache Chapter 2 yum install the latest version of Gitlab9.1.2

2.1 install dependent softwar

Yum install curl policycoreutils openssh-serveropenssh-clients2.2 adds image of Tsinghua University

Vi / etc/yum.repos.d/gitlab-ce.repo [gitlab-ce] name=Gitlab CE Repositorybaseurl= https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/gpgcheck=0enabled=12.3 installation gitlab-ce

Yum makecacheyum install gitlab-ce2.4 to view the version of gitlab installed

Head-1 / opt/gitlab/version-manifest.txtgitlab-ce 9.1.22.5 reconfigure and start Gitlab

# gitlab-ctl reconfigure will restore some past config, resulting in no gitlab-ctl reconfigure for the modified port and domain name # restart gitlab-cegitlab-ctl restart Chapter 3 install mysql5.6.36

3.1 add mysql Feed

Vi / etc/yum.repo.d/mysql.repo [mysql56-community] name=MySQL 5.6 Community Serverbaseurl= http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/enabled=1gpgcheck=03.2mysql configuration

Yum-y install mysql-server mysql-devel # basic configuration, create a new password, etc. Mysql_secure_installation # Log in to the database mysql- uroot-p$password # to view user status mysql > select user,host from mysql.user +-+-+ | user | host | +-+-+ | root | 127.0.0.1 | root |:: 1 | | root | localhost | | root | test | +-+ 4 rows in set (0.03 sec) # create a gitlab management user mysql > CREATE USER 'git'@'localhost' IDENTIFIED BY' 123456' Query OK, 0 rows affected (0.00 sec) # create gitlab database mysql > CREATE DATABASE IF NOT EXISTS`gitlabhq _ production`DEFAULT CHARACTER SET `utf8` COLLATE `utf8_general_ ci`; Query OK, 1 row affected (0.00 sec) # Grant git users permissions on all tables in gitlabhq_production database mysql > GRANT SELECT, INSERT, UPDATE, DELETE,CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES, REFERENCES on `gitlabhq _ production`.* TO 'git'@'localhost' Query OK, 0 rows affected (0.00 sec) # makes the modified users effective mysql > flush privileges;Query OK, 0 rows affected (0.00 sec) mysql >\ qBye # tests whether new users can connect to the new database sudo-u git-H mysql-u git-p-Dgitlabhq_productionEnter password:Reading table information for completion of tableand column namesYou can turn off this feature to get a quickerstartup with-A Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 32Server version: 5.6.36 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or itsaffiliates. All rights reserved. Oracle is a registered trademark of OracleCorporation and/or itsaffiliates. Other names may be trademarks of theirrespectiveowners. Type 'help;' or'\ h' for help. Type'\ c'to clearthe current input statement. Mysql > Chapter 4 configuring Gitlab connection mysql

4.1Modification / etc/gitlab/gitlab.rb

Postgresql ['enable'] = falsegitlab_rails [' db_adapter'] = 'mysql2'gitlab_rails [' db_encoding'] = 'utf8'gitlab_rails [' db_host'] = '127.0.0.1'gitlab_rails [' db_port'] = '3306'gitlab_rails [' db_username'] = 'git'gitlab_rails [' db_password'] = '123456' the following error occurred while reconfiguring the gitlabgitlab-ctl reconfigure migration database according to the official document

Chapter 5 troubleshooting steps

5.1 replace the gem source

# check the gem source / opt/gitlab/embedded/bin/gem source*** CURRENT SOURCES * https://rubygems.org/ # replace the open source gem source in China Otherwise, an error will occur when using / opt/gitlab/embedded/bin/gem sources-- add https://gems.ruby-china.org/-- remove https://rubygems.org/ # View the better gem source / opt/gitlab/embedded/bin/gem sources*** CURRENT SOURCES * https://gems.ruby-china.org/ # change the gem source vi / opt/gitlab/embedded/service/gitlab-rails/ Gemfilesource 'https:// of the configuration Gemfile file Gems.ruby-china.org'5.2bundle install install updates # this command attempts to update gem packages that already exist on the system

/ opt/gitlab/embedded/bin/bundle install

# to execute this command, you need to change to a directory one level above Gemfile to run it

Cd / opt/gitlab/embedded/service/gitlab-rails/

/ opt/gitlab/embedded/bin/bundle install

5.3bundle prohibits the use of postgresql

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

5.4 install mysql2 "0.3.20"

Gitlab-rake gitlab:check

# error installing mysql2 version 0.3.20 / opt/gitlab/embedded/bin/gem install mysql2-vault 0.3.20'

After viewing the file, it was found that the gcc software was not installed, so the file could not be compiled. Therefore, yum is required to install gccyum install gcc-y / opt/gitlab/embedded/bin/gem install mysql2-v'0.3.20'Building native extensions. This could take a while...Successfully installed mysql2-0.3.20Parsing documentation for mysql2-0.3.20Installing ri documentation for mysql2-0.3.20Done installing documentation for mysql2 after 1seconds1 gem installed5.5 reset check

# reconfigure gitlab-ctl reconfigure# to check gitlab-rake gitlab:check

5.6 client test

[root@test chen] # touch README.md [root@test chen] # git add README.md [root@test chen] # git commit-m "addREADME" [master (root submission) bed61ad] addREADME 1 filechanged, 0 insertions (+), 0 deletions (-) create mode100644 README.md [root@test chen] # git push-u origin masterCounting objects: 3, done.Writing objects: 100,216 bytes | 0 bytes/s,done.Total 3 (delta 0) Reused 0 (delta 0) To git@10.0.0.10:root/chen.git * [newbranch] master-> master branch master is set to track the remote branch master from origin.

Success

Reference documentation:

Https://docs.gitlab.com/ce/install/database_mysql.html

Https://docs.gitlab.com/omnibus/settings/database.html#seed-the-database-fresh-installs-only

Http://shaonian.blog.51cto.com/2975261/1894664

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report