系統(tǒng)環(huán)境
操作系統(tǒng):Ubuntu 14.04
安裝步驟
- Packages/Dependencies
- Ruby
- System Users
- Gitlab shell
- Datebase
- Gitlab
- Nginx
開始安裝
1.更新apt-get
apt-get update
apt-get upgrade
2.安裝依賴
sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev
安裝python
sudo apt-get install python2.7
sudo ln -s /usr/bin/python /usr/bin/python2
如果是系統(tǒng)自帶python2.7 可以忽略拼坎。
3.安裝ruby
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz | tar xz
cd ruby-1.9.3-p392
./configure
make
sudo make install
4.安裝bundler
sudo gem install bundler
5.創(chuàng)建git賬戶
sudo adduser --disabled-login --gecos 'GitLab' git
6.安裝gitlab-shell
sudo su git
cd /home/git
git clone https://github.com/gitlabhq/gitlab-shell.git
cd gitlab-shell
git checkout v1.4.0
vim config.yml #改不改都是個坑泰鸡,所以可以不用改了
./bin/install
7.安裝數據庫
- mysql和postgres兩個數據庫可選壳鹤,mysql更為熟悉一些芳誓,
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
mysql -u root -p
CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
CREATE DATABASE IF NOT EXISTSgitlabhq_production
DEFAULT CHARACTER SETutf8
COLLATEutf8_unicode_ci
;
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ONgitlabhq_production
.* TO 'gitlab'@'localhost';
sudo -u git -H mysql -u gitlab -p -D gitlabhq_production
8.Gitlab
- user git
cd /home/git
sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab
cd /home/git/gitlab
sudo -u git -H git checkout 5-2-stable
9.配置GitLab
cd /home/git/gitlab
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
sudo -u git -H vim config/gitlab.yml
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 -H mkdir /home/git/gitlab-satellites
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/
sudo -u git -H mkdir public/uploads
sudo chmod -R u+rwX public/uploads
sudo -u git -H cp config/puma.rb.example config/puma.rb