设为首页 收藏本站
查看: 1062|回复: 0

[经验分享] centos 6.5安装GitLab安装

[复制链接]

尚未签到

发表于 2018-9-19 11:02:52 | 显示全部楼层 |阅读模式
设置mysql root账号的密码:  # mysqladmin -u root password '123456'
  创建新用户和数据库给gitlab使用
  # 登录数据库
  # mysql -u root -p
  # 输入root密码
  # 为gitlab创建使用用户

  CREATE USER 'gitlab'@'localhost'>  # 创建gitlaba使用的数据库
  CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
  # 给予gitlab用户权限

  GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,>  # 登出数据库
  \q
  6、安装GitLab
  将GitLab安装在git的家目录下:
  #su - git
  a、克隆GitLab并切换分支到6-3-stable
  # 克隆GitLab
  $ git clone https://github.com/gitlabhq/gitlabhq.git gitlab
  # 进入gitlab目录
  $ cd /home/git/gitlab
  # 切换到6-3-stable分支
  $ git checkout 6-3-stable
  b、配置项目
  复制配置文件
  $ cp config/gitlab.yml.example config/gitlab.yml
  修改配置文件中
  $ sed -i 's|localhost|192.169.1.171|g' config/gitlab.yml
  备注:192.168.1.171是我要安装的机器
  设定log和tmp目录所有者和权限
  $ chown -R git log/
  $ chown -R git tmp/
  $ chmod -R u+rwX log/
  $ chmod -R u+rwX tmp/
  创建gitlab-satellites目录
  $ mkdir /home/git/gitlab-satellites
  创建tmp/pids/和tmp/sockets/目录,确保gitlab有相应的权限
  $ mkdir tmp/pids/
  $ mkdir tmp/sockets/
  $ chmod -R u+rwX tmp/pids/
  $ chmod -R u+rwX tmp/sockets/
  创建public/uploads目录
  $ mkdir public/uploads
  $ chmod -R u+rwX public/uploads
  复制unicorn配置
  $ cp config/unicorn.rb.example config/unicorn.rb
  编辑resque.yml配置
  $ vim config/resque.yml
  development: redis://192.168.1.171:6379
  test: redis://192.168.1.171:6379
  production: redis://192.168.1.171:6379
  配置git的用户和邮件
  $ git config --global user.name "GitLab"
  $ git config --global user.email "bb@aa.com"(以你真实的域名填写)
  $ git config --global core.autocrlf input
  c、配置数据库访问文件
  $ cp config/database.yml.mysql config/database.yml
  编辑config/database.yml,设置其中连接数据库的账号密码,笔者的配置部分如下:
  # PRODUCTION
  #
  production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: gitlabhq_production
  pool: 10
  username: gitlab
  password: "123456"
  # host: localhost
  # socket: /tmp/mysql.sock
  修改其中username和password就可以了,其中密码就是上面数据库步骤中创建gitlab用户的密码。
  确保该文件只有git账号有权限读取。
  $ chmod o-rwx config/database.yml
  d、安装Gems
  $ su -
  # gem install charlock_holmes --version '0.6.9.4'
  # exit
  安装mysql包
  $ su - git
  $ cd /home/git/gitlab/
  $ bundle install --deployment --without development test postgres puma aws
  备注:
  [转]Could not find modernizr-2.6.2 in any of the sources 解决办法:
  [git@Git gitlab]$ vi Gemfile
  source "https://rubygems.org"改为source "http://rubygems.org"
  [git@Git gitlab]$ bundle install --deployment--without development test postgres
  Fetching source indexfrom http://rubygems.org/
  Fetchinghttps://github.com/gitlabhq/grit.git
  Could not findmodernizr-2.6.2 in any of the sources
  #出现错误:Could not find modernizr-2.6.2 in any of thesources
  #解决办法:
  [git@Git gitlab]$ vi Gemfile
  第114行   gem"modernizr",       "2.6.2"
  更改改为:
  第114行   gem "modernizr-rails",  "2.7.1"
  [git@Git gitlab]$ vi Gemfile.lock
  第252行     modernizr (2.6.2)
  更改改为:
  第252行     modernizr-rails (2.7.1)
  第523行   modernizr (= 2.6.2)
  更改改为:
  第523行   modernizr-rails (= 2.7.1)
  #重新执行:
  [git@Git gitlab]$ bundleinstall --deployment --without development test postgres puma aws
  e、初始化数据和激活高级功能
  $ cd /home/git/gitlab
  $ bundle exec rake gitlab:setup RAILS_ENV=production
  这步完成后,会生一个默认的管理员账号:
  admin@local.host
  5iveL!fe
  f、安装启动脚本
  # cd /home/git/gitlab
  # cp lib/support/init.d/gitlab /etc/init.d/
  # chmod +x /etc/init.d/gitlab
  设置logarate
  # cd /home/git/gitlab
  # cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
  # chkconfig --add gitlab
  开机时启动
  # chkconfig gitlab on
  g、检测应用程序状态
  $ su - git
  $ cd gitlab/
  $ bundle exec rake gitlab:env:info RAILS_ENV=production
  $ exit
  可以查看到系统、Ruby、GitLab和GitLabShell的版本和其他信息。
  启动GitLab实例
  $ service gitlab start
  h、查看应用更加详细的信息
  $ su - git
  $ cd gitlab/
  $ bundle exec rake gitlab:check RAILS_ENV=production
  7、安装web服务器
  选择的是nginx,
  $ su -
  # yum -y install nginx
  # chkconfig nginx on
  # mkdir /etc/nginx/sites-available
  # mkdir /etc/nginx/sites-enabled
  #cd /home/git/gitlab# cp lib/support/nginx/gitlab /etc/nginx/sites-available/
  # ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
  修改域名
  vim /etc/nginx/sites-enabled/gitlab
  server_name 192.168.1.171;
  修改nginx配置文件其中
  # Load configfiles from the /etc/nginx/conf.d directory
  # The defaultserver is in conf.d/default.conf
  #    include/etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
  }
  重启服务
  #/etc/init.d/nginx restart
  8 测试
  访问:http://192.168.1.171/



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-594183-1-1.html 上篇帖子: 安装部署gitlab ci-ly36843运维 下篇帖子: 本地搭建gitlab环境,配置邮件通知和基本操作
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表