centos7安装gitlab

安装 yum install -y curl policycoreutils openssh-server openssh-clients postfix systemctl start postfix

  wget http://blog.xixihao123.cn/download/soft/gitlab-ce-12.0.3-ce.0.el7.x86_64.rpm

  wget http://blog.xixihao123.cn/download/soft/gitlab-12-0-stable-zh.tar.gz

   rpm -ivh gitlab-ce-12.0.3-ce.0.el7.x86_64.rpm

 更改配置  

 vim /etc/gitlab/gitlab.rb

  external_url ‘http://192.168.1.171‘

3.配置Gitlab服务、访问域名以及邮箱。*

  ```bash
  vim /etc/gitlab/gitlab.rb
  external_url ‘http://gitlab.oldxu.com‘
  
  
  #配置邮箱
  #2.Email Settings
  gitlab_rails[‘gitlab_email_enabled‘] = true
  gitlab_rails[‘gitlab_email_from‘] = ""  # 发件邮箱
  gitlab_rails[‘gitlab_email_display_name‘] = ‘OldXu-GitLab‘ # 发件人显示名称
  
  gitlab_rails[‘smtp_enable‘] = true
  gitlab_rails[‘smtp_address‘] = "smtp.qq.com"
  gitlab_rails[‘smtp_port‘] = 465
  gitlab_rails[‘smtp_user_name‘] = "" #发件人邮箱账户
  gitlab_rails[‘smtp_password‘] = "nvguuktrefkmbcbe"  #发件人邮箱客户端授权码
  gitlab_rails[‘smtp_domain‘] = "qq.com"
  gitlab_rails[‘smtp_authentication‘] = "login"
  gitlab_rails[‘smtp_enable_starttls_auto‘] = true
  gitlab_rails[‘smtp_tls‘] = true
  ```
 
* *4.初始Gitlab服务、启动Gitlab服务。*

  ```bash
  [ ~]# gitlab-ctl reconfigure
  [ ~]# gitlab-ctl start | restart | status | stop
  
  #ps: 每次修改/etc/gitlab/gitlab.rb 都需要  reconfigure
  ```

* *5.gitlab汉化?*    https://gitlab.com/xhang/gitlab

```
[ ~]# tar xf gitlab-12-0-stable-zh.tar.gz
[ ~]# gitlab-ctl stop
\cp -r gitlab-12-0-stable-zh/* /opt/gitlab/embedded/service/gitlab-rails/
[ ~]# gitlab-ctl start
```
 
* 1.创建组

  * 2.创建项目--->项目隶属于某个组

    ![1566116937419](git jenkins.assets/1566116937419.png)

  * 3.创建用户,设定密码,为用户分配组

  * 4.关闭gitlab注册功能
  * ![1566117547491](git jenkins.assets/1566117547491.png)

  * gitlab基本使用?

    ![1566118806034](git jenkins.assets/1566118806034.png)

  * gitlab 基本运维   备份 恢复 升级?

    ```
    1) 修改默认存放备份站点目录,然后进行重新加载配置文件。
    
    [ ~]# vim /etc/gitlab/gitlab.rb
    ...
    gitlab_rails[‘backup_path‘] = "/data/gitlab/backups"  #备份路径变更
    gitlab_rails[‘backup_keep_time‘] = 604800           #备份保留7天
    ...
    
    [ ~]# gitlab-ctl reconfigure
    
    2)|手动执行备份命令,会将备份的结果存储至/data/gitlab/backups目录中
    [ ~]# gitlab-rake gitlab:backup:create
    
    [ ~]# crontab -l
    00 02 * * *  gitlab-rake gitlab:backup:create &>/dev/null
    
    
    # 恢复gitlab数据
    1) 停止数据写入服务
    [ ~]# gitlab-ctl stop unicorn
    [ ~]# gitlab-ctl stop sidekiq
    
    2) 恢复数据(不需要备份的_gitlab_backup.tar)
    [ ~]# gitlab-rake gitlab:backup:restore BACKUP=1566120123_2019_08_18_12.0.3

相关推荐