自己搭一个github-gogs安装

Gogs安装

安装git

yum -y install git

下载地址

https://gogs.io/docs/installation/install_from_binary

创建git用户

user add git

创建logs文件夹

mkdir log

增加权限操作

chown -R git:git gogs

配置启动文件

cd /etc/init.d
vi gogs
#!/bin/sh
#
#       /etc/rc.d/init.d/gogs
#
#       Runs the Gogs
#       
#
# chkconfig:   - 85 15 
#

### BEGIN INIT INFO
# Provides:          gogs
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      mysql postgresql
# Should-Stop:       mysql postgresql
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start gogs at boot time.
# Description:       Control gogs.
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Default values

NAME=gogs
GOGS_HOME=/opt/software/gogs
GOGS_PATH=${GOGS_HOME}/$NAME
GOGS_USER=git
SERVICENAME="Gogs"
LOCKFILE=/var/lock/subsys/gogs
LOGPATH=${GOGS_HOME}/log
LOGFILE=${LOGPATH}/gogs.log
RETVAL=0

# Read configuration from /etc/sysconfig/gogs to override defaults
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME

# Don't do anything if nothing is installed
[ -x ${GOGS_PATH} ] || exit 0
# exit if logpath dir is not created.
[ -x ${LOGPATH} ] || exit 0

DAEMON_OPTS="--check $NAME"

# Set additional options, if any
[ ! -z "$GOGS_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GOGS_USER}"

start() {
  cd ${GOGS_HOME}
  echo -n "Starting ${SERVICENAME}: "
  daemon $DAEMON_OPTS "${GOGS_PATH} web > ${LOGFILE} 2>&1 &"
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && touch ${LOCKFILE}
        
  return $RETVAL
}

stop() {
  cd ${GOGS_HOME}
        echo -n "Shutting down ${SERVICENAME}: "
        killproc ${NAME}
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f ${LOCKFILE} 
}

case "$1" in
    start)
        status ${NAME} > /dev/null 2>&1 && exit 0
        start
        ;;
    stop)
        stop
        ;;
    status)
        status ${NAME}
        ;;
    restart)
        stop
        start
        ;;
    reload)
        stop
        start
        ;;
    *)
        echo "Usage: ${NAME} {start|stop|status|restart}"
        exit 1
        ;;
esac
exit $RETVAL

赋予执行权限

chmod +x gogs

启动

service start gogs

创建数据位置

mkdir /opt/data/gogs

赋予权限

chown git:git /opt/data/gogs

根据端口登录,完成配置。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我是刘奇奇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值