Goodspeed

导航

ubuntu安装gitlab

#安装所有的依赖包
sudo apt-get install -y build-essential git-core
sudo apt-get install -y zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev python-docutils postfix mysql-server mysql-client libmysqlclient-dev nginx libtool

#安装ruby
mkdir /tmp/ruby && cd /tmp/ruby 
curl --progress http://ruby.taobao.org/mirrors/ruby/ruby-1.9.3-p392.tar.gz | tar xz 
cd ruby-1.9.3-p392 
./configure 
make 
sudo make install 

#创建用户 
sudo adduser --disabled-login --gecos 'GitLab' git 

#获取git-shell的代码 
cd /home/git 
sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git 
cd gitlab-shell 

sudo -u git -H git checkout v1.7.0 
sudo -u git -H cp config.yml.example config.yml 
sudo -u git -H vim config.yml 
sudo -u git -H ./bin/install #获取gitlab代码 cd /home/git 
sudo -u git -H git clone http://git.oschina.net/mirrors/gitlabhq.git gitlab  

#配置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/unicorn.rb.example config/unicorn.rb #
sudo -u git -H vim config/unicorn.rb 
sudo -u git -H git config --global user.name "GitLab" 
sudo -u git -H git config --global user.email "gitlab@localhost" 
sudo -u git -H git config --global core.autocrlf input 
sudo -u git cp config/database.yml.mysql config/database.yml 
sudo -u git -H vim config/database.yml 
sudo -u git -H chmod o-rwx config/database.yml 
sudo -u git cp config/puma.rb.example config/puma.rb 

#安装gam 
cd /home/git/gitlab 
gem sources --remove http://rubygems.org/ 
gem sources -a http://ruby.taobao.org/ 
gem sources -l 
sudo gem install charlock_holmes --version '0.6.9.4' 
sudo gem install bundler --no-ri --no-rdoc 
sudo -u git -H vim Gemfile # source 'http://ruby.taobao.org/' 
sudo -u git -H bundle install --deployment --without development test postgres unicorn aws --verbose 

#创建数据库 
mysql -u root -p 
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; 
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production --verbose 

#安装启动脚本 
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab 
sudo chmod +x /etc/init.d/gitlab
sudo update-rc.d gitlab defaults 21 
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production 
sudo /etc/init.d/gitlab restart 
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production 

#nginx 
sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab 
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab 
sudo vim /etc/nginx/sites-available/gitlab 
sudo /etc/init.d/nginx restart

 

posted on 2013-08-07 10:44  Goodspeed  阅读(5403)  评论(3编辑  收藏  举报