在服务器上搭建Gitlab服务

在服务器上搭建Gitlab服务

  1. 添加镜像 把文件下载到服务器上 命令如下:
    wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

执行完成之后展示如下:

Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 359519811 (343M) [application/x-redhat-package-manager]
Saving to: ‘gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm’

100%[=========================================================================================================================================================>] 359,519,811 9.15MB/s   in 36s    

2019-12-28 15:01:27 (9.63 MB/s) - ‘gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm’ saved [359519811/359519811]
  1. 安装命令
    rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

执行完成之后展示如下(这里会有警告和错误,需要安装依赖)

warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
error: Failed dependencies:
	policycoreutils-python is needed by gitlab-ce-10.0.0-ce.0.el7.x86_64
  1. 安装依赖命令
    yum install -y policycoreutils-python

  2. 再次执行安装命令

    rpm -i gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

执行完成之后 如下显示就意味着安装成功了:

warning: gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
It looks like GitLab has not been configured yet; skipping the upgrade script.

       *.                  *.
      ***                 ***
     *****               *****
    .******             *******
    ********            ********
   ,,,,,,,,,***********,,,,,,,,,
  ,,,,,,,,,,,*********,,,,,,,,,,,
  .,,,,,,,,,,,*******,,,,,,,,,,,,
      ,,,,,,,,,*****,,,,,,,,,.
         ,,,,,,,****,,,,,,
            .,,,***,,,,
                ,*,.
  


     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ \`/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

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
  1. 配置文件修改命令(指定服务器ip和自定义端口)
    vim /etc/gitlab/gitlab.rb
修改内容:
external_url 'http://10.11.1.149:8210/'
  1. 重置命令
    gitlab-ctl reconfigure
    执行完成之后展示如下:
Running handlers:
Running handlers complete
Chef Client finished, 360/515 resources updated in 01 minutes 52 seconds
gitlab Reconfigured!
  1. 重启命令
    gitlab-ctl restart

执行完成之后,展示如下:

ok: run: gitaly: (pid 9138) 1s
ok: run: gitlab-monitor: (pid 9157) 0s
ok: run: gitlab-workhorse: (pid 9161) 1s
ok: run: logrotate: (pid 9211) 0s
ok: run: nginx: (pid 9217) 1s
ok: run: node-exporter: (pid 9226) 0s
ok: run: postgres-exporter: (pid 9232) 0s
ok: run: postgresql: (pid 9243) 0s
ok: run: prometheus: (pid 9251) 0s
ok: run: redis: (pid 9261) 1s
ok: run: redis-exporter: (pid 9266) 0s
ok: run: sidekiq: (pid 9278) 0s
ok: run: unicorn: (pid 9287) 0s
[root@tunfishcms ~]# 
提示  "ok: run:"表示启动成功
  1. 访问我们搭建的Gitlab服务
    http://101.132.195.59:8210

第一次打开,提示修改密码,默认账号是root
在这里插入图片描述

mark:gitlab起好之后,可能访问不了,应该是服务器防火墙问题,我们需要把服务器防火墙进行关闭

// 启动防火墙
systemctl start firewalld.service
//重启防火墙
systemctl restart firewalld.service
// 关闭防火墙
systemctl stop firewalld.service
//查看当前防火墙状态
firewall-cmd --stat
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
好的,以下是在服务器上使用 Docker 搭建 GitLab 的步骤: 1. 首先安装 Docker 和 Docker Compose。 2. 创建一个目录,用于存储 GitLab 的配置和数据: ``` mkdir -p /srv/gitlab/config mkdir -p /srv/gitlab/data mkdir -p /srv/gitlab/logs ``` 3. 在该目录下创建一个 docker-compose.yml 文件,并添加以下内容: ``` version: '3' services: gitlab: image: gitlab/gitlab-ce:latest restart: always hostname: gitlab.example.com environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://gitlab.example.com' gitlab_rails['gitlab_shell_ssh_port'] = 2222 ports: - '80:80' - '443:443' - '2222:22' volumes: - '/srv/gitlab/config:/etc/gitlab' - '/srv/gitlab/logs:/var/log/gitlab' - '/srv/gitlab/data:/var/opt/gitlab' ``` 注意将 `hostname` 和 `external_url` 替换为你的域名或 IP 地址。 4. 启动 GitLab 容器: ``` cd /srv/gitlab/ docker-compose up -d ``` 这会下载 GitLab 镜像并启动容器。 5. 等待一段时间,直到 GitLab 完全启动。你可以使用以下命令查看 GitLab 容器的日志: ``` docker-compose logs -f gitlab ``` 如果看到类似 `Starting Chef Client, version ...` 的信息,说明 GitLab 正在启动。 6. 打开浏览器,访问 `http://gitlab.example.com`(将 `gitlab.example.com` 替换为你的域名或 IP 地址),即可进入 GitLab 的安装向导。按照向导的提示进行设置即可。 7. 安装完成后,你可以登录 GitLab 并创建项目了。 希望以上步骤能对你有所帮助。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值