CentOS7下Gitlab安装
系统环境:
CentOS7_64位
内存:2GB+(一定要2G以上,否则无法进入gitlab后台)
官方下载地址:
https://packages.gitlab.com/gitlab/gitlab-ce
清华大学镜像源下载地址:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/
一、安装准备
这里搭建实验选择下载目前官方的最新包:
[[email protected] opt]# wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-11.7.5-ce.0.el7.x86_64.rpm/download.rpm
安装依赖包:
[[email protected] opt]# yum install curl openssh-server openssh-clients policycoreutils policycoreutils-python
确保sshd服务启动:
[[email protected] opt]# systemctl enable sshd
[[email protected] opt]# systemctl start sshd
安装postfix发送通知邮件(可跳过):
[[email protected] opt]# yum install postfix
[[email protected] opt]# systemctl enable postfix
[[email protected] opt]# systemctl start postfix
配置系统防火墙,开启HTTP:
[[email protected] opt]# firewall-cmd --permanent --add-service=http
[[email protected] opt]# systemctl reload firewalld
二、安装配置Gitlab-ce
[[email protected] opt]# rpm -ivh gitlab-ce-11.7.5-ce.0.el7.x86_64.rpm
安装成功,gitlab 程序的默认安装路径是 /opt/gitlab,gitlab 的配置文件位置在 /etc/gitlab/gitlab.rb。
修改配置文件内容,配置仓库地址:
[[email protected] opt]# vim /etc/gitlab/gitlab.rb
......
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlabexternal_url 'http://192.168.10.142'
......
使配置生效:
# gitlab-ctl reconfigure #每次更改配置必须执行
重新启动gitlab服务:
# gitlab-ctl restart
浏览器使用 http://192.168.10.142 顺利访问 gitlab,跳转到登录界面,首次登陆需要修改root管理员密码:
修改密码后再次登陆: