Tested on debian 10
# build deps
sudo apt install build-essential zlib1g-dev liblzma-dev libpq-dev libxml2-dev libxslt-dev \
ruby-dev ruby-bundler
# runtime deps
sudo apt install uwsgi-plugin-rack-ruby2.5 imagemagick \
pngquant optipng jhead jpegoptim gifsicle
sudo npm install -g svgo
# discourse
git clone https://github.com/discourse/discourse.git
cd discourse
bundle config build.nokogiri --use-system-libraries
bundle install --path vendor/bundle --without test development
sudo apt install redis-server postgresql
# lets create a postgres superuser for the current unix user
sudo -u postgres createuser -s "$USER"
DISCOURSE_DB_USERNAME=$USER RAILS_ENV=production bundle exec rake db:create db:migrate
pwgen 10
DISCOURSE_DB_USERNAME=$USER RAILS_ENV=production bundle exec rake admin:create
uwsgi --ini uwsgi.ini --env DISCOURSE_DB_USERNAME=$USER