标签:style http color io os 使用 ar strong 文件
安装环境:
操作系统: Ubuntu 12.4 LTS 英文
数据库: postgresql
web服务器: nginx
可以说到7.x的时候,GitLab的文档已经相当完善了!此文作为翻译和部分FAQ.
使用Vim作为默认文本编辑器
sudo apt-get install -y vim sudo update-alternatives --set editor /usr/bin/vim.basic
sudo apt-get install -y build-essential 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 logrotate python-docutils pkg-config cmake
sudo apt-get install -y git-core
在12.4版本中,默认的Git版本为1.7.9.5
所以,我们要手动安装Git。
sudo apt-get remove git-core
sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
我们可以用浏览器看https://www.kernel.org/pub/software/scm/git下面的Git的版本,选择最新的下载。
cd /tmp curl -L --progress https://www.kernel.org/pub/software/scm/git/git-2.1.2.tar.gz | tar xz cd git-2.1.2/ make prefix=/usr/local all
安装位置:/usr/local/(自动安装的安装位置为:/usr/bin/)
sudo make prefix=/usr/local install
文档中特别提到,在我们配置gitlab.yml时,一定要修改Git的路径问题!
安装Email工具
sudo apt-get install -y postfix
sudo apt-get remove ruby1.8
mkdir /tmp/ruby && cd /tmp/ruby curl -L --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz | tar xz cd ruby-2.1.2 ./configure --disable-install-rdoc make sudo make install
sudo gem install bundler --no-ri --no-rdoc
sudo adduser --disabled-login --gecos 'GitLab' git
sudo apt-get install -y postgresql postgresql-client libpq-dev
sudo -u postgres psql -d template1 template1=# CREATE USER git CREATEDB; template1=# CREATE DATABASE gitlabhq_production OWNER git; template1=# \q
sudo -u git -H psql -d gitlabhq_production
sudo apt-get install redis-server sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig sed 's/^port .*/port 0/' /etc/redis/redis.conf.orig | sudo tee /etc/redis/redis.conf echo 'unixsocket /var/run/redis/redis.sock' | sudo tee -a /etc/redis/redis.conf sudo service redis-server restart sudo usermod -aG redis git
cd /home/git
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-3-stable gitlab
cd /home/git/gitlab sudo -u git -H cp config/gitlab.yml.example 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 chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites sudo chmod -R u+rwX tmp/pids/ sudo chmod -R u+rwX tmp/sockets/ sudo chmod -R u+rwX public/uploads sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb sudo -u git -H cp config/resque.yml.example config/resque.yml
sudo -u git -H editor config/gitlab.yml
sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "example@example.com" sudo -u git -H git config --global core.autocrlf input
我们以Postgresql为例;
sudo -u git cp config/database.yml.postgresql config/database.yml
sudo -u git -H editor config/database.yml把production部分的user和passwor前面的“#”去掉。
仅git用户可以使用database.yml文件
sudo -u git -H chmod o-rwx config/database.yml
我们以Postgresql为例;
sudo -u git -H bundle install --deployment --without development test mysql aws
sudo -u git -H bundle exec rake gitlab:shell:install[v2.0.1] REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab sudo update-rc.d gitlab defaults 21
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
sudo service gitlab start
sudo apt-get install -y nginx
I. 拷贝模板文件到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
II. 替换“YOUR_SERVER_FQDN”
sudo editor /etc/nginx/sites-available/gitlab内部网:localhost
sudo nginx -t sudo service nginx restart
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
root
5iveL!fe
FAQ:
由于使用了老版本Git,比如V1.7.9.5;所以在进行“安装Gems”步骤时,下载了老版本的Rate,比如V10.1.0;
此文《Ubuntu 1204 装配 GitLab 出现 502》,解决了这个问题。
sudo gem install rake -v '10.3.2' --source http://rubygems.org sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
标签:style http color io os 使用 ar strong 文件
原文地址:http://blog.csdn.net/xiaobin_hlj80/article/details/40008917