1)安裝macpython
2) 建立git用戶和git組mysql
4) 安裝XCodegit
5) 安裝命令行組件github
6) 安裝 Home brewredis
$ ruby -e
"$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
$ brew doctor
7) 安裝一些依賴關係sql
$ brew install icu4c # 被
charlock_holmes gem依賴
$ brew install git
$ brew install redis
$ mkdir ~/Library/LaunchAgents # create launchAgents dir (it does not exist in fresh system)
$ ln -sfv /usr/local/opt/redis/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
$ python --version # 查看 python 版本
$ sudo ln -s /usr/bin/python /usr/bin/python2 #GitLab 須要
python2
其它依賴關係shell
$ sudo easy_install pip
$ sudo pip install pygments
8) brew install mysql #也能夠從官方下載, 可是我在試驗的時候官方的包有問題, 致使部署數據庫的時候出錯數據庫
9) 安裝mysqlruby
啓動mysql服務並更改root密碼bash
$ /usr/local/mysql/bin/mysqladmin -u root password <密碼>
確保 mysql 在 PATH 裏
$ export PATH=/usr/local/mysql/bin:$PATH
登錄mysql
$ mysql -u root -p
#建立新用戶 gitlab
mysql> CREATE USER
'gitlab'
@
'localhost'
IDENTIFIED BY
'密碼'
;
#建立數據庫
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
# 受權
mysql> GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO
'gitlab'
@
'localhost'
;
# 退出
mysql> \q
# 試着鏈接一下
sudo -u git -H mysql -u gitlab -p -D gitlabhq_production
10) 安裝 Ruby (用rbenv和rvm均可以)
$ brew install rbenv
$ brew install ruby-build
$ echo
'export PATH="/usr/local/bin:$PATH"'
| sudo -u git tee -a /Users/git/.profile
$ echo
'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi'
| sudo -u git tee -a /Users/git/.profile
$ sudo -u git cp /Users/git/.profile /Users/git/.bashrc
# 安裝ruby 1.9.3 (記得改成taobao源)
$ sudo -u git -H -i rbenv install 1.9.3-p448
$ sudo -u git -H -i
'rbenv global 1.9.3-p448'
$ rbenv install 1.9.3-p392
$ rbenv global 1.9.3-p392
11) 安裝 rails
$ sudo gem install rails
12) 安裝Gitlab Shell
$ cd /Users/git
$ sudo -u git git clone https:
//github.com/gitlabhq/gitlab-shell.git
$ cd gitlab-shell
$ sudo -u git cp config.yml.example config.yml
打開 config.yml 文件並修改
a) 更改gitlab url 爲 你的 URL (若是沒有能夠不改)
b) 更改 「/home」 爲 「/Users」 (Mac下的/home)
c) 更改 redis-cli 到 home-brew的 cli 路徑 – 「/usr/local/bin/redis-cli」
13) 安裝GitLab -
下載Gitlab -
$ cd /Users/git
$ sudo -u git git clone https:
//github.com/gitlabhq/gitlabhq.git gitlab
配置GitLab
$ sudo -u git cp config/gitlab.yml.example config/gitlab.yml
打開 gitlab.ym l更改 「/home」 爲 「/Users」 確保更改 「gitlab.example.com」 爲你的domain(若是沒有能夠不改)
# 確保 GitLab 能對 log/ and tmp/ 進行讀寫
$ sudo chown -R git log/
$ sudo chown -R git tmp/
$ sudo chmod -R u+rwX log/
$ sudo chmod -R u+rwX tmp/
# 建立倉庫目錄
$ sudo -u git mkdir /Users/git/repositories
$ sudo chmod -R u+rwX /Users/git/repositories/
# 建立satellites
$ sudo -u git mkdir /Users/git/gitlab-satellites
# 建立 pids 和 sockets
$ sudo -u git mkdir tmp/pids/
$ sudo -u git mkdir tmp/sockets/
$ sudo chmod -R u+rwX tmp/pids/
$ sudo chmod -R u+rwX tmp/sockets/
# 建立備份所使用的目錄
$ sudo -u git mkdir
public
/uploads
$ sudo chmod -R u+rwX
public
/uploads
# 複製Puma配置文件(沒有可忽略)
$ sudo -u git cp config/puma.rb.example config/puma.rb
打開 puma.rb 修改 「/home」 爲 「/Users」
# 配置 Git global 配置
$ sudo -u git -H git config --global user.name
"GitLab"
$ sudo -u git -H git config --global user.email
"gitlab@gitlab.example.com"
配置Gitlab的mysql信息.
$ sudo -u git cp config/database.yml.mysql config/database.yml
修改 database.yml 裏的 production 區域裏的數據庫帳戶和密碼 (以前新建的那個gitlab用戶)
安裝 Gems
$ sudo gem install charlock_holmes --version
'0.6.9.4'
$ sudo -u git -H bash -l -c
'gem install bundler'
$ sudo -u git -H bash -l -c
'bundle install --deployment --without development test postgres'
部署 Database
$ sudo -u git -H bash -l -c
'bundle exec rake gitlab:setup RAILS_ENV=production'
檢查 GitLab 的安裝
瞅瞅環境信息
sudo -u git -H bash -l -c
'bundle exec rake gitlab:env:info RAILS_ENV=production'
作個檢查, 確保全部項目都是綠色, 若是有錯誤, 根據報錯信息修改
sudo -u git -H bash -l -c
'bundle exec rake gitlab:check RAILS_ENV=production'
14) 啓動 gitlab
$ rails s -e production -p 12345
15) 打開 http://localhost:12345
login………admin@local.host
password……5iveL!fe
15) 建立倉庫
如何建立倉庫能夠參考以下博文: http://blog.csdn.net/passion_wu128/article/details/8218041
原文: http://www.makebetterthings.com/git/install-gitlab-5-3-on-mac-os-x-server-10-8-4/