手机版
你好,游客 登录 注册
背景:
阅读新闻

在 CentOS 上部署 GitLab (自托管的Git项目仓库)

[日期:2013-06-10] 来源:heylinux.com  作者:Linux [字体: ]

2.2 上面的部署步骤,主要是采用了脚本gitlab-install-el6.sh来实现的,里面其实包含了很多的配置步骤,如果本地不是一个全新的环境,那么我们最好按照以下步骤来进行手动配置:
 
2.2.1 安装EPEL扩展源
 切换到root用户
 $ sudo -i
 
# rpm -ivh http://fr2.rpmfind.net/linux/epel/6/x86_64/epel-release-6-8.noarch.rpm
 
2.2.2 安装git
 # yum install git
 
2.2.3 安装系统依赖
 # yum -y install patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel
 
2.2.4 安装rvm
 # curl -L get.rvm.io | sudo bash -s stable
 
# source /etc/profile.d/rvm.sh
 # rvm pkg install libyaml
 # rvm --default use 1.9.3-p392
 # gem install bundler
 
2.2.5 创建git用户
 # adduser --system --create-home --comment 'GitLab' git
 
2.2.6 配置gitlab-shell(比如Server主机名为:heydevops-node-2)
 # su - git -c "git clone https://github.com/gitlabhq/gitlab-shell.git"
 # su - git -c "cp gitlab-shell/config.yml.example gitlab-shell/config.yml"
 
# su - git -c "gitlab-shell/bin/install"
 
# chmod 600 /home/git/.ssh/authorized_keys
 # chmod 700 /home/git/.ssh
 
2.2.7 安装Redis
 # yum -y install redis
 # service redis start
 # chkconfig redis on
 
2.2.8 安装配置MySQL
 # yum install -y mysql-server
 # chkconfig mysqld on
 
# echo "CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';" | mysql -u root
 # echo "UPDATE mysql.user SET Password=PASSWORD('gitlab') WHERE User='root'; FLUSH PRIVILEGES;" | mysql -u root
 
2.2.9 安装配置GitLab
 # su - git -c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab"
 # su - git -c "cd gitlab;git checkout 5-0-stable"
 
# cd /home/git/gitlab
 # su git -c "cp config/gitlab.yml.example config/gitlab.yml"
 # sed -i "s/ host: localhost/ host: heydevops-node-2/g" config/gitlab.yml
 # sed -i "s/from: gitlab@localhost/from: gitlab@heydevops-node-2/g" config/gitlab.yml
 
2.2.10 创建Unicorn配置文件
 # su git -c "cp config/unicorn.rb.example config/unicorn.rb"
 
# sed -i "s/^listen/#listen/g" /home/git/gitlab/config/unicorn.rb
 # sed -i "s/#listen \"127.0.0.1:8080\"/listen \"127.0.0.1:3000\"/g" /home/git/gitlab/config/unicorn.rb
 
# su git -c "cp config/database.yml.mysql config/database.yml"
 # sed -i "s/secure password/gitlab/g" config/database.yml
 
# su git -c 'git config --global user.name "GitLab"'
 # su git -c 'git config --global user.email "gitlab@$GL_HOSTNAME"'
 
2.2.10 安装Gems
 # yum -y install libicu-devel
 # gem install charlock_holmes --version '0.6.9'
 
# yum -y install mysql-devel
 # su git -c "bundle install --deployment --without development test postgres"
 
# export force=yes
 # su git -c "bundle exec rake gitlab:setup RAILS_ENV=production"
 
# curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab-CentOS
 # chmod +x /etc/init.d/gitlab
 
# sed -i "17 a source /etc/profile.d/rvm.sh\nrvm use 1.9.3-p392" /etc/init.d/gitlab
 
# chkconfig gitlab on
 # service gitlab start
 
2.2.11 安装Apache
 # yum -y install httpd
 # chkconfig httpd on
 
# vim /etc/httpd/conf.d/gitlab.conf

ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
ProxyPreserveHost On

# setenforce 0
 
# service httpd start
 
2.2.12 停止iptables
 # service iptables stop
 
2.2.13 修复gitlab-shell
 # vim /home/git/gitlab-shell/bin/gitlab-shell
 将脚本的Ruby版本指向到ruby-1.9.3-p392

#!/usr/local/rvm/bin/ruby-1.9.3-p392
 
2.2.14 完成,剩下的GitLab使用步骤与2.1.6相同。

GitLab 的详细介绍请点这里
GitLab 的下载地址请点这里

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

linux
相关资讯       Gitlab  CentOS GitLab 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* topbean会员 发表于 2016/1/29 18:41:02
2.2.13 修复gitlab-shell
# vim /home/git/gitlab-shell/bin/gitlab-shell
将脚本的Ruby版本指向到ruby-1.9.3-p392

#!/usr/local/rvm/bin/ruby-1.9.3-p392