CentOS及Ubuntu安装GitLab
安装方式有软件包安装和源代码安装 , 由于 GitLab 使用 Ruby 开发 , 从学习的角度上建议使用源代码安装 .
Ubuntu 软件包安装
安装关联软件
sudo apt-get install curl openssh-server ca-certificates postfix
下载安装包
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce
配置
sudo gitlab-ctl reconfigure
登陆
Username: root Password: 5iveL!fe
CentOS安装步骤
安装ruby
yum install ruby-2.0.0-p353
安装关联软件
sudo yum install openssh-server postfix cronie git.x86_64 openssh-server sshd
下载安装gitlab
curl -O https://downloads-packages.s3.amazonaws.com/centos-6.6/gitlab-7.5.1_omnibus.5.2.0.ci-1.el6.x86_64.rpm
sudo rpm -i gitlab-7.5.1_omnibus.5.2.0.ci-1.el6.x86_64.rpm
配置
配置ip
编辑 /etc/gitlab/gitlab.rb 文件 把第一行的
external_url ‘hostname’ 改为 external_url=’你的服务器ip地址’
nano /etc/gitlab/gitlab.rb
配置gitlab
sudo gitlab-ctl reconfigure
如果不报错,一直按enter键到最后
登陆及查看状态
默认密码
Username: root
Password: 5iveL!fe
查看运行状态
sudo gitlab-ctl status;
常见错误
Error executing action
Error executing action `create` on resource 'user[git]'”
git用户已经存在,删除git 用户
userdel git
URI::InvalidURIError
URI::InvalidURIError
--------------------
bad URI(is not URI?): ${external_url}
Cookbook Trace:
是因为/etc/gitlab/gitlab.rb文件中的内容是:
external_url 'hostname1'
将其修改为:
external_url='192.168.1.49'
gitlab 抢救记录
- install ubuntu
- install git step
- install postgresql 9.4
- rsync git repost…
- import data…
sudo -u postgres psql ALTER USER git WITH PASSWORD 'git';
ALTER DATABASE gitlabhq_production OWNER TO git;
sudo -u git -H bundle exec rake gitlab:import:repos RAILS_ENV=production
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
sudo -u git -H RAILS_ENV=production bin/background_jobs start
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production