Centos7部署配置Gitlab

一、安装依赖软件(邮件服务)

yum -y install policycoreutils openssh-server openssh-clients postfix

二、开启postfix

  • 启动之前先检查一下文件配置是否正确
    postfix check
  • 开启服务
    systemctl enable postfix
    systemctl start postfix
  • 我启动前没check,启动失败,出现两个配置问题:
  1. fatal: parameter inet_interfaces: no local interface found for ::1
    修改 /etc/postfix/main.cf 文件中 inet_interfaces = localhostinet_interfaces = all
  2. libmysqlclient.so.18: cannot open shared object file: No such file or directory
    在mysql的安装路径下找到libmysqlclient.so.18,再使用软连接到/usr/lib64 路径下:
    ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64

三、安装Gitlab

  • 下载安装包
    wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.3.4-ce.0.el7.x86_64.rpm
  • 安装
    rpm -ivh gitlab-ce-11.3.4-ce.0.el7.x86_64.rpm
[root@localhost ~] wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.3.4-ce.0.el7.x86_64.rpm
......
[root@localhost ~] rpm -ivh gitlab-ce-11.3.4-ce.0.el7.x86_64.rpm
警告:gitlab-ce-11.3.4-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID f27eab47: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:gitlab-ce-11.3.4-ce.0.el7        ################################# [100%]
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

四、设置服务器IP和端口

修改配置文件 gitlab.rb 中的 external_url 为服务器IP和端口号
vim /etc/gitlab/gitlab.rb

## GitLab URL
##! 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://gitlab.example.com'
external_url 'http://39.100.2.249' // 访问url

五、重置并启动GitLab

修改完 gitlab.rb 后,重置并启动GitLab
gitlab-ctl reconfigure
gitlab-ctl restart

[root@localhost ~] gitlab-ctl restart
ok: run: alertmanager: (pid 6459) 0s
ok: run: gitaly: (pid 6470) 0s
ok: run: gitlab-monitor: (pid 6494) 1s
ok: run: gitlab-workhorse: (pid 6499) 0s
ok: run: logrotate: (pid 6507) 0s
ok: run: nginx: (pid 6517) 1s
ok: run: node-exporter: (pid 6597) 0s
ok: run: postgres-exporter: (pid 6599) 0s
ok: run: postgresql: (pid 6620) 0s
ok: run: prometheus: (pid 6628) 0s
ok: run: redis: (pid 6640) 1s
ok: run: redis-exporter: (pid 6644) 0s
ok: run: sidekiq: (pid 6651) 0s
ok: run: unicorn: (pid 6665) 0s
[root@localhost ~] 

ok

posted @ 2019-11-21 10:16  游园拾忆  阅读(67)  评论(0编辑  收藏  举报