centos7.x使用yum安装gitlab-ce_hotlinhao的博客-爱代码爱编程
1. 安装依赖库
yum install curl openssh-server postfix cronie -y
systemctl start postfix
systemctl enable postfix.service
2. 创建git用户
useradd git
3. 配置yum源
# vim /etc/yum.repos.d/gitlab-ce.repo
#输入以下内容
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
这里用的是清华大学的镜像源安装GitLab
然后生成一下yum的缓存,并使用yum安装。
yum makecache
yum install gitlab-ce #自动安装最新版
安装成功会有下面的提示:
Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure
For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
Help us improve the installation experience, let us know how we did with a 1 minute survey:
https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installation=omnibus&release=15-4
验证中 : gitlab-ce-15.4.1-ce.0.el7.x86_64 1/1
已安装:
gitlab-ce.x86_64 0:15.4.1-ce.0.el7
完毕!
4. 默认存放位置
代码仓库保存位置:/var/opt/gitlab/git-data/repositories/
代码仓库备份位置:/var/opt/gitlab/backups/
postgresql数据及配置目录:/var/opt/gitlab/postgresql/data/
redis默认配置目录:/var/opt/gitlab/redis
gitlab主要配置文件:/etc/gitlab/gitlab.rb
5. 设置gitlab访问地址:
#vim /etc/gitlab/gitlab.rb
#找到 external_url 改成你的地址和商品
external_url 'http://***ip地址或域名:81'
6. 初始化, 启用服务
#gitlab-ctl reconfigure
7. 设置root密码
执行完上面的代码,会有下面的提示信息:
Default admin account has been configured with following details:
Username: root
Password: You didn't opt-in to print initial root password to STDOUT.
Password stored to /etc/gitlab/initial_root_password. This file will be cleaned up in first reconfigure run after 24 hours.
根据提示信息root的密码默认保存在: /etc/gitlab/inital_root_password 中;
输入你在第5步中设置的密码:
8. 配置邮箱
可以翻一下我以前配置写的如何发送邮箱
9. 管理配置
登录后会收到上面的提示,是否要关闭公开 注册 ;点击上图中的:Turn Off然后如下图,关闭注册:
红圈处,取消选中。
10. 修改root密码
然后选择: Preferences
选择左侧的 Password就可以修改密码了。
11 . 添加用户
点击左上角的三条杠的菜单,选择Admin
选择左侧的Users 然后选择右侧的New user
(完)