windows
1.安装gogs
下载地址:https://gogs.io/docs/installation/install_from_binary.html(请自行科学上网
选择Windows amd64(64位)或者386(32位)
2.解压缩到你想放的文件夹
切换到script,执行mysql.sql,生成数据库
3.git安装
请自行下载安装:https://git-scm.com/
nssm安装 http://www.nssm.cc/ (用来执行windows下的添加服务功能 )
自行下载并把nssm添加到环境变量中
同时把gogs添加到环境变量中
在scripts的windows目录下找到install-as-service.bat,管理员双击运行
4.打开cmd窗口
输入gogs web回车
开启web服务
http://127.0.0.1:3000/访问web服务,注册并体验吧
linux
yum install git
mysql创建gogs的数据库,执行
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;
找一个文件夹下载二进制包
https://gogs.io/docs/installation/install_from_binary.html
下载系统对应版本的二进制包 386是32位的
wget https://dl.gogs.io/0.11.91/gogs_0.11.91_linux_386.tar.gz
解压
tar -zxvf gogs_0.11.91_linux_386.tar.gz
cd gogs && ./gogs web
启动方式
- 直接命令启动
./gogs web
, 关闭控制台则程序关闭。 - 守护进程启动
nohup ./gogs web &
。 - 使用启动脚本
script
文件夹中。
开机启动
修改启动脚本
vim /opt/software/gogs/scripts/init/centos/gogs
修改GOGS_HOME 和 GOGS_USER(最好使用默认的git用户,前提需要CentOS创建这个用户)
NAME=gogs
GOGS_HOME=/opt/software/gogs
GOGS_PATH=${GOGS_HOME}/$NAME
GOGS_USER=root
复制启动脚本到启动目录
cp /opt/software/gogs/scripts/init/centos/gogs /etc/rc.d/init.d/
进入目录启动目录
cd /etc/rc.d/init.d/
赋予执行权限
chmod +x gogs
测试启动脚本
service gogs start #启动服务
service gogs stop #停止服务
service gogs restart #重启服务
服务脚本加入到系统启动队列
chkconfig gogs on
检查 gogs 服务是否已经生效
chkconfig --list gogs
输出结果
gogs 0:关 1:关 2:开 3:开 4:开 5:开 6:关
问题:/lib/ld-linux.so.2: bad ELF interpreter: 没有那个文件或目录
因为服务器位数不对,64位装到32位了