gitlab7.2安装
系统:centos6.4
1.安装依赖包
导入epel:
useradd git
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh epel-release-6-8.noarch.rpm
yum -y install build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis* checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate python-docutils pkg-config cmake perl cpio libicu*
2.安装最新版本git
wget http://www.codemonkey.org.uk/projects/git-snapshots/git/git-latest.tar.xz
tar xzvf git-latest.tar.xz
cd git-xxxx-xx-xx
autoconf
./configure
make
make install
cp /usr/local/bin/git /usr/bin/
3.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
make install
4.mysql安装调整(现有环境为公司内部MYsql,连数据root账户。)
yum -y install mysql
service mysqld start
创建库gitlabhq_production
5.gitlab安装
su git
cd /home/git
clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 7-2-stable gitlab
cd /home/git/gitlab
cp config/gitlab.yml.example config/gitlab.yml (需要将此文件里面的host改为本机ip)
chown -R git log/
chown -R git tmp/
chmod -R u+rwX log/
chmod -R u+rwX tmp/
mkdir /home/git/gitlab-satellites
hmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
chmod -R u+rwX tmp/pids/
chmod -R u+rwX tmp/sockets/
chmod -R u+rwX public/uploads
cp config/unicorn.rb.example config/unicorn.rb
cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
git config --global user.name "GitLab"
git config --global user.email "example@example.com"
git config --global core.autocrlf input
cp config/database.yml.mysql config/database.yml(需要将里面的用户名密码指定为mysql,sock也指向mysql的sock)
chmod o-rwx config/database.yml
vi /home/git/gitlab/Gemfile/
将source "https://rubygems.org" 更改为source "http://ruby.taobao.org"
bundle install --deployment --without development test postgres aws
6.gitlab-shell安装
service redis start
cd /home/git/gitlab
bundle exec rake gitlab:shell:install[v1.9.7] REDIS_URL=redis://localhost:6379 RAILS_ENV=production
7.安装nginx并初始化数据库
yum -y install nginx
cd /home/git/gitlab
cp lib/support/init.d/gitlab /etc/init.d/gitlab
cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
日志切割:
cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
nginx主配置文件,需要按需调整server 配置,其余可以保持默认。
cp lib/support/nginx/gitlab /etc/nginx/conf.d/gitlab.conf
生成mysql数据库表结构。
bundle exec rake gitlab:setup RAILS_ENV=production (输入yes)
执行完会提示首次登陆的用户密码:
5iveL!fe
执行检查操作:
bundle exec rake gitlab:check RAILS_ENV=production (检查是否有报错)
service nginx start
service gitlab start
直接访问url路径,登陆用户名和密码。