Linux下安装配置gitlab

本教程采用CentOS7.0

一、准备安装GitLab

yum install -y postfix sshd policycoreutils-python

  • postfix 邮件通知
  • sshd ssh服务(一般系统已经有了,可以不装)
  • policycoreutils-python GitLab必备依赖

设置postfix开机自启: chkconfig --add postfix

二、开始安装GitLab

官网下载地址: gitlab/gitlab-ce - Results for '10.0.2' in gitlab/gitlab-ce

enter description here

安装方式2种: 使用yum 和 rpm包,本文介绍yum方式

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

yum install -y gitlab-ce-10.0.2-ce.0.el7.x86_64

三、配置GitLab

主要配置两个地方: 访问GitLab的IP地址发送邮件的账号配置

vim /etc/gitlab/gitlab.rb

external_url 'http://192.168.183.200' # 你自己的IP

### Email Settings
gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = '你的邮箱'
gitlab_rails['gitlab_email_display_name'] = '邮件名字'

### GitLab email server settings
### 这里邮件服务器使用的是QQ企业邮箱,163自行修改
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.exmail.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "你的邮箱"
gitlab_rails['smtp_password'] = "邮箱密码"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true

ESC保存并退出 :wq

四、启动GitLab

刷新配置: gitlab-ctl reconfigure
重启服务: gitlab-ctl restart

五、注意防火墙端口问题

当然防火墙对于我们来说比较重要,那么我们可不可以打开固定端口呢?
使用如下命令打开80端口(其他端口类似)

[root@localhost]# firewall-cmd --permanent --add-port=80/tcp
1
注意这里需要声明tcp的方式,之后我们需要重新加载firewall的配置

[root@localhost]# firewall-cmd --reload

六、常用命令

sudo gitlab-ctl start    # 启动所有 gitlab 组件;
sudo gitlab-ctl stop        # 停止所有 gitlab 组件;
sudo gitlab-ctl restart        # 重启所有 gitlab 组件;
sudo gitlab-ctl status        # 查看服务状态;
sudo gitlab-ctl reconfigure        # 启动服务;
sudo vim /etc/gitlab/gitlab.rb        # 修改默认的配置文件;
gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;
sudo gitlab-ctl tail        # 查看日志;

七、修改用户密码

//修改用户密码
gitlab-rails console production
user=User.where(email: 'zhan55823@126.com').first
user.password = 'qwe123456'
user.password_confirmation='qwe123456'
user.save!

八、自己装的Nginx与gitlab装的nginx有冲突时,可以禁用gitlab自带的nginx

九、备份与恢复

备份:gitlab-rake gitlab:backup:create

cd /var/opt/gitlab/backups/

恢复:

gitLab数据备份和恢复_gitlab备份与恢复-CSDN博客

gitlab 迁移服务器之后,ssh 的签名改变

https://www.cnblogs.com/heroljy/p/16034535.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值