安装gitlab

sudo yum install -y curl openssh-server openssh-clients cronie
sudo lokkit -s http -s ssh

curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install -y gitlab-ce

sudo gitlab-ctl reconfigure

完成后有下面几处要进行更改:

[root@centos3 ~]# vim /etc/gitlab/gitlab.rb

external_url 'http://192.168.2.22'    #设置git地址
gitlab_rails['backup_path'] = "/date/gitlab/backups"   #设置备份的目录。
# git_data_dirs({
#   "default" => {
#     "path" => "/mnt/nfs-01/git-data",
#     "failure_count_threshold" => 10,
#     "failure_wait_time" => 30,
#     "failure_reset_time" => 1800,
#     "storage_timeout" => 5
#    }
# })

创建备份:

gitlab-rake gitlab:backup:create

执行完成后,就备份成功,在备份目录下回有个.,tar的包:

image.png

备份恢复:

gitlab-rake gitlab:backup:restore BACKUP=1503886015_2017_08_28_9.5.1

注意:BACKUP的值取的是备份包1503886015_2017_08_28_9.5.1_gitlab_backup.tar的“_gitlab_backup.tar”前面的部分,这样就恢复到指定的版本,上面的备份可以写一个定时任务,定时执行。

安装完成后 ,去另外的机器上执行:ssh -Tv [email protected],如果连接成功,那就ok,然后配置sshconfig
vim ~/.ssh/config

Host 10.40.2.22
RSAAuthentication yes
IdentityFile ~/.ssh/config/private-key-filename-01

如果不加上面的这段,git clone http://10.40.2.22/soa/gbl.git没有问题,但是git clone [email protected]:soa/gbl.git,会报错ssh链接呗拒绝,还有必须是git的版本是2.0以上,硬性要求,不然 clone的时候会爆401认证的问题,没法clone代码

新版的页面改动比较大:
ssh认证

安装gitlab_第1张图片
image.png
安装gitlab_第2张图片
image.png

user group project添加:

安装gitlab_第3张图片
image.png

新用户设置密码:
新创建用户liujiang,设置密码:

安装gitlab_第4张图片
image.png

group组人员权限变更:

安装gitlab_第5张图片
image.png
image.png

安装gitlab_第6张图片
image.png

设置项目管理者:

安装gitlab_第7张图片
image.png

这个置顶用户成为owner ,就可以对这个组进行用户的添加和删除

修改gitlab时区:

[root@liujiangbu gitlab]# vim /etc/gitlab/gitlab.rb
# gitlab_rails['time_zone'] = 'UTC'
gitlab_rails['time_zone'] = 'Asia/Shanghai'

### Email Settings
# gitlab_rails['gitlab_email_enabled'] = true

gitlab-ctl reconfigure

合并:

安装gitlab_第8张图片
image.png

命令行修改密码:
(http://docs.gitlab.com/ce/security/reset_root_password.html#how-to-reset-your-root-password)

Log into your server with root privileges. Then start a Ruby on Rails console.

Start the console with this command:

gitlab-rails console production

Wait until the console has loaded.

There are multiple ways to find your user. You can search for email or username.

user = User.where(id: 1).first

or

user = User.find_by(email: '[email protected]')

Now you can change your password:

user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'

It's important that you change both password and password_confirmation to make it work.

Don't forget to save the changes.

user.save!

你可能感兴趣的:(安装gitlab)