Debian 12 Bookworm 64 bits

Installation instructions

wget -qO- https://dl.packager.io/srv/gogs/gogs/key | sudo apt-key add -
sudo wget -O /etc/apt/sources.list.d/gogs.list \
  https://dl.packager.io/srv/gogs/gogs/main/installer/debian/12.repo
sudo apt-get update
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

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