Ubuntu 16.04 Xenial 64bits

Installation instructions

wget -qO- https://dl.packager.io/srv/pkgr/discourse/key | sudo apt-key add -
sudo wget -O /etc/apt/sources.list.d/discourse.list \
sudo apt-get update
sudo apt-get install discourse

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

Here is a quick way to get the app up and running with the accompanying database, redis, etc. required by Discourse. Note: all the commands must be run as root, or using sudo.

Installation of peripheral services and Configuration

Install postgres and redis:

bash apt-get install -y postgresql postgresql-contrib redis-server

Create a new postgres user:

bash echo "CREATE USER \"user\" SUPERUSER PASSWORD 'pass';" | su - postgres -c psql && \ echo "CREATE DATABASE discourse;" | su - postgres -c psql && \ echo "GRANT ALL PRIVILEGES ON DATABASE \"discourse\" TO \"user\";" | su - postgres -c psql

Set the various environment variables:

bash discourse config:set DATABASE_URL=postgres://user:pass@ discourse config:set REDIS_URL=redis:// discourse config:set SECRET_TOKEN=$(discourse run rake secret) # set this to the main admin email address discourse config:set DISCOURSE_DEVELOPER_EMAILS="someone@example.com" # set this to your server FQDN discourse config:set DISCOURSE_HOSTNAME=discourse.example.com

If this is the first installation, you’ll need to setup and seed the database:

bash discourse run rake db:migrate db:seed_fu

Scale the web and worker processes:

bash discourse scale web=1 worker=1

Install NginX to proxy requests from the outside world to your Discourse installation:

``` sudo apt-get install -y nginx

setup nginx configuration

cat > /etc/nginx/sites-available/default «EOF server { listen 80; server_name $(discourse config:get DISCOURSE_HOSTNAME); location / { proxy_pass http://localhost:6000; } } EOF # restart nginx sudo service nginx restart ```

You should now be able to access your Discourse instance on http://$DISCOURSE_HOSTNAME.


If you wish to send emails (and this is highly recommended to have a properly working Discourse installation), you can do so by installing postfix:

bash apt-get install postfix

Or, you can use a hosted service such as Mandrill (sign up and generate a new API key):

bash discourse config:set DISCOURSE_SMTP_ADDRESS="smtp.mandrillapp.com" discourse config:set DISCOURSE_SMTP_PORT="587" discourse config:set DISCOURSE_SMTP_USER_NAME="someone@example.com" discourse config:set DISCOURSE_SMTP_PASSWORD="API_KEY"

Don’t forget to sudo service discourse restart once you’ve modified the configuration.


bash apt-get update apt-get install discourse discourse run rake db:migrate

Available commands:

bash discourse logs # see all logs discourse run console # run a Rails console discourse config # inspect the environment variables used to configure discourse service discourse start/stop/restart/status