1.下载

cd /usr/local/src
wget  https://dl.gogs.io/0.11.86/gogs_0.11.86_linux_386.tar.gz
tar xf gogs_0.11.86_linux_386.tar.gz
mv gogs /usr/local/

2.部署数据库

yum install mysql -y
yum install mysql-server -y
yum install mysql-devel -y

#但是mysql-server安装不了,需要一下操作
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server

3.启动数据库,设置密码

systemctl start mysqld
mysql -uroot

>set password for 'root'@'localhost' = password('123456');
>flush privileges;

#重进数据库
mysql -u root -p

#用户自己定义
>grant all privileges on gogs.* to 'gogs'@'localhost' identified by '123456';
>flush privileges;

#导入gogs数据库
mysql -u root -p < /usr/local/gogs/scripts/mysql.sql
passwd:

4.启动gogs

#如果需要安装go语言,自己去安装一个
cd /usr/local/gogs
./gogs web

#很多人发现会出现错误
错误一:
     /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
错误二:
    while loading shared libraries: libpam.so.0: cannot open shared object file: No such file or directory

    导致以上错误是缺失了数据包
         yum install glibc.i686 -y
         yum install  pam.i686 -y

    再次启动
    ./gogs web &