|NO.Z.00011|——————————|^^ 部署 ^^|——|CI/CD&GitLab部署 .V01|——|GitLab.Server部署|初始化|

一、基础环境配置
### --- 基础环境配置
~~~     关闭防火墙、selinux
~~~     开启postfix服务
~~~     开启Postfix服务并设置开机自启动

[root@server11 ~]# systemctl start  postfix
[root@server11 ~]# systemctl enable postfix
### --- 安装gitlab依赖包
~~~     gitlab-ce 10.x.x以后的版本需要依赖policycoreutils-python
~~~     centos7:

[root@server11 ~]# yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python
~~~     centos8:

[root@server11 ~]# yum install -y curl openssh-server openssh-clients postfix cronie  policycoreutils-python-utils
二、部署gitlab server
### --- 添加gitlab.repo源

[root@server11 ~]# curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
 [root@server11 ~]# ll /etc/yum.repos.d/
-rw-r--r--  1 root root  773 Mar 28 12:29 gitlab_gitlab-ce.repo
### --- 更改为清华repo源

[root@server11 ~]# vim /etc/yum.repos.d/gitlab_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
### --- 安装gitlab

[root@server11 ~]# yum -y install gitlab-ce          # 自动安装最新版
[root@server11 ~]# yum -y install gitlab-ce-x.x.x    # 安装指定版本Gitlab
### --- 查看gitlab版本

[root@server11 ~]# head -1 /opt/gitlab/version-manifest.txt 
gitlab-ce 13.10.0

三、gitlab配置
### --- 配置gitlab登录连接
~~~     设置登录链接

[root@server11 ~]# vim /etc/gitlab/gitlab.rb
~~~     没有域名,可以设置为本机IP地址

external_url 'http://10.10.10.11'
[root@server11 ~]# grep "^external_url" /etc/gitlab/gitlab.rb
external_url 'http://10.10.10.11'               # 绑定监听的域名或IP
~~~     配置语言环境:gitlab要求语言环境为英文环境,必须切换,
~~~     语言环境问题:如果碰到之后的解决方案如下,需要重新登录

[root@server11 ~]#  echo "export LC_ALL=en_US.UTF-8"  >>  /etc/profile
### --- 如果上面的方案不可以,再使用下面的方案:   

[root@server11 ~]# yum install langpacks-zh_CN langpacks-en langpacks-en_GB -y
[root@server11 ~]# cat > /etc/profile.d/locale.sh<<-EOF
>  export LANG=en_US.UTF-8
>  export LANGUAGE=en_US.UTF-8
>  export LC_COLLATE=C
>  export LC_CTYPE=en_US.UTF-8
> EOF
### --- 使配置文件生效
~~~     退出终端重新登陆

[root@server11 ~]# source /etc/profile.d/locale.sh
四、gitlab初始化
### --- gitlab初始化
~~~     第一次初始化时间有点长

[root@server11 ~]# gitlab-ctl reconfigure 
.....
### --- 启动gitlab服务

[root@server11 ~]# gitlab-ctl start
ok: run: alertmanager: (pid 21206) 89s
ok: run: gitaly: (pid 21172) 93s
ok: run: gitlab-exporter: (pid 21171) 93s
ok: run: gitlab-workhorse: (pid 21143) 94s
ok: run: grafana: (pid 21299) 88s
ok: run: logrotate: (pid 20574) 263s
ok: run: nginx: (pid 20551) 274s
ok: run: node-exporter: (pid 21152) 94s
ok: run: postgres-exporter: (pid 21216) 89s
ok: run: postgresql: (pid 20262) 374s
ok: run: prometheus: (pid 21188) 92s
ok: run: puma: (pid 20471) 297s
ok: run: redis: (pid 20092) 392s
ok: run: redis-exporter: (pid 21182) 92s
ok: run: sidekiq: (pid 20496) 291s
### --- 查看gitlab服务是否启动

[root@server11 ~]# lsof -i:80
COMMAND   PID       USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   20551       root    7u  IPv4 122587      0t0  TCP *:http (LISTEN)
nginx   20552 gitlab-www    7u  IPv4 122587      0t0  TCP *:http (LISTEN)
nginx   20553 gitlab-www    7u  IPv4 122587      0t0  TCP *:http (LISTEN)

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

 

posted on   yanqi_vip  阅读(37)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 我与微信审核的“相爱相杀”看个人小程序副业
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· spring官宣接入deepseek,真的太香了~
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示