• CentOS7安装Gitlab


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

    1.下载RPM包

    wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm/download.rpm

    rpm -ivh gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm

    2. 修改gitlab的url并执行reconfigure

    vi /etc/gitlab/gitlab.rb

    修改:external_url 'http://192.168.1.22'

    gitlab-ctl reconfigure #这一步时间较长 耐心等候

    3. web 界面登录
    8.8版本之前默认账号 root 密码 5iveL!fe
    8.9之后登录web界面会要求更改密码,注意密码最少8位!!

    http://192.168.1.22

    1.安装HTTP, HTTPS 和SSH,还有防火墙设置:

    sudo yum install -y curl policycoreutils openssh-server
    sudo systemctl enable sshd
    sudo systemctl start sshd
    # Check if opening the firewall is needed with: sudo systemctl status firewalld
    sudo firewall-cmd --permanent --add-service=http
    sudo firewall-cmd --permanent --add-service=https
    sudo systemctl reload firewalld

    2.安装邮件服务,用于发送邮件:

    sudo yum install postfix
    sudo systemctl enable postfix
    sudo systemctl start postfix

    3.下载安装脚本,并使用 bash 命令运行,这里使用到了Linux的|管道命令,即将前面的结果作为后面命令的输入:

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

    4.安装 gitlab-ee 版本,ee版为enterprise edition,ce版为community edition,这个EXTERNAL_URL参数也可以在安装后修改:

    Change https://gitlab.example.com to the URL at which you want to access your GitLab instance. Installation will automatically configure and start GitLab at that URL.

    EXTERNAL_URL="https://gitlab.example.com" dnf install -y gitlab-ee

    以下为下载过程,文件有点大,1G左右:

    安装完成:

    如果想先下载不安装,可以使用:

    [root@server226 ~]# dnf download gitlab-ee-12.10.6-ee.0.el8.x86_64

    或者使用 rpm 方式,先wget 安装包,再rpm安装也可以,举个例子:

    wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm/download.rpm

    rpm -ivh gitlab-ce-10.8.4-ce.0.el7.x86_64.rpm

    5.配置文件修改,配置文件在 /etc/gitlab/gitlab.rb :

    修改外部访问地址为Linux的IP:

    如果想修改端口号(默认为80):

    注意:gitlab自带Nginx,下图二中看注释说明:Override only if you use a reverse proxy. 即开启Nginx的反向代理!

    [root@server226 ~]# vim /etc/gitlab/gitlab.rb

    [root@server226 ~]# vim /var/opt/gitlab/nginx/conf/gitlab-http.conf

    修改如下:

    重新加载:gitlab-ctl reconfigure

    重启服务:gitlab-ctl restart

    如果照上图修改了端口,访问地址则为:http://192.168.1.226:9099

    特别注意:这里因为nginx做了反向代理,故使用nginx监听端口。

    6.使用命令 gitlab-ctl status 检查,如下则说明GitLab运行正常:

    7.GitlabUI:访问 http://IP:80

    首次登录会要求修改密码,然后 root + 密码登录:

    8.如果想强制初始化密码(或重置密码):命令目录在/opt/gitlab/bin,使用 gitlab-rails console production,如果报错,则使用 gitlab-rails console,如下:

    9.优雅关闭服务:gitlab-ctl stop

    全文完!

     

    Command line instructions

    Git global setup
    git config --global user.name "Administrator"
    git config --global user.email "admin@example.com"
    
    Create a new repository
    git clone http://172.17.0.22:88/wwd/qq.git
    cd qq
    touch README.md
    git add README.md
    git commit -m "add README"
    git push -u origin master
    Existing folder
    cd existing_folder
    git init
    git remote add origin http://172.17.0.22:88/wwd/qq.git
    git add .
    git commit -m "Initial commit"
    git push -u origin master
    Existing Git repository
    cd existing_repo
    git remote rename origin old-origin
    git remote add origin http://172.17.0.22:88/wwd/qq.git
    git push -u origin --all
    git push -u origin --tags
  • 相关阅读:
    [转] go --- err is shadowed during return
    kill 一个名字 程序的所有进程
    Mac -- pkg-config: exec: "pkg-config": executable file not found in $PATH
    Python JSON 字符串 转 json 基本使用
    Python 死循环
    cube.js 学习 cube 连接mongodb 试用二
    mongodb 通过sql 查询的几种方式
    mongodb bi-connector spring boot 集成试用
    mongodb bi-connector 使用
    pgspider mongodb fdw 查询集成
  • 原文地址:https://www.cnblogs.com/Python-K8S/p/13222890.html
Copyright © 2020-2023  润新知