参考:Ubuntu 20.04下的安装gitlab-ce
参考:How to reset user password
参考:Gitlab系列九之取消用户注册页面和删除用户
参考:GITLAB本地搭建后用户(默认)头像不显示问题
安装步骤
1 更新apt源
apt update
2 安装依赖项
## Postfix Configuration 选择 No configuration 就好
apt-get install curl openssh-server ca-certificates postfix
3 安装wget
apt-get install wget
4 下载gitlab-ce软件包
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/focal/main/g/gitlab-ce/gitlab-ce_13.2.3-ce.0_amd64.deb
5 安装软件
dpkg -i gitlab-ce_13.2.3-ce.0_amd64.deb
6 修改外部url
## 本机的局域网ip地址为172.16.129.170,根据自己的修改
external_url 'http://172.16.129.170'
7 重新配置gitlab
## 此过程可能需要较长时间
gitlab-ctl reconfigure
8 重启gitlab
gitlab-ctl restart
9 访问测试
使用浏览器访问页面http://172.16.129.170,本机的局域网ip地址为172.16.129.170,推荐使用Chrome浏览器,根据自己的实际局域网ip调整。
复位Gitlab用户密码
有时候Gitlab搭建完并不会出现直接root用户输入新密码的界面,此时就需要在Ubuntu下复位root用户的密码。
1. Start a Rails console
注意Gitlab版本,命令可能有所不同。
2. Find the user either by username, user ID or email ID:
user = User.find_by_username 'exampleuser' #'root'
#or
user = User.find(123)
#or
user = User.find_by(email: 'user@example.com')
3. Reset the password
user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'
4. Save the changes:
user.save!
5. Exit the console, and then try to sign in with your new password.
取消用户注册页面和删除用户
取消用户注册页面
Admin Area—>Settings—>Sign-up enabled(取消前面的勾)—save
删除用户
GITLAB本地搭建后用户(默认)头像不显示问题
1. 图例
2. 编辑GITLAB的配置文件/ETC/GITLAB/GITLAB.RB
在/etc/gitlab/gitlab.rb中找到如下两行关于Gravatar的配置
如果我们不开启https的话,用http就可以了,配置文件增加如下所示的plain_url ~~~ 修改为:
gitlab_rails['gravatar_plain_url'] = 'http://cdn.libravatar.org/avatar/%{hash}?s=%{size}&d=identicon'
#gitlab_rails['gravatar_plain_url'] = 'https://seccdn.libravatar.org/avatar/%{hash}?s=%{size}&d=identicon'
官方https://docs.gitlab.com/ee/administration/libravatar.html为我们提供了两种解决方案,一种是http一种是https:
3、停止GITLAB服务–gitlab-ctl stop
4、重新加载配置文件 启动GITLAB服务–gitlab-ctl reconfigure
5、配置加载正常后重新启动服务–gitlab-ctl start
6、配置加载正常后重新启动服务–gitlab-ctl restart
7、查看GITLAB启动状态–gitlab-ctl start–ps aux|grep gitlab