个人感觉 gogs 比 git 好用 因为gogs的搭建 比较简单 实用性是一样的
一下不说废话 看配置
yum install mercurial git gcc -y
安装 mercurial,git,gcc
上传安装包
tar xvf go1.6.linux-amd64.tar.gz
vim /etc/profile
在profile里面添加如下内容
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/goTest
export GOBIN=$GOPATH/bin
刷新环境变量
source /etc/profile
最后我们验证一下是否安装成功
go version
如果出现go version go1.6 linux/amd64 安装成功
yum install pcre-devel curl curl-devel zlib-devel openssl-devel perl cpio expat-devel gettext-devel git -y
git --version 命令
回显 git version 1.7.1
yum -y install mysql mysql-server 安装数据库
sed -i "s/\[mysqld\]/\[mysqld\]\ndefault-character-set=utf8/g" /etc/my.cnf
sed -i "s/\[mysqld\]/\[mysqld\]\nmax_connections = 3000/g" /etc/my.cnf
service mysqld start
chkconfig mysqld on
/usr/bin/mysqladmin -u root password "123456"
mysql -u root -p123456
数据库创建
DROP DATABASE IF EXISTS gogs;
CREATE DATABASE IF NOT EXISTS gogs CHARACTER SET utf8 COLLATE utf8_general_ci;
安装nginx
上传安装包
tar vxf nginx-1.9.12.tar.gz
[root@localhost ~]# cd nginx-1.9.12
[root@localhost nginx-1.9.12]# ./configure --prefix=/gogs/nginx make && make install
[root@localhost nginx-1.9.12]# cd /gogs/nginx/sbin/
[root@localhost sbin]# ./nginx -V
nginx version: nginx/1.9.12
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
configure arguments: --prefix=/gogs/nginx
关闭防火墙:service iptables stop
禁止自动启动防火墙:chkconfig iptables off 永久性的
gogs安装配置
tar vxf gogs_v0.9.0_linux_amd64.tar.gz
nohup ./gogs web & >>nohup.out
netstat -antlp | grep :3000
gogs 默认存储路径
/root/gogs-repositories
1.后台运行
如果要在后台以service模式运行,先将/home/git/gogs/scripts/init/debian/gogs文件拷贝到/etc/init.d/目录下,切换回原来的用户Ctrl+d,并增加运行权限sudo chmod +x /etc/init.d/gogs,并将文件做对应修改如下:
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Go 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 #如果运行gogs不是用的这个用户,修改对应用户
以后可以使用
/etc/init.d/gogs start|restart|stop|status
进行gogs应用各种操作了。