• gogs配置及迁移


    工作需要迁移gogs,粗略记下笔记

    操作系统:CentOS Linux release 7.4.1708 (Core)

    防火墙:关闭状态,如有需要开启默认的3000端口

    一、配置

    首先安装git

    [root@host2 ~]# yum -y install git
    [root@host2 ~]# git --version
    git version 1.8.3.1
    [root@host2 ~]# adduser git
    [root@host2 ~]# id git
    uid=1002(git) gid=1003(git) 组=1003(git)
    [root@host2 ~]# mkdir /opt/env_gogs ;cd /opt/env_gogs  #上传gogs包到此文件下
    [root@host2 env_gogs]# tar xf gogs_linux_amd64.tar.gz
    [root@host2 env_gogs]# su git
    [git@host2 gogs]$ cd /opt/env_gogs/gogs
    [git@host2 gogs]$ ./gogs web

    使用浏览器访问http://服务器ip:3000即可打开Gogs的安装页面

    安装页面配置: 

    最上面有个选择数据库的,没有截图,我选的是sqlite3,路径默认,因为sqlite3不需要配置数据库,比较方便,也可以自己使用mysql,然后配置数据库

    这些可以按照默认配置就行,其他的可以等配置好后在custom/conf/app.ini里修改

    配置文件:custom/conf/app.ini

    APP_NAME = Gogs
    RUN_USER = git
    RUN_MODE = prod
    
    [database]
    DB_TYPE  = sqlite3
    HOST     = 127.0.0.1:3306
    NAME     = gogs
    USER     = root
    PASSWD   =
    SSL_MODE = disable
    PATH     = data/gogs.db
    
    [repository]
    ROOT = /home/git/gogs-repositories
    
    [server]
    DOMAIN           = 192.168.0.132
    HTTP_PORT        = 3333
    ROOT_URL         = http://192.168.0.132:3333/
    DISABLE_SSH      = false
    SSH_PORT         = 22
    START_SSH_SERVER = false
    OFFLINE_MODE     = false
    
    [mailer]
    ENABLED = false
    
    [service]
    REGISTER_EMAIL_CONFIRM = false
    ENABLE_NOTIFY_MAIL     = false
    DISABLE_REGISTRATION   = false
    ENABLE_CAPTCHA         = true
    REQUIRE_SIGNIN_VIEW    = false
    
    [picture]
    DISABLE_GRAVATAR        = false
    ENABLE_FEDERATED_AVATAR = true
    
    [session]
    PROVIDER = file
    
    [log]
    MODE      = file
    LEVEL     = Info
    ROOT_PATH = /opt/env_gogs/gogs/log
    
    [security]
    INSTALL_LOCK = true
    SECRET_KEY   = tCaP3J3Qkbf2Iyx

    重新启动gogs:

    [git@host2 gogs]$ nohup ./gogs web -p 3333 &  
    [git@host2 gogs]$ ps aux | grep gogs
    git        5321  0.0  3.7 219072 37284 pts/0    Sl   12:51   0:01 ./gogs web -p 3333

    浏览器输入访问地址:

     至此,gogs基础服务已搭建完成

    二、迁移

    1、停gogs服务

    2、把原服务器上的/home/git/gogs-repositories/和/opt/env_gogs/gogs/data/打包发送到新服务器的相对应目录下(或者同步)

    3、到新服务器上相对应目录解压上面两个文件,注意看权限是不是git

    4、重启新服务器的gogs

    5、登录验证ok

  • 相关阅读:
    在 VS14 上安装 Visual F# Power Tools
    关于sources.list和apt-get [转载]
    MATLAB中导入数据:importdata函数
    部分 CM11 系统 Android 平板执行植物大战僵尸 2 黑屏的解决的方法
    html5视频播放
    用GruntJS合并、压缩JS文件
    Linux/UNIX进程控制(1)
    TCP/IP协议,HTTP协议
    php 求水仙花数优化
    使用LAMP创建基于wordpress的个从博客站点
  • 原文地址:https://www.cnblogs.com/01-single/p/9015074.html
Copyright © 2020-2023  润新知