温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

centos7.x搭建gitlab9.2.2

发布时间:2020-06-05 18:35:42 来源:网络 阅读:1040 作者:yanconggod 栏目:建站服务器

1、介绍

GitLab 是一个用于仓库管理系统的开源项目。

2、官方硬件介绍配置

CPU

1 核心CPU最多支持100个用户,所有的workers和后台任务都在同一个核心工作这将导致GitLab服务响应会有点缓慢。

2 核心 支持500用户,这也是官方推荐的最低标准。

4 核心支持2,000用户。

8 核心支持5,000用户。

16 核心支持10,000用户。

32 核心支持20,000用户。

64 核心支持40,000用户。

如果想支持更多用户,可以使用 集群式架构


Memory

安装使用GitLab需要至少4GB可用内存(RAM + Swap)! 由于操作系统和其他正在运行的应用也会使用内存, 所以安装GitLab前一定要注意当前服务器至少有4GB的可用内存. 少于4GB内存会导致在reconfigure的时候出现各种诡异的问题, 而且在使用过程中也经常会出现500错误.


最后官方最后的提醒:

1GB 物理内存 + 3GB 交换分区 是最低的要求,但我们 强烈反对 使用这样的配置。 查看下面unicorn worker章节获取更多建议。

2GB 物理内存 + 2GB 交换分区 支持100用户,但服务响应会很慢。

4GB 物理内存 支持100用户,也是 官方推荐 的配置。

8GB 物理内存 支持 1,000 用户。

16GB 物理内存 支持 2,000 用户。

32GB 物理内存 支持 4,000 用户。

64GB 物理内存 支持 8,000 用户。

128GB 物理内存 支持 16,000 用户。

256GB 物理内存 支持 32,000 用户。

如果想支持更多用户,可以使用 集群式架构



关于官网的unicorn我并未详细查阅,都是英文,看起来非常吃力!


3、GitLab服务构成

GitLab由以下服务构成:


nginx:静态Web服务器

gitlab-shell:用于处理Git命令和修改authorized keys列表

gitlab-workhorse:轻量级的反向代理服务器

logrotate:日志文件管理工具

postgresql:数据库

redis:缓存数据库

sidekiq:用于在后台执行队列任务(异步执行)

unicorn:An HTTP server for Rack applications,GitLab Rails应用是托管在这个服务器上面的。


经我统计,一共8个组件。


4、官方的推荐安装方式

1、安装配置依赖项

如想使用Postfix来发送邮件,在安装期间请选择'Internet Site'. 您也可以用sendmai或者 配置SMTP服务 并 使用SMTP发送邮件.

在 Centos 6 和 7 系统上, 下面的命令将在系统防火墙里面开放HTTP和SSH端口.

sudo yum install curl policycoreutils openssh-server openssh-clients git -y
sudo systemctl enable sshd
sudo systemctl start sshd
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld


2. 添加GitLab仓库,并安装到服务器上

curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install gitlab-ce
如果你不习惯使用命令管道的安装方式, 你可以在这里下载 安装脚本 或者 手动下载您使用的系统相应的安装包(RPM/Deb) 然后安装

curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-XXX.rpm
curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.2.2-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-9.2.2-ce.0.el7.x86_64.rpm 
rpm -i gitlab-ce-XXX.rpm

3. 启动GitLab

sudo gitlab-ctl reconfigure

4. 使用浏览器访问GitLab

首次访问GitLab,系统会让你重新设置管理员的密码,设置成功后会返回登录界面.

默认的管理员账号是root,如果你想更改默认管理员账号,请输入上面设置的新密码登录系统后修改帐号名.

 参数配置和故障排查请查看 Omnibus GitLab 文档 
 GitLab-CE中国镜像源 清华大学TUNA开源镜像站, 浙江大学开源镜像站
 
 
 
 

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://localhost
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab: 
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab: 
It looks like GitLab has not been configured yet; skipping the upgrade script.

gitlab所有的工程目录都在/var/opt/gitlab/下,你可以在这个目录看到他们所有的组件


5、更改gitlab配置

vim /etc/gitlab/gitlab.rb

#修改GitLab配置文件中的external_url,修改这个配置会影响GitLab里面显示的仓库链接
external_url 'http://gitlab.abc.com'
 
#时间区域,但是我修改这个时区后无法正常访问,失败原因为查询
gitlab_rails['time_zone'] = 'Asia/Shangha' 

#修改gitlab数据存储路径
git_data_dirs({ "default" => { "path" => "/data/gitlab_data"}})

#设置nginx监控端口,访问的时候是http://gitlab.abc.com:9000
nginx['listen_port'] = 9000

#Gitlab 修改备份文件默认目录
gitlab_rails['backup_path'] = '/data/gitlab_backups'

#163邮箱配置
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.163.com"
gitlab_rails['smtp_port'] = 25
gitlab_rails['smtp_user_name'] = "xxx@163.com"
gitlab_rails['smtp_password'] = "xxxxxx"
gitlab_rails['smtp_domain'] = "163.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['gitlab_email_from'] = 'xxx@163.com'
gitlab_rails['gitlab_email_display_name'] = 'Gitlab'


6、启动gitlab

sudo gitlab-ctl reconfigure
sudo gitlab-ctl start

启动后,登陆web界面,记得使用管理员账号关闭开放注册认证sign-up,禁止别人注册使用。

7、gitlab备份

Gitlab 创建备份,会在备份目录/data/gitlab_data下生成tar文件

gitlab-rake gitlab:backup:create

8、gitlab常用命令

查看服务状态
$ sudo gitlab-ctl status

启动服务
$ sudo gitlab-ctl start

关闭服务
$ sudo gitlab-ctl stop

重启服务
$ sudo gitlab-ctl restart

设置完配置后重新加载配置
$ sudo gitlab-ctl reconfigure

查看nginx日志
gitlab-ctl tail nginx/gitlab_access.log

9、汉化

#汉化
https://gitlab.com/xhang/gitlab

10、不小心把signin登陆窗口关闭了,可以使用这个办法解决

#Gitlab - 如何解決 "No authentication methods configured on login page" ? (gitlab version : 9.2.2)  
sudo gitlab-psql -l 查看資料庫列表
gitlab-psql gitlabhq_production
UPDATE application_settings set signin_enabled=true;
\q
sudo gitlab-ctl restart


参考:

https://www.gitlab.com.cn/downloads/#centos7 

http://www.jianshu.com/p/a22eaa1fcfe7

https://docs.gitlab.com.cn/ce/install/requirements.html

https://bbs.gitlab.com.cn

https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI