工作需要遷移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