安装并配置必要的依赖关系
打开系统防火墙 HTTP 和 SSH 的访问,使用如下命令
sudo yum install curl policycoreutils openssh-server openssh-clients
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
RPM安装GitLab
curl -LJO https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-XXX.rpm
rpm -i gitlab-ce-XXX.rpm
其中,xxx代表对应的gitlab版本,不清楚gitlib-ce版本可以访问镜像列表https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7去获取下载
配置并启动 GitLab
sudo gitlab-ctl reconfigure
通过浏览器访问上一步配置的域名
第一次访问 GitLab,系统会重定向 url 到重置密码的页面,你需要输入初始化管理员账号的密码。 设置完成后,系统会重定向到登录界面,你就可以使用刚才输入的密码登录系统了。
添加Group组与新建project
添加组,new group, 设置group path、group name、description后,再设置Visibility Level(访问级别)为private后,则该组为私有组,非组员看到该组的项目。添加组员,点击右上角搜索框右侧的admin area跳转管理员界面,选择组后,可以对改组添加组员,设置组员角色。添加项目,new project,设置project path,project name,description后,设置访问级别为private后,生成git地址,本地clone后即可提交项目到gitlab中。
注意事项
服务器重启时,GitLab有可能也需要重新启动,启动命令:
sudo gitlab-ctl start