gogs配置及迁移

工做须要迁移gogs,粗略记下笔记mysql

操做系统:CentOS Linux release 7.4.1708 (Core)linux

防火墙:关闭状态,若有须要开启默认的3000端口git

1、配置web

首先安装gitsql

[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里修改session

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

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基础服务已搭建完成

2、迁移

一、停gogs服务

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

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

四、重启新服务器的gogs

五、登陆验证ok

相关文章
相关标签/搜索