搭建gogs 我的機器環境:centos 7 1.安裝git yum install git 2.安裝mysql gogs的數據存在mysql中,需要安裝一個mysql來存數據,當然也有其他的選擇,比如sqllite。 mysql安裝: http://www.cnblogs.com/dingxu/p ...
搭建gogs
我的機器環境:centos 71.安裝git
yum install git 2.安裝mysql gogs的數據存在mysql中,需要安裝一個mysql來存數據,當然也有其他的選擇,比如sqllite。 mysql安裝: http://www.cnblogs.com/dingxu/p/8927955.html 安裝好mysql後: 登錄到mysql mysql -uroot -p SET GLOBAL storage_engine = 'InnoDB'; //如果顯示沒有這個欄位的錯誤,就用default_storage_engine = 'InnoDB' CREATE DATABASE gogs CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL PRIVILEGES ON gogs.* TO ‘root’@‘localhost’ IDENTIFIED BY 'xxxx'; FLUSH PRIVILEGES; QUIT; ## xxxx是密碼3.安裝nginx
yum install nginx // 預設配置文件安裝在/etc/nginx,修改nginx.conf和nginx.conf.default配置文件![](https://images2018.cnblogs.com/blog/1383434/201804/1383434-20180424122050652-1149354947.png)
4.安裝gogs
1.創建git用戶
useradd git passwd git //設置密碼2.下載解壓gogs
切換到git用戶 su git cd ~ wget https://dl.gogs.io/0.11.4/linux_amd64.zip # unzip 命令不可用的話需先安裝 unzip linux_amd64.zip3.配置gogs
vim /home/git/gogs/scripts/init/debian/gogs PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="GoGs Git Service" NAME=gogs SERVICEVERBOSE=yes PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME WORKINGDIR=/home/git/gogs #根據自己的目錄修改 DAEMON=$WORKINGDIR/$NAME DAEMON_ARGS="web" USER=git #修改對應用戶4.切回root,拷貝文件和服務
#拷貝到init.d下 cp /home/git/gogs/scripts/init/debian/gogs /etc/init.d/ #添加可執行許可權 chmod +x /etc/init.d/gogs #拷貝service cp /home/git/gogs/scripts/systemd/gogs.service /etc/systemd/system/5.啟動
systemctl start gogs.service 訪問ip:3000,也可以用nginx做一個反向代理配置gogs
修改資料庫的配置,ip地址啊,開放註冊,管理員設置等![](https://images2018.cnblogs.com/blog/1383434/201804/1383434-20180424122119613-1274377931.png)
配置完成後
可以把它理解為一個簡單的github來用。還是不錯的![](https://images2018.cnblogs.com/blog/1383434/201804/1383434-20180424122152918-1338478522.png)