1. 程式人生 > 其它 >CentOS 7 minal x86_64 mysql 5.7 搭建gogs伺服器——築夢之路

CentOS 7 minal x86_64 mysql 5.7 搭建gogs伺服器——築夢之路

技術標籤:linux系統運維mysqlcentosgit-servergogs

gogs姊妹篇https://blog.csdn.net/qq_34777982/article/details/89199132

該篇主要是使用mysql5.7+gogs+centos 7搭建。

1.安裝mysql 5.7 
yum install http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

yum install mysql-server -y

systemctl start  mysqld.service

grep "password" /var/log/mysqld.log

mysql_secure_installation

systemctl enable  mysqld.service

2.下載gogs

wget -c https://dl.gogs.io/0.12.3/gogs_0.12.3_linux_amd64.tar.gz

tar -zxvf gogs_0.12.3_linux_amd64.tar.gz -C /opt

新增使用者
useradd git

授權
chown -R git.git /opt/gogs

cd /opt/gogs/scripts/systemd

修改gogs.service
vim gogs.service

[Unit]
Description=Gogs
After=syslog.target
After=network.target
After=mysqld.service

[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=git
Group=git
WorkingDirectory=/opt/gogs
ExecStart=/opt/gogs/gogs web
Restart=always
Environment=USER=git HOME=/home/git


[Install]
WantedBy=multi-user.target


將此檔案拷貝到系統位置
cp gogs.service /usr/lib/systemd/system/

systemctl daemon-reload

systemctl start gogs

systemctl enable gogs

3.防火牆設定

firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload


4.頁面訪問
ip:3000
進行安裝

5.自定義配置
詳情檢視:https://blog.csdn.net/weixin_41998993/article/details/105116943

app.ini /opt/gogs/custom/conf

BRAND_NAME = CodeMiracle-Gogs
RUN_USER   = git
RUN_MODE   = prod

[database]
TYPE     = mysql
HOST     = 127.0.0.1:3306
NAME     = gogs
USER     = gogs
PASSWORD = ly434782.
SSL_MODE = disable
PATH     = /opt/gogs/data/gogs.db

[repository]
ROOT = /home/git/gogs-repositories


[repository.upload]
ENABLED		= true
TEMP_PATH	= /opt/gogs/data/tmp
ALLOWED_TYPES	= 
FILE_MAX_SIZE	= 50
MAX_FILES	= 5

[repository.editor]
LINE_WRAP_EXTENSIONS = .txt,.md,.markdown,.mdown,.mkd
PREVIEWABLE_FILE_MODES = markdown

[markdown]
ENABLE_HARD_LINE_BREAK	= false
CUSTOM_URL_SCHEMES	= 
FILE_EXTENSIONS		= .md,.markdown,.mdown,.mkd

[server]
DOMAIN           = 192.168.25.17
HTTP_PORT        = 3000
EXTERNAL_URL     = http://192.168.25.17:3000/
DISABLE_SSH      = false
SSH_PORT         = 22
START_SSH_SERVER = false
OFFLINE_MODE     = false
ENABLE_GZIP	 = true


[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 = /opt/gogs/log

[security]
INSTALL_LOCK = true
SECRET_KEY   = wIUvAMoWmBMNAJs
LOGIN_REMEMBER_DAYS = 7
COOKIE_USERNAME = gogs_awesome
COOKIE_REMEMBER_NAME = gogs_incredible

[attachment]
ENABLED = true
PATH = /opt/gogs/data/attachments
ALLOWED_TYPES = image/jpeg|image/png/zip
MAX_SIZE = 10
MAX_FILES = 5

[cron]
ENABLED = true
RUN_AT_START = false

[cron.update_mirrors]
SCHEDULE = @every 10m


[cron.repo_health_check]
SCHEDULE = @every 24h
TIMEOUT = 60s
ARGS =


[cron.check_repo_stats]
RUN_AT_START = true
SCHEDULE = @every 24h


[ui]
; Number of repositories that are showed in one explore page
EXPLORE_PAGING_NUM = 20
; ; Number of issues that are showed in one page
ISSUE_PAGING_NUM = 10
; ; Number of maximum commits showed in one activity feed
FEED_MAX_COMMIT_NUM = 5
; ; Value of "theme-color" meta tag, used by Android >= 5.0
; ; An invalid color like "none" or "disable" will have the default style
; ; More info: https://developers.google.com/web/updates/2014/11/Support-for-theme-color-in-Chrome-39-for-Android
THEME_COLOR_META_TAG = `#ff5343`
; ; Max size in bytes of files to be displayed (default is 8MB)
MAX_DISPLAY_FILE_SIZE = 8388608
;
[ui.admin]
; ; Number of users that are showed in one page
USER_PAGING_NUM = 50
; ; Number of repos that are showed in one page
REPO_PAGING_NUM = 50
; ; Number of notices that are showed in one page
NOTICE_PAGING_NUM = 25
; ; Number of organization that are showed in one page
ORG_PAGING_NUM = 50
;
[ui.user]
; ; Number of repos that are showed in one page
REPO_PAGING_NUM = 15
; ; Number of news feeds that are showed in one page
NEWS_FEED_PAGING_NUM = 20
; ; Number of commits that are showed in one page
COMMITS_PAGING_NUM = 30
;