UbuntuServer 22.04.4安装GitLab


一、安装GitLab

1. 安装和配置所需的依赖
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
2. 如果要使用 Postfix 来发送电子邮件通知,执行以下安装命令。(可选)
sudo apt-get install -y postfix
3. 添加GitLab官方仓库并安装GitLab包:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
4. 开始安装gitlab,GitLab会自动配置。您也可以配置通过浏览器访问http://your-domain.com或ip来进行访问
sudo EXTERNAL_URL="http://your-domain.com" apt-get install gitlab-ce
5. 更新配置,并启动gitlab服务
sudo gitlab-ctl reconfigure

二、配置防火墙

1. 启用防火墙,允许80443端口,执行如下命令:在配置GitLab之前,需要确保防火墙规则
sudo ufw allow http
sudo ufw allow https
sudo ufw allow OpenSSH
2. 防火墙ufw常用命令如下所示
sudo ufw status # 查看防火墙当前状
sudo ufw enable # 启用ufw,默认情况下,ufw是禁用的
sudo ufw disable # 禁用ufw
sudo ufw reload # 重启ufw

三、常用命令

sudo gitlab-ctl start # 启动 gitlab
sudo gitlab-ctl restart # 重新GitLab
sudo gitlab-ctl stop # 停止 gitlab
sudo gitlab-ctl status # 查看gitlab服务状态
sudo gitlab-ctl tail # 查看Gitlab日志
sudo vim /etc/gitlab/gitlab.rb #修改默认的配置文件
sudo systemctl enable gitlab-runsvdir.service #设置开机启动

四、配置登录用户密码

登入GitLab Web页面的第一件事就是更改密码,sudo vi /etc/gitlab/initial_root_password文件中的密码24小时后将被清理
(1).登入GitLab Web页面的第一件事就是更改密码,/etc/gitlab/initial_root_password文件中的密码24小时后将被清理
(2).进入gitlab后:"Check your sign-up restrictions",点击"Deactivate",禁止其他人注册账号
(3).192.168.18.215为ubuntu的ip,其他同一网段的电脑输入此地址也可登入GitLab
(4).clone代码时:使用ip地址而不能是url,还未定位原因

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

NPC程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值