Centos7安装gitlab

环境准备:


操作系统:Centos7

内存:2G以上

磁盘:50G

安全:关闭防火墙,selinux


1、安装GitLab所需依赖

bash 复制代码
 yum -y install policycoreutils openssh-server openssh-clients postfix

2、设置postfix开机自启

bash 复制代码
 sudo systemctl enable postfix
 sudo systemctl start postfix
 sudo systemctl status postfix

3. 安装GitLab仓库(可选)

bash 复制代码
 # 为了方便安装,你可以添加GitLab的官方仓库。
 curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

4. 安装GitLab CE(社区版)

bash 复制代码
 sudo EXTERNAL_URL="http://192.168.131.128" yum install -y gitlab-ce-12.0.3-ce.0.el7.x86_64

5. 配置GitLab

bash 复制代码
 # 编辑配置文件
 sudo vim /etc/gitlab/gitlab.rb
 ​
 # 修改以下参数(根据实际需求调整):
 external_url 'http://192.168.131.128:8181'  # 设置访问地址和端口
 git_data_dirs({ "default" => { "path" => "/data/gitlab/data" } })  # 自定义仓库存储路径(需提前创建目录)
 ​
 # 保存并退出后,重载配置
 sudo gitlab-ctl reconfigure

6. 启动 GitLab 服务

bash 复制代码
 # 启动 GitLab
 sudo gitlab-ctl start
 ​
 # 检查服务状态
 sudo gitlab-ctl status

 #gitlab管理命令
 gitlab-ctl start
 gitlab-ctl stop
 gitlab-ctl stop postgresql
 gitlab-ctl restart
 gitlab-ctl status
 gitlab-ctl reconfigure    #配置重载
 gitlab-ctl tail           #查看服务日志
 gitlab-ctl tail redis 

7. 访问 GitLab

bash 复制代码
在浏览器中访问 http://192.168.131.128。

首次登录时,设置管理员密码(用户名默认为 root)。

初始密码可通过以下命令查看(24 小时后失效):

sudo cat /etc/gitlab/initial_root_password

8. gitlab汉化配置

汉化地址:https://gitlab.com/xhang/gitlab

登录 GitLab。 点击右上角头像 → Preferences。 滚动到 Localization 部分,选择 简体中文。 保存并刷新页面。

相关推荐
OpenMiniServer5 小时前
AI + GitLab + VSCode:下一代开发工作流的革命性集成
人工智能·vscode·gitlab
OpenMiniServer6 小时前
GitLab AI革命:如何将智能开发融入你的DevOps工作流
人工智能·gitlab·devops
慧一居士2 天前
Gitea和GitLab对比
运维·gitlab·gitea
企鹅郁金香2 天前
Gitlab和Gerrit部署后的工作(二)
数据库·gitlab·gerrit域名无法修改·激活gitlab·gitlab注册ldap·nginx反向代理gitlab·nginx反向代理gerrit
企鹅郁金香4 天前
使用Docker部署Gitlab和Gerrit (一)
docker·容器·gitlab·gerrit部署
Java 码农5 天前
gitlab gitrunner springboot 多环境多分支部署 (非容器方式,使用原生linux 环境)
linux·spring boot·gitlab
Java 码农5 天前
GitLab + GitLab Runner + Spring Cloud Alibaba 多环境多分支容器化部署方案(docker)
docker·容器·gitlab
毋若成6 天前
公司小白第一课:DACS、gitlab、AI提问词
ai·gitlab·dacs
石工记6 天前
Ubuntu 2024 Docker-Compose部署GitLab+MySQL 8.0保姆式方案
ubuntu·docker·gitlab
tzhou6445211 天前
搭建Jenkins+GitLab持续集成环境
ci/cd·gitlab·jenkins