centos 7.9在线安装gitlab代码管理软件

1,配置yum源

cd /etc/yum.repos.d/
vim 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

2, 安装邮箱和相关依赖

yum install -y postfix curl policycoreutils-python openssh-server
systemctl enable sshd
systemctl start sshd
systemctl enable postfix
systemctl start postfix
yum install -y gitlab-ce  #将会安装gitlab最新版本

3, 配置gitlab登录的链接

[root@git-server ~]# vim /etc/gitlab/gitlab.rb
修改:
external_url 'http://服务器ip/或者外网ip' # 这个参数,将会是你的仓库访问地址
修改时区:
gitlab_rails['time_zone'] = 'Asia/Shanghai'
#这一段默认时注释的,找出来,将注释去掉  这一段是数据路径
git_data_dirs({
  "default" => {
    "path" => "/mnt/nfs-01/git-data"
   }
})
#这一段默认时注释的,找出来,将注释去掉  这一段是开启ssh服务
gitlab_rails['gitlab_shell_ssh_port'] = 22

4, 初始化gitlab

gitlab-ctl reconfigure

5, 启动gitlab,停止,重启

gitlab-ctl startgitlab-ctl stopgitlab-ctl restart

访问你配置的地址和端口,登录 注意,第一次登录会让你创建管理员root密码
创建项目即可

5, 为了安全性考虑,需要创建public key

ssh-keygen   #一路回车

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
48:94:9a:65:cd:0f:f3:17:c6:dc:3c:28:0a:bb:47:98 root@git-node1
The key's randomart image is:
+--[ RSA 2048]----+
|      .+   o +   |
|     .= = . * +  |
|     =.= * o . . |
|    o.E.o o .    |
|      .oS  .     |
|      . .        |
|       .         |
|                 |

复制id_rsa.pub公钥cat ~/.ssh/id_rsa.pub
将输出结果复制出来 添加到github的ssh-key中
剩下的就可以自己创建仓库,下载代码了,
关于git的使用,可以参看我的这篇博客 https://www.cnblogs.com/brightgreat/p/13681000.html
关于ubuntu系统下搭建gitlab,可以参看我的这篇博客 https://www.cnblogs.com/brightgreat/p/14567026.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS 7.9搭建GitLab服务器的步骤如下: 1. 更新系统:首先,使用命令“sudo yum update”来更新系统软件包。 2. 安装必要的依赖:执行以下命令安装Git和其他必要的依赖项: ``` sudo yum install curl policycoreutils openssh-server openssh-clients perl sudo systemctl enable sshd sudo systemctl start sshd sudo firewall-cmd --permanent --add-service=http sudo systemctl reload firewalld ``` 3. 添加GitLab软件源:使用以下命令添加GitLab的官方软件源: ``` curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash ``` 4. 安装GitLab:运行以下命令安装GitLab Community Edition(CE)或Enterprise Edition(EE): - 安装GitLab CE: ``` sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce ``` - 安装GitLab EE(需要许可证): ``` sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ee ``` 这里将`http://gitlab.example.com`替换为您的服务器的公共IP地址或域名。 5. 配置GitLab:编辑GitLab配置文件`/etc/gitlab/gitlab.rb`,根据需要设置外部URL和其他配置参数。例如,要使用HTTPS,可以取消注释并设置相应的证书和密钥路径。 6. 重新配置GitLab:运行以下命令重新配置GitLab: ``` sudo gitlab-ctl reconfigure ``` 7. 启动GitLab:执行以下命令启动GitLab: ``` sudo gitlab-ctl start ``` 8. 访问GitLab:使用浏览器访问服务器的公共IP地址或域名,在地址栏中输入之前设置的外部URL。 通过完成上述步骤,您应该能够在CentOS 7.9上成功搭建GitLab服务器。根据需要,您还可以配置其他功能,如用户管理、项目管理、权限设置等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值