zoukankan      html  css  js  c++  java
  • Gitlab学习笔记

    Gitlab的两种安装方式

    1.Docker安装

    1.创建一个全新的虚拟机,并且至少指定4G的运行内存

    2.安装docker以及docker-compose

    3.使用docker-compose.yml文件去安装gitLab

    [root@localhost ~]# mkdir /opt/docker_gitlab
    [root@localhost ~]# cd /opt/docker_gitlab/
    [root@localhost docker_gitlab]# vi docker-compose
    version: '3.1'
    services:
      gitlab: 
       image: 'twang2218/gitlab-ce-zh:11.1.4'
       container_name: "gitlab"
       restart: always
       privileged: true
       hostname: 'gitlab'
       environment: 
         TZ: 'Asia/Shanghai'
         GITLAB_OMNIBUS_CONFIG: 
          external_url 'http://192.168.17.163'
          gitlab_rails['time_zone'] = 'Asia/Shanghai'
          gitlab_rails['smtp_enable'] = true
          gitlab_rails['gitlab_shell_ssh_port'] = 22
       ports:
       	 - '80:80'
       	 - '443:443'
       	 - '22:22'
       volumes:
         - /opt/docker_gitlab/config:/etc/gitlab
         - /opt/docker_gitlab/data:/var/opt/gitlab
         - /opt/docker_gitlab/logs:/var/log/gitlab
    

    4.因为配置文件中写的22端口被我们ssh服务占用了,这个时候我们就要修改一下ssh服务的端口

    [root@localhost ~]# vi /etc/ssh/sshd_config
    port 223
    
    [root@localhost ~]# systemctl restart sshd
    

    5.运行docker-compose

    docker-compose up -d
    docker-compose logs -f
    

    遇到问题

    gitlab    | This file is used to check if any of the unsupported configurations are enabled,
    gitlab    | and hence require a working reconfigure before upgrading.
    gitlab    | Please run `sudo gitlab-ctl reconfigure` to fix it and try again.
    gitlab exited with code 1
    
    如果遇到上面这个问题,手动关闭删除容器,再重新run一下
    然后再查看服务日志直到频繁出现以下内容,服务搭建成功
    
    ==> /var/log/gitlab/gitlab-rails/production.log <==
    Started GET "/-/metrics" for 127.0.0.1 at 2021-01-19 19:08:55 +0000
    Processing by MetricsController#index as HTML
    Completed 200 OK in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
    
    

    2.普通安装

    1.安装相关依赖

    [root@localhost ~]# yum -y install policycoreutils-python openssh-server openssh-clients postfix
    

    2.启动ssh服务&设置为开机启动

    [root@localhost ~]# systemctl enable sshd && sudo systemctl start sshd
    [root@localhost ~]# systemctl status sshd #查看是否启动
    

    3.设置postfix开机自启,并启动,postfix支持gitlab邮件发送功能

    [root@localhost ~]# systemctl enable postfix && systemctl start postfix 
    

    4.开放ssh以及http服务,然后重新加载防火墙列表

    [root@localhost ~]# firewall-cmd --add-service=ssh --permanent
    [root@localhost ~]# firewall-cmd --add-service=http --permanent
    [root@localhost ~]# firewall-cmd --reload
    如果linux关闭了防火墙就不需要做以上配置
    

    5.下载gitlab包,并且安装

    在线下载安装包
    [root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-12.4.2-ce.0.el6.x 86_64.rpm
    安装
    [root@localhost ~]# rpm -i gitlab-ce-12.4.2-ce.0.el6.x86_64.rpm 
    

    6.修改gitlab配置

    [root@localhost ~]# vi /etc/gitlab/gitlab.rb
    修改gitlab访问地址和端口,默认为80,我们改为82 
    external_url 'http://192.168.17.78:82'	#把外部访问地址改成本机器地址
    nginx['listen_port'] = 82	#把外部访问端口改成82,防止端口冲突
    gitlab_rails['time_zone'] = 'Asia/Shanghai'	 #设置地区
    

    7.重载配置及启动gitlab

    [root@localhost ~]# gitlab-ctl reconfigure
    [root@localhost ~]# gitlab-ctl restart 
    

    8.把端口添加到防火墙

    [root@localhost ~]# firewall-cmd --zone=public --add-port=82/tcp --permanent 
    [root@localhost ~]# firewall-cmd --reload
    如果linux关闭了防火墙就不需要做以上配置
    

    9.启动成功后,访问地址

    看到以下修改管理员root密码的页面,修改密码后,然后登录即可

    root P@ssw0rd

  • 相关阅读:
    进程、线程、轻量级进程、协程与 go 的 goroutine
    Base: 一种 Acid 的替代方案
    单点登录 SSO(Single Sign-On)的实现原理
    大型网站之分布式会话管理
    PayPal 高级工程总监:读完这 100 篇文献,就能成大数据高手
    主流编程语言的 33 款开源爬虫
    docker基础命令
    mysql实现首字母从A-Z排序
    solr+zookeeper集群配置
    Lucene与Solr基础
  • 原文地址:https://www.cnblogs.com/eba001/p/14299526.html
Copyright © 2011-2022 走看看