gogsインストール

gogsインストール

sudo su –
yum update
yum -y install git mysql wget
wget https://dl.gogs.io/0.11.66/gogs_0.11.66_linux_amd64.tar.gz
tar zxvf gogs_0.11.66_linux_amd64.tar.gz
cd /opt/gogs/
curl “https://bootstrap.pypa.io/get-pip.py” -o “get-pip.py”
python get-pip.py
yum -y install unzip
cd /opt/gogs

mysql設定

vi scripts/mysql.sql
SET GLOBAL innodb_file_per_table = ON,
innodb_file_format = Barracuda,
innodb_large_prefix = ON;
DROP DATABASE IF EXISTS gogs;
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE
utf8mb4_general_ci;
GLOBAL
の設定は、
AWS
RDS
パラメータグループを変更する。
mysql -h mysql.ckeovligbfpw.ap-northeast-1.rds.amazonaws.com -P 3306 -u
ユーザー名 -p
パスワード入力
show databases;
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8mb4 COLLATE
utf8mb4_general_ci;
CREATE USER ‘gogs’@’localhost’ IDENTIFIED BY ‘P@ssw0rd’;
grant all privileges on gogs.* to ‘gogs’@’%’ identified by ‘P@ssw0rd’ with grant
option;
flush privileges;
exit

gogs設定

vi /opt/gogs/custom/conf/app.ini
APP_NAME = Gogs
RUN_USER = root
RUN_MODE = prod
[database]
DB_TYPE = mysql
HOST = mysql.ckeovligbfpw.ap-northeast-1.rds.amazonaws.com:3306
NAME = gogs
USER = gogs
PASSWD = P@ssw0rd
SSL_MODE = disable
PATH = data/gogs.db
[repository]
ROOT = /data/gogs-repositories
[server]
DOMAIN = www.domein.com
HTTP_PORT = 3000
ROOT_URL = https://www.domein.com
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 = false
[session]
PROVIDER = file
[log]
MODE = file
LEVEL = Info
ROOT_PATH = /var/log/gogs/
vi /etc/systemd/system/gogs.service
[Unit]
Description=Gogs
After=syslog.target
After=network.target
After=memcached.service redis.service
RequiresMountsFor=/mnt/nfsdisk/gogssrv
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=root
Group=root
WorkingDirectory=/
ExecStart=/opt/gogs/gogs web
Restart=always
Environment=USER=root HOME=/root

gogs起動

systemctl enable gogs
systemctl status gogs
systemctl start gogs