Loading... ## gogs私有仓库 > https://gogs.io/ ### 安装gogs需要的环境 - git - mysql >= 5.7 - ssh服务器(如果只使用http/https可以忽略) ### 安装数据库 ```bash yum install mysql-server -y # 启动服务 systemctl start mysqld # 初始化 根据提示进行安全设置 mysql_secure_installation ``` ### 安装git和gogs ```bash # 创建git用户 useradd -r git # 安装git yum install git -y # 下载源码 wget https://dl.gogs.io/0.12.3/gogs_0.12.3_linux_amd64.tar.gz # 解压到/usr/local tar zxvf https://dl.gogs.io/0.12.3/gogs_0.12.3_linux_amd64.tar.gz -C /usr/local # 修改权限 chown git.git -R /usr/local/gogs # 修改service文件, 并复制到/usr/lib/systemd/system cd /usr/local/gogs/scripts/systemd vim gogs.service # 修改如下 ``` ```ini [Unit] Description=Gogs After=syslog.target After=network.target After=mariadb.service mysqld.service postgresql.service memcached.service redis.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=/home/git/gogs WorkingDirectory=/usr/local/gogs # 修改为实际目录 ExecStart=/usr/local/gogs/gogs web Restart=always # 实际情况进行修改 Environment=USER=git HOME=/home/git # Some distributions may not support these hardening directives. If you cannot start the service due # to an unknown option, comment out the ones not supported by your version of systemd. ProtectSystem=full PrivateDevices=yes PrivateTmp=yes NoNewPrivileges=true [Install] WantedBy=multi-user.target ``` ```bash # 启动服务 systemcl start gogs # 默认监听3000端口 # 打开web地址进行安装配置, 根据提示即可安装 ``` ![安装](https://blog.beijixs.cn/usr/uploads/2021/06/2890243618.png) <div class="tip inlineBlock info"> 安装完成后, 第一个注册的用户即为管理员用户 </div> ### 安装完成后的配置 配置文件目录`/usr/local/gogs/custom/conf/app.ini`, 程序工作目录下`./custom/conf/app.ini` ```ini BRAND_NAME = Gogs RUN_USER = git RUN_MODE = prod [database] TYPE = mysql HOST = 127.0.0.1:3306 NAME = gogs USER = gogs PASSWORD = 12345678 SSL_MODE = disable PATH = /opt/gogs/data/gogs.db [repository] ROOT = /home/git/gogs-repositories [server] DOMAIN = 172.16.44.245 HTTP_PORT = 3001 EXTERNAL_URL = http://172.16.44.245:3000/ 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 = /opt/gogs/log [security] INSTALL_LOCK = true SECRET_KEY = pLF7M7QftOQzre7 ``` 最后修改:2021 年 06 月 09 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 0 如果觉得我的文章对你有用,请随意赞赏
3 条评论
《真实的谎言》欧美剧高清在线免费观看:https://www.jgz518.com/xingkong/142460.html
你的文章让我学到了很多知识,非常感谢。 https://www.yonboz.com/video/17638.html
《周末夜狂热》爱情片高清在线免费观看:https://www.jgz518.com/xingkong/65112.html