centos6.5 x64 源码编译安装 gitlab7.9.2
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了centos6.5 x64 源码编译安装 gitlab7.9.2,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5253字,纯文字阅读大概需要8分钟。
内容图文
centos6.5 x64 安装 gitlab 7.9.2
安装 gitlab
注意,以下一到五 步骤 都需要用 root 用户操作
一:初始化安装环境
yum -ygroupinstall ‘Development Tools‘
yum -yinstall readline readline-devel ncurses-devel gdbm-devel glibc-develtcl-devel openssl-devel curl-devel expat-devel db4-devel byaccsqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2libxml2-devel libxslt libxslt-devel libicu libicu-develsystem-config-firewall-tui crontabs logwatch logrotateperl-Time-HiRes cmakelibcom_err-devel.i686 libcom_err-devel.x86_64 zlib-devel perl-CPANgettext gettext-devel
二:安装 GIT
确保 git 版本至少在 1.7.10 或以上,如果不是,卸载重装
yum -y remove git
mkdir /tmp/git && cd /tmp/git
curl --progress https://www.kernel.org/pub/software/scm/git/git-2.1.
3
.tar.gz | tar xz
cd git-2.1.3/
./configure
make
make prefix=/usr/local install
创建软连接
ln -s /usr/local/bin/git /usr/bin/git
三:安装 ruby
注意:请不要用 rvm 安装 ruby ,否则,后续会出现一些难以解决的问题
Gitlab 7 .x 需要 ruby2.x
如果系统自带的 ruby 版本低于 2.x ,就需要升级 ruby
yum remove ruby
或者
cd <your-ruby-source-path>
make uninstall
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.
5
.tar.gz | tar xz
cd ruby-2.1.2
./configure --disable-install-rdoc
make
make prefix=/usr/local install
安装 bundler
gem source-r https://rubygems.org/
gem source-a http://ruby.taobao.org/
gem install bundler --no-doc
四:系统配置
执行命令:
visudo
把 /usr/local/bin 加入到 secure_path 里面去
然后,配置 git 用户可以使用 sudo
如 git ALL=(ALL) ALL
五:配置 mysql
配置用户名,密码
创建数据库
CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
注意:这里选择了
mysql
,则还需要安装
mysql
的开发包
Y
um install
mysql-devel
数据库如果选择的是
pg
,则也需要安装
pg
的开发包
五:配置 redis
需要把 redis.conf 配置文件的
unixsocket/tmp/redis.sock
unixsocketperm7 77
这两项注释放开
R edis-serverredis.conf 启动 redis
执行 chmod777 /tmp/redis.sock
六: 安装 gitlab( 使用 git 用户 )
1
:
注意,这里必须用
git clone
下载
(在
git
用户家目录下执行)
,不要下载网上已经打包好的
tar.gz
文件,否则以后不能升级
git clone https://gitlab.com/gitlab-org/gitlab-ce.git gitlab
cd /home/git/gitlab (
注意目录位置,尽量使用默认的
)
然后,切换到你需要安装的版本上
这里安装的是 v 7.9.2
gitcheckout v 7.9.2 ( 注意这里是 tag)
gitcheckout -b gitlab- 7-9-2
2 :复制配置文件
cp config/gitlab.yml.example config/gitlab.yml
编辑
config/gitlab.yml
修改
host
为当前机器的
ip
地址
修改
port
为
gitlab
运行的端口地址,需要和下面的
unicorn.rb
配置的端口保持一致
cp config/unicorn.rb.example config/unicorn.rb
编辑
config/unicorn.rb
把
listen "127.0.0.1:8080"
改成
listen "8080"
cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
cp config/resque.yml.example config/resque.yml
修改
config/resque.yml
把
production
的值改成:
unix:/tmp/redis.sock
cp config/database.yml.mysql config/database.yml(
请注意自己使用的数据库类型
)
配置用户名,密码,数据库名称
3
:授权目录
chmod -R u+rwX tmp/pids/
chmod -R u+rwX tmp/sockets/
chmod -R u+rwX public/uploads
chown -R git log/
chown -R git tmp/
chmod -R u+rwX log/
chmod -R u+rwX tmp/
mkdir /home/git/gitlab-satellites
chmod u+rwx,g=rx,o-rwx /home/git/gitlab-satellites
mkdir tmp/backups
4 :配置 git
gitconfig --global user.name "GitLab"
gitconfig --global user.email "scm@xiangrikui.com"
gitconfig --global core.autocrlf input
5 :修改 Gemfile
vimGemfile
修改 source 为 http://ruby.taobao.org
加入下面的 gem
gem ‘therubyracer‘ gem ‘execjs‘
注意:如果系统中安装了 node.js ,则不需要添加这 2 个 gem
6
:
bundle install
bundle install --no-deployment --without development test postgres aws
中途如果不出意外的话,就安装完成
(
install
中途可能要提示输入密码)
如果
提示
类似下面的错误:
An error occurred while installing ace-rails-ap (2.0.1), and Bundler cannot continue.
Make sure that `gem install ace-rails-ap -v ‘2.0.1‘` succeeds before bundling.
类似这样的,需要手动安装的
gem ,
请手动安装,然后继续执行上面的
bundle install
7
:安装
gitlab-shell
(需要联网)
bundle exec rake gitlab:shell:install[v
2.6.0
] REDIS_URL=unix:/tmp/redis.sock
RAILS_ENV=production
chmod -R ug+rwX,o-rwx /home/git/repositories/
chmod -R ug-s /home/git/repositories/
find /home/git/repositories/ -type d -print0 | sudo xargs -0 chmod g+s
注意,
这里的
v2.6.0
要和
GITLAB_SHELL_VERSION
文件里面的版本号保持一致
unix:/tmp/redis.sock
要和
redis.conf
里面的配置
unixsocket
保持一致
8
:初始化数据库
bundle exec rake gitlab:setup RAILS_ENV=production
成功的话,会输出
Administrator account created:
login.........admin@local.host
password......5iveL!fe
记住这里的用户名和密码
9
:预编译
bundle exec rake assets:precompile RAILS_ENV=production
如果报了下面的错误
rake aborted!
Sprockets::FileNotFound: couldn‘t find file ‘jquery.ui.all‘
(in /home/git/gitlab/app/assets/javascripts/application.js.coffee:8)
则,需要修改
Gemfile
gem "jquery-ui-rails"
改成
gem "jquery-ui-rails", “4.0.2”
然后,重新执行上面的
bundle install
10
:拷
贝
启
动
脚本
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
然后通过 /etc/init.d/gitlab start,stop,restart 启动,关闭 gitlab 11 :验证启动服务:
/etc/init.d/gitlab start
观察
/home/git/gitlab/log
目录的日志,
bundle exec rake gitlab:check RAILS_ENV=production 修复这里输出的错误信息1
2
:登陆系统
输入
ip
和端口访问系统
用上面的用户名和密码登陆系统
然后,修改密
码
管理 gitlab
一: gitlab的备份与恢复
备份: bundleexec rake gitlab:backup:create RAILS_ENV=production
还原: bundleexec rake gitlab:backup:restore RAILS_ENV=production
二: gitlab的升级
升级的思路一般是:
(1)备份
(2)升级ruby
(3)gitpull(获取最新的gitlab源代码,所以说安装的时候,就要用git获取源代码)
(4)执行一些其他的配置
每个版本升级到最新版,配置都不一样,具体升级请看
https://gitlab.com/gitlab-org/gitlab-ce/tree/master/doc/update
原文:http://blog.csdn.net/mn960mn/article/details/45579127
内容总结
以上是互联网集市为您收集整理的centos6.5 x64 源码编译安装 gitlab7.9.2全部内容,希望文章能够帮你解决centos6.5 x64 源码编译安装 gitlab7.9.2所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。