[git@Git gitlab-shell]$ mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.36-MariaDB-wsrep MariaDB Server, wsrep_25.9.r3961
Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY 'gitlab';
Query OK, 0 rows affected (0.20 sec)
MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
Query OK, 1 row affected (0.11 sec)
MariaDB [(none)]> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
Query OK, 0 rows affected (0.06 sec)
MariaDB [(none)]> quit
Bye
6)克隆GitLab源
[git@Git gitlab]$sudo gem install charlock_holmes --version '0.6.9'
Fetching: charlock_holmes-0.6.9.gem (100%)
Building native extensions. This could take a while...
Successfully installed charlock_holmes-0.6.9
Parsing documentation for charlock_holmes-0.6.9
Installing ri documentation for charlock_holmes-0.6.9
Done installing documentation for charlock_holmes after 0 seconds
1 gem installed
如果有链接超时的错误加上 参数
--source http://rubygems.org
Gem::RemoteFetcher::UnknownHostError: no such name (http://rubygems.org/gems/gollum-lib-3.0.0.gem)
An error occurred while installing gollum-lib (3.0.0), and Bundler cannot
continue.
Make sure that `gem install gollum-lib -v '3.0.0'` succeeds before bundling.
gem install gollum-lib -v '3.0.0' --source http://rubygems.org
[git@Git gitlab]$ vi Gemfile
source "https://rubygems.org"改为source "http://rubygems.org"
[git@Git gitlab]$ bundle install --deployment --without development test postgres
Fetching source index from http://rubygems.org/
Fetching https://github.com/gitlabhq/grit.git
Could not find modernizr-2.6.2 in any of the sources
#出现错误:Could not find modernizr-2.6.2 in any of the sources
#解决办法:
[git@Git gitlab]$ vi Gemfile
第114行 gem "modernizr", "2.6.2"
更改改为:
第114行 gem "modernizr-rails", "2.7.1"
[git@Git gitlab]$ vi Gemfile.lock
第252行 modernizr (2.6.2)
更改改为:
第252行 modernizr-rails (2.7.1)
第523行 modernizr (= 2.6.2)
更改改为:
第523行 modernizr-rails (= 2.7.1)
#重新执行:
[git@Git gitlab]$ bundle install --deployment --without development test postgres puma aws
9)启动redis
[git@Git gitlab]$ bundle exec rake gitlab:setup RAILS_ENV=production --verbose
This will create the necessary database tables and seed the database.
You will lose any previous data stored in the database.
Do you want to continue (yes/no)? yes
#最后初始化成功后会获得账号和密码
Administrator account created:
login.........admin@local.host
password......5iveL!fe
could not find i18n-0.6.9 in any of the sources
Run `bundle install` to install missing gems
[git@Git gitlab]$ bundle install
You are trying to install in deployment mode after changing your Gemfile
11)检查GitLab及其环境的配置是否正确
[git@Git gitlab]$ bundle exec rake gitlab:env:info RAILS_ENV=production
System information
System: CentOS release 6.5 (Final)
Current User: git
Using RVM: no
Ruby Version: 2.1.1p76
Gem Version: 2.2.2
Bundler Version:1.6.2
Rake Version: 10.0.4
GitLab information
Version: 5.1.0
Revision: be39106
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://localhost
HTTP Clone URL: http://localhost/some-project.git
SSH Clone URL: git@localhost:some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 1.3.0
Repositories: /home/git/repositories/
Hooks: /home/git/gitlab-shell/hooks/
Git: /usr/bin/git
[git@Git gitlab]$ bundle exec rake sidekiq:start RAILS_ENV=production
rake aborted!
SIGTERM
/home/git/gitlab/lib/tasks/sidekiq.rake:9:in `system'
/home/git/gitlab/lib/tasks/sidekiq.rake:9:in `block (2 levels) in <top (required)>'
Tasks: TOP => sidekiq:start
(See full trace by running task with --trace)
[git@Git gitlab]$ bundle exec rake gitlab:check RAILS_ENV=production
Checking Environment ...
Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes
Checking Environment ... Finished
Checking Gitlab Shell ...
GitLab Shell version? ... OK (1.3.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... yes
post-receive hooks in repos are links: ... can't check, you have no projects
Checking Gitlab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Checking Sidekiq ... Finished
Checking GitLab ...
Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... no
Try fixing it:
Install the init script
#原文说明不用介意这个问题
For more information see:
doc/install/installation.md in section "Install Init Script"
Please fix the error above and rerun the checks.
Init script up-to-date? ... can't check because of previous errors
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Checking GitLab ... Finished
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.1.2p95
Gem Version: 2.2.2
Bundler Version:1.7.2
Rake Version: 10.3.2
Sidekiq Version:2.17.0
GitLab information
Version: 7.1.1
Revision: facfec4
Directory: /home/git/gitlab
DB Adapter: mysql2
URL: http://gitlab.gxl.com
HTTP Clone URL: http://gitlab.gxl.com/some-project.git
SSH Clone URL: git@gitlab.gxl.com:some-project.git
Using LDAP: no
Using Omniauth: no