Centos8 + Docker + 公司内网环境(需设置代理) 搭建 & 配置 Gitlab

Centos8 + Docker + GitLab


一、GitLab架构图:

根据图,一目了然的了解底层使用了哪些技术!(新版本使用Puma代替Unicorn)
在这里插入图片描述

二、Centos 8前期装备

1、设置IP地址,最好固定IP地址,连接外网,配置dnf或yum代理(建议后面不要更换IP,个别网页访问会失败)
#---------------------------------------------------------------------------------------------#
#centos 8 默认使用dnf代替了yum,原yum配置文件(/etc/yum.conf)默认链接到dnf配置文件(/etc/dnf/dnf.conf)
# vim /etc/dnf/dnf.conf # 修改成如下

[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
#best=True
proxy=http://Proxy_Ip:port
proxy_username=username
proxy_password=password

2、安装Gitlab所需要的依赖包(有则跳过这步):curl policycoreutils-python openssh-server openssh-clients
# dnf install -y curl policycoreutils-python openssh-server openssh-clients
3、启动sshd(远程进去的话,一般默认跳过这步)
# systemctl enable sshd     # 开机自启
# systemctl start sshd     # 启用sshd
4、防火墙开发使用到的http协议端口
# firewall-cmd --permanent --add-service=http——# 同 firewall-cmd --add-port=80/tcp --permanent # 更加端口自行更改
# systemctl reload firewalld  # 重新加载防火墙配置
5、更新系统的所有软件
# dnf update -y

三、安装docker 社区版(正式开始安装)

1.卸载旧版本docker

# dnf remove docker*

2.安装docker基础包

# dnf install -y yum-utils device-mapper-persistent-data lvm2

3.设置稳定仓库

# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

4.安装Docker Engine - Community --此命令会安装最新版本(latest)

# dnf install docker-ce docker-ce-cli containerd.io

5.可以安装指定版本

# dnf list docker-ce --showduplicates | sort -r  #查看版本
# sudo dnf install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.io #安装指定版本

6.配置开机自启及docker启动

# systemctl enable docker
# systemctl start docker

7.配置docker代理(非内网环境跳过)
①默认情况下这个配置文件夹并不存在,我们要创建它

# mkdir -p /etc/systemd/system/docker.service.d

②创建一个文件 vim /etc/systemd/system/docker.service.d/http-proxy.conf

# [Service]
# Environment="HTTP_PROXY=http://proxy.example.com:80/"

③如果有局域网或者国内的registry,我们还需要使用 NO_PROXY 变量声明一下

# [Service]
# Environment="HTTP_PROXY=http://proxy.example.com:80/" "NO_PROXY=localhost,127.0.0.1“

④刷新systemd配置:

# sudo systemctl daemon-reload

⑤用系统命令验证环境变量加上去没:

# systemctl show --property=Environment docker
Environment=HTTP_PROXY=http://proxy.example.com:80/

⑥更改docker默认的存储路径,将该字段修改为如下

# vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd --graph  /docker/docker

⑦重载和重启docker

# sudo systemctl enable docker
# sudo systemctl daemon-reload
# sudo systemctl restart docker
查看docker信息:Docker Root Dir值为修改后的路径
# sudo docker info

四、安装gitlab社区版(真正的正式开始安装)

1.获取gitlab镜像包

# docker pull gitlab/gitlab-ce
查看下载好的镜像包
# docker images
REPOSITORY                                TAG                 IMAGE ID            CREATED             SIZE
gitlab/gitlab-ce                          latest              8ab13771717b		2 weeks ago         2.04GB
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值