Linux Debain 安装 GOGS

2020年4月14日

Debian 9 Stretch 64bits

  1. Created: Started: Duration: 123s
  2. master
  3. 844d2f49ce25b1f1fd29832a01b8b38810a8249a
  4. 0.11.91

Installation instructions

  1. wget -qO- https://dl.packager.io/srv/gogs/gogs/key | sudo apt-key add -
  2. sudo wget -O /etc/apt/sources.list.d/gogs.list \
  3. https://dl.packager.io/srv/gogs/gogs/master/installer/debian/9.repo
  4. sudo apt-get update
  5. sudo apt-get install gogs

Note: You might need to apt-get install wget apt-transport-https for the above instructions to work.

Here is how you would install MySQL and setup NginX to get a fully working installation:

Debian/Ubuntu

APP_NAME="gogs"
MYSQL_PASSWORD="change_me"
HOSTNAME="example.com"

# setup mysql server and database
debconf-set-selections <<CONFIG
mysql-server-5.5 mysql-server/root_password password ${MYSQL_PASSWORD}
mysql-server-5.5 mysql-server/root_password_again password ${MYSQL_PASSWORD}
CONFIG
apt-get install -y --force-yes mysql-server
mysql -uroot -p${MYSQL_PASSWORD} -e "create database if not exists ${APP_NAME};"

# setup nginx configuration
apt-get install -y nginx
cat > /etc/nginx/sites-available/default <<EOF
server {
  listen          80;
  server_name     ${HOSTNAME};
  location / {
    proxy_pass      http://localhost:6000;
  }
}
EOF
sudo service nginx restart

Now, access http://${HOSTNAME} and finish the installation process. Easy!

CentOS/RHEL

APP_NAME="gogs"
MYSQL_PASSWORD="change_me"
HOSTNAME="example.com"

# setup mysql
yum install mysql-server -y
service mysql-server start
chkconfig mysql-server

mysqladmin -u root password "${MYSQL_PASSWORD}"
mysqladmin -u root --password="${MYSQL_PASSWORD}" password "${MYSQL_PASSWORD}"
mysql -u root -p${MYSQL_PASSWORD} -e "CREATE DATABASE IF NOT EXISTS ${APP_NAME}; use ${APP_NAME}; set global storage_engine=INNODB;"

# install nginx
rpm -Uhv http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
 yum install -y nginx

cat > /etc/nginx/conf.d/default.conf <<EOF
server {
  listen          80;
  server_name     ${HOSTNAME};
  location / {
    proxy_pass      http://localhost:6000;
  }
}
EOF

service nginx start
chkconfig nginx on

 

 

 

参考连接:https://packager.io/gh/gogs/gogs

没有评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注