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

  • 相关阅读:
    CS224n, lec 10, NMT & Seq2Seq Attn
    CS231n笔记 Lecture 11, Detection and Segmentation
    CS231n笔记 Lecture 10, Recurrent Neural Networks
    CS231n笔记 Lecture 9, CNN Architectures
    CS231n笔记 Lecture 8, Deep Learning Software
    CS231n笔记 Lecture 7, Training Neural Networks, Part 2
    pytorch坑点排雷
    Sorry, Ubuntu 17.10 has experienced an internal error
    VSCode配置python插件
    tmux配置与使用
  • 原文地址:https://www.cnblogs.com/eba001/p/14299526.html
Copyright © 2011-2022 走看看