Gitlab代码托管服务器安装
Gitlab简介
官网: https://about.gitlab.com/
GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。
GitLab和GitHub一样属于第三方基于Git开发的作品,免费且开源(基于MIT协议),与Github类似,可以注册用户,任意提交你的代码,添加SSHKey等等。不同的是,GitLab是可以部署到自己的服务器上,数据库等一切信息都掌握在自己手上,适合团队内部协作开发,你总不可能把团队内部的智慧总放在别人的服务器上吧?简单来说可把GitLab看作个人版的GitHub。
Gitlab安装
- 安装相关依赖
yum -y install policycoreutils openssh-server openssh-clients postfix
- 启动ssh服务&设置开机启动
systemctl enable sshd && sudo systemctl start sshd
- 设置postfix开机自启,并启动,postfix支持gitlab发信功能
systemctl enable postfix && systemctl start postfix
- 开放ssh以及http服务,然后重新加载防火墙列表
firewall-cmd --add-service=ssh --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --reload
如果关闭防火墙就不需要做以上配置
- 下载gitlab包,并且安装
在线下载安装包:
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-12.4.2-ce.0.el6.x86_64.rpm
安装:
rpm -i gitlab-ce-12.4.2-ce.0.el6.x86_64.rpm
- 修改gitlab配置
vi /etc/gitlab/gitlab.rb
修改gitlab访问地址和端口,默认为80,我们改为82
external_url ’ http://192.168.66.100:82’
nginx[‘listen_port’] = 82
- 重新配置及启动gitlab
gitlab-ctl reconfigure
gitlab-ctl restart
- 把端口添加到防火墙
firewall-cmd --zone=public --add-port=82/tcp --permanent
firewall-cmd --reload
启动成功后,看到以下修改管理员root密码的页面,修改密码后,然后登录即可
Gitlab添加组、创建用户、创建项目
- List item