1.1 信息确认

[Anliven@node102 ~]$ uname -a
Linux node102 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[Anliven@node102 ~]$ cat /etc/system-release
CentOS Linux release 7.5.1804 (Core) 
[Anliven@node102 ~]$ 

1.2 准备步骤

# 安装依赖
sudo yum install -y curl policycoreutils-python openssh-server postfix

# 启动SSH和postfix
sudo systemctl enable sshd
sudo systemctl start sshd
sudo systemctl enable postfix
sudo systemctl start postfix

# 开放端口
sudo firewall-cmd --add-service=ssh --permanent
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload

1.3 安装方式1:Yum

curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo yum install -y gitlab-ce

[转]GitLab安装与启动

1.4 安装方式2:下载并安装rpm包

清华镜像:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/ [转]GitLab安装与启动

注意:可以单独下载RPM包,然后上传到Server,要节约时间点。

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm
rpm -i gitlab-ce-12.5.0-ce.0.el7.x86_64.rpm

[转]GitLab安装与启动

2 - 初始化配置

GitLab默认的配置文件路径:/etc/gitlab/

  • /etc/gitlab/gitlab.rb:主配置文件,包含外部URL、仓库目录、备份目录等
  • /etc/gitlab/gitlab-secrets.json:(执行gitlab-ctl reconfigure命令行后生成),包含各类密钥的加密信息

2.1 初始化配置

  • 配置首页地址(需将设置的域名DNS解析到服务器IP,或者修改本地host将域名指向服务器IP)
  • 修改服务端口,避免和其他服务端口冲突
  • 重新配置并启动,使配置生效,并确认相关组件或进程的状态
  • 设置账号密码和管理员信息
[root@node102 ~]# ll /etc/gitlab/
total 96
-rw------- 1 root root 97727 Nov 26 23:05 gitlab.rb
[root@node102 ~]# 
[root@node102 ~]# cat /etc/gitlab/gitlab.rb |grep -v "#" |grep -Ev "^$"
external_url 'http://gitlab.example.com'
[root@node102 ~]# 
[root@node102 ~]# vim /etc/gitlab/gitlab.rb
[root@node102 ~]# 
[root@node102 ~]# cat /etc/gitlab/gitlab.rb |grep -v "#" |grep -Ev "^$"
external_url 'http://192.168.16.102'
unicorn['listen'] = '192.168.16.102'
unicorn['port'] = 8081
[root@node102 ~]# 
[root@test102 ~]# gitlab-ctl diff-config
diff --git a/etc/gitlab/gitlab.rb b/opt/gitlab/etc/gitlab.rb.template
index 3e27e40..31c0b45 100644
--- a/etc/gitlab/gitlab.rb
+++ b/opt/gitlab/etc/gitlab.rb.template
@@ -20,7 +20,7 @@
 ##! URL on which GitLab will be reachable.
 ##! For more details on configuring external_url see:
 ##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
-external_url 'http://192.168.16.102'
+external_url 'GENERATED_EXTERNAL_URL'
 
 ## Roles for multi-instance GitLab
 ##! The default is to have no roles enabled, which results in GitLab running as an all-in-one instance.
@@ -740,8 +740,8 @@ external_url 'http://192.168.16.102'
 # unicorn['worker_processes'] = 2
 
 ### Advanced settings
-unicorn['listen'] = '192.168.16.102'
-unicorn['port'] = 8081
+# unicorn['listen'] = 'localhost'
+# unicorn['port'] = 8080
 # unicorn['socket'] = '/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket'
 # unicorn['pidfile'] = '/opt/gitlab/var/unicorn/unicorn.pid'
 # unicorn['tcp_nopush'] = true
[root@test102 ~]# 
[root@node102 ~]#  firewall-cmd --zone=public --permanent --add-port=8081/tcp
success
[root@node102 ~]# firewall-cmd --reload
success
[root@node102 ~]# 
[root@node102 ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3 enp0s8
  sources: 
  services: ssh dhcpv6-client http
  ports: 8081/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
    
[root@node102 ~]# 
[root@node102 ~]# gitlab-ctl reconfigure
Starting Chef Client, version 14.13.11
resolving cookbooks for run list: ["gitlab"]
Synchronizing Cookbooks:
  - gitlab (0.0.1)
  - package (0.1.0)
  - postgresql (0.1.0)
  - redis (0.1.0)
  - monitoring (0.1.0)
  - registry (0.1.0)
  - mattermost (0.1.0)
  - consul (0.1.0)
  - gitaly (0.1.0)
  - nginx (0.1.0)
  - praefect (0.1.0)
  - letsencrypt (0.1.0)
  - runit (4.3.0)
  - acme (4.0.0)
  - crond (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Recipe: gitlab::default
......
......
......
Recipe: <Dynamically Defined Resource>
  * service[alertmanager] action restart
    - restart service service[alertmanager]
  * service[postgres-exporter] action restart
    - restart service service[postgres-exporter]
  

相关文章:

  • 2021-09-22
  • 2021-12-09
  • 2021-10-01
  • 2022-12-23
  • 2021-11-19
  • 2021-11-20
  • 2021-11-27
  • 2021-07-15
猜你喜欢
  • 2021-12-20
  • 2021-12-31
  • 2021-07-17
  • 2021-05-27
  • 2021-04-23
  • 2022-12-23
  • 2022-01-09
相关资源
相似解决方案