How To Install Discourse Forum on Ubuntu 18.04 LTS
0

Discourse is a free and open supply dialogue discussion board software that can be utilized as a mailing listing and chat room. It’s a very highly effective and versatile platform that permits customers to login with Single Signal-On. It may be built-in with WordPress, Google Analytics, Zendesk, Patreon, Slack and lots of extra. It helps e-mail notifications, e-mail replies and varied authentication strategies resembling social networks, and single sign-on. It’s easy, straightforward to make use of, flat and comes with a built-in cellular format.

On this tutorial, we are going to learn to set up and configure Discourse discussion board on Ubuntu 18.04 server.

Necessities

  • A server operating Ubuntu 18.04.
  • A static IP deal with 192.168.0.101 is setup in your server.
  • A root password is setup to your server.

Getting Began

First, you have to to replace your server with the most recent model. You are able to do it with the next command:

apt-get replace -y
apt-get improve -y

As soon as your server is up to date, restart your system to use all of the adjustments

Subsequent, you have to to setup FQDN in your server. You are able to do it with the next command:

hostnamectl set-hostname check.instance.com

Subsequent, open /and many others/hosts file and add the next line:

nano /and many others/hosts

Add the next line:

192.168.0.101 check.instance.com check
 

Save and shut the file, when you find yourself completed. Then, run the next command to use all of the adjustments:

hostname -f

Subsequent, you have to to put in some required packages to your system. You may set up them with the next command:

apt-get set up nginx curl git wget unzip nano -y

After you have achieved, you’ll be able to proceed to the subsequent step.

Set up and Configure PostgreSQL

First, you have to to put in PostgreSQL to your system. You may set up it by operating the next command:

apt-get set up postgresql -y

After putting in PostgreSQL put in, log into PostgreSQL console with the next command:

sudo -u postgres psql

Subsequent, create a database and person for Discourse with the next command:

postgres=#CREATE DATABASE discoursedb;
postgres=#CREATE USER discourseuser;
postgres=#ALTER USER discourseuser WITH ENCRYPTED PASSWORD 'password';
postgres=#ALTER DATABASE discoursedb OWNER TO discourseuser;

Subsequent, hook up with discoursedb and create hstore and pg_trgm extension with the next command:

postgres=#c discoursedb;
postgres=#CREATE EXTENSION hstore;
postgres=#CREATE EXTENSION pg_trgm;

Lastly, exit from the PostgreSQL with the next command:

postgres=#q

Set up Ruby

Subsequent, you have to to put in newest model of Ruby to your system. You may set up Ruby utilizing RVM.

First, set up GNU privateness guard with the next command:

apt-get set up gnupg2 -y

Subsequent, import the general public of Ruby model supervisor with the next command:

gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

You must see the next output:

gpg: keybox '/root/.gnupg/pubring.kbx' created
 gpg: key 105BD0E739499BDB: 6 signatures not checked resulting from lacking keys
 gpg: /root/.gnupg/trustdb.gpg: trustdb created
 gpg: key 105BD0E739499BDB: public key "Piotr Kuczynski <[email protected]>" imported
 gpg: key 3804BB82D39DC0E3: 103 signatures not checked resulting from lacking keys
 gpg: key 3804BB82D39DC0E3: public key "Michal Papis (RVM signing) <[email protected]>" imported
 gpg: no in the end trusted keys discovered
 gpg: Whole quantity processed: 2
 gpg:               imported: 2
 

Subsequent, set up RVM with default Ruby and Rails with the next command:

curl -sSL https://get.rvm.io | bash -s secure --rails

After putting in Ruby and Rails, you have to to supply RVM scripts. You are able to do it with the next command:

supply /usr/native/rvm/scripts/rvm

Now you can see the Ruby variations with the next command:

rvm listing

You must see the next output:

=* ruby-2.6.3 [ x86_64 ]
 
 # => - present
 # =* - present && default
 #  * - default
 

Set up and Configure Discourse

First, you have to to obtain the most recent model of Discourse from the Git repository. You may obtain it with the next command:

cd /var/www/
git clone https://github.com/discourse/discourse.git

Output:

Cloning into 'discourse'...
 distant: Enumerating objects: 57, achieved.
 distant: Counting objects: 100% (57/57), achieved.
 distant: Compressing objects: 100% (37/37), achieved.
 distant: Whole 403387 (delta 26), reused 34 (delta 20), pack-reused 403330
 Receiving objects: 100% (403387/403387), 267.39 MiB | 235.00 KiB/s, achieved.
 Resolving deltas: 100% (252384/252384), achieved.
 Testing information: 100% (27055/27055), achieved.
 

Subsequent, take a look at the most recent secure launch of Discourse with the next command:

cd discourse
git checkout v2.2.4

Subsequent, set up Ruby dependency supervisor with the next command:

/usr/native/rvm/src/ruby-2.6.3/bin/gem set up bundler -v '1.17.3'

You must see the next output:

Fetching bundler-1.17.3.gem
 Efficiently put in bundler-1.17.3
 Parsing documentation for bundler-1.17.3
 Putting in ri documentation for bundler-1.17.3
 Finished putting in documentation for bundler after 15 seconds
 1 gem put in
 

Subsequent, you have to to put in some further packages to compile supply code. You may set up all of them with the next command:

apt-get set up gcc ruby-dev libxslt-dev libxml2-dev zlib1g-dev libpq-dev imagemagick redis-server optipng pngquant jhead jpegoptim gifsicle -y

Subsequent, set up all of the dependencies required by Discourse with the next command:

RAILS_ENV=manufacturing bundle set up --path vendor/bundle/

Subsequent, rename Discourse default configuration file with the next command:

mv config/discourse_defaults.conf config/discourse.conf

Subsequent, open discourse.conf file and outline your database settings:

nano config/discourse.conf

Change the next strains:

db_host = localhost
 db_port = 5432
 db_name = discoursedb
 db_username = discourseuser
 db_password = password
 hostname = "test.example.com"
 

Save and shut the file. Then, edit the manufacturing atmosphere config file with the next command:

nano /var/www/discourse/config/environments/manufacturing.rb

Add the next line because the third line

require 'uglifier'
 

Then, discover the next line:

config.belongings.js_compressor = :uglifier

And substitute it with the next:

config.belongings.js_compressor = Uglifier.new(concord: true)

Save and shut the file, when you find yourself completed. Then, put together Discourse for manufacturing with the next command:

RAILS_ENV=manufacturing bundle exec rake db:migrate
RAILS_ENV=manufacturing bundle exec rake belongings:precompile

Subsequent, open puma.rb file with the next command:

nano /var/www/discourse/config/puma.rb

Discover the next line:

APP_ROOT = '/house/discourse/discourse'

Change it with the next line:

APP_ROOT = '/var/www/discourse'

Save and shut the file, when you find yourself completed. Then, create the sockets and course of ID listing with the next command:

mkdir /var/www/discourse/tmp/sockets/
mkdir /var/www/discourse/tmp/pids/

Lastly, begin the Discourse by operating the next command:

RAILS_ENV=manufacturing bundle exec puma -C /var/www/discourse/config/puma.rb

You must see the next output:

[29834] Puma beginning in cluster mode...
 [29834] * Model 3.11.4 (ruby 2.6.3-p62), codename: Love Track
 [29834] * Min threads: 8, max threads: 32
 [29834] * Surroundings: improvement
 [29834] * Course of employees: 4
 [29834] * Preloading software
 
 [29834] * Listening on unix:///var/www/discourse/tmp/sockets/puma.sock
 [29834] ! WARNING: Detected Three Thread(s) began in app boot:
 [29834] ! #<Thread:[email protected]/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.0.pre.1/lib/message_bus.rb:667 sleep> - /var/www/html/discourse/vendor/bundle/ruby/2.6.0/gems/hiredis-0.6.1/lib/hiredis/ext/connection.rb:19:in `learn'
 [29834] ! #<Thread:[email protected]/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.0.pre.1/lib/message_bus/timer_thread.rb:38 sleep> - /var/www/html/discourse/vendor/bundle/ruby/2.6.0/gems/message_bus-2.2.0.pre.1/lib/message_bus/timer_thread.rb:123:in `sleep'
 [29834] ! #<Thread:[email protected]/var/www/discourse/lib/discourse.rb:584 sleep> - /var/www/discourse/lib/discourse.rb:587:in `sleep'
 [29834] * Daemonizing...
 

Subsequent, create an admin account to entry Discourse net interface with the next command:

cd /var/www/discourse
RAILS_ENV=manufacturing bundle exec rake admin:create

Present your e-mail and password as proven under:

E mail:  [email protected]
 Password:  
 Repeat password:  
 
 Guaranteeing account is energetic!
 
 Account created efficiently with username instance
 Do you need to grant Admin privileges to this account? (Y/n)  Y
 
 Your account now has Admin privileges!
 

Subsequent, restart the Discourse service with the next command:

RAILS_ENV=manufacturing bundle exec pumactl -P /var/www/discourse/tmp/pids/puma.pid restart

Configure Nginx for Discourse

Subsequent, you have to to configure Nginx as a reverse proxy to entry Discourse net interface on port 80.

First, copy the pattern Nginx digital host configuration file with the next command:

cp /var/www/discourse/config/nginx.pattern.conf /and many others/nginx/conf.d/discourse.conf

Subsequent, open the discourse.conf file with the next command:

nano /and many others/nginx/conf.d/discourse.conf

Make the next adjustments:

#upstream discourse {
 #    server unix:/var/www/discourse/tmp/sockets/skinny.0.sock;
 #    server unix:/var/www/discourse/tmp/sockets/skinny.1.sock;
 #    server unix:/var/www/discourse/tmp/sockets/skinny.2.sock;
 #    server unix:/var/www/discourse/tmp/sockets/skinny.3.sock;
 #}
 
 upstream discourse {
        server unix:/var/www/discourse/tmp/sockets/puma.sock;
  }
 server_name check.instance.com;
 

Save and shut the file, when you find yourself completed. Then, create the cache listing with the next command:

mkdir -p /var/nginx/cache/

Subsequent, verify the Nginx for any syntax error with the next command:

nginx -t

Output:

nginx: the configuration file /and many others/nginx/nginx.conf syntax is okay
 nginx: configuration file /and many others/nginx/nginx.conf check is profitable
 

Subsequent, restart Nginx to use all of the adjustments:

systemctl restart nginx

You can even verify the standing of Nginx with the next command:

systemctl standing nginx

Output:

? nginx.service - A excessive efficiency net server and a reverse proxy server
    Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
    Energetic: energetic (operating) since Solar 2019-05-26 04:19:12 UTC; 29min in the past
      Docs: man:nginx(8)
   Course of: 1052 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, standing=0/SUCCESS)
   Course of: 848 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, standing=0/SUCCESS)
  Fundamental PID: 1065 (nginx)
     Duties: 3 (restrict: 1114)
    CGroup: /system.slice/nginx.service
            ??1065 nginx: grasp course of /usr/sbin/nginx -g daemon on; master_process on;
            ??1066 nginx: employee course of
            ??1067 nginx: cache supervisor course of
 
 Might 26 04:19:04 ubuntu1804 systemd[1]: Beginning A excessive efficiency net server and a reverse proxy server...
 Might 26 04:19:12 ubuntu1804 systemd[1]: nginx.service: Did not parse PID from file /run/nginx.pid: Invalid argument
 Might 26 04:19:12 ubuntu1804 systemd[1]: Began A excessive efficiency net server and a reverse proxy server.
 

You additionally want to repeat the next JS file should you get any error to entry Discourse net inetrface:

cp /var/www/discourse/public/belongings/_vendor-3eae3eec8fba033cb1b5af6c103a5b8781caa69cf97fe7773ba89ba68980b263.js /var/www/discourse/public/belongings/vendor-3eae3eec8fba033cb1b5af6c103a5b8781caa69cf97fe7773ba89ba68980b263.js

Entry Discourse Web Interface

Discourse is now put in and configured, it is time to entry Discourse net interface.

Open your net browser and kind the URL http://test.example.com. You can be redirected to the next web page:

Discourse web interface

Now, click on on the Log In button. You must see the next web page:

Login to Discourse

Now, present your username and password. Then, click on on the Log In button. You must see the next web page:

Discourse user dashboard

Now you can begin the Setup wizard utilizing the URL http://test.example.com/wizard in your net browser. You must see the Welcome display within the following web page:

Setup Wizard

Now, choose your language and click on on the Subsequent button. You must see the next web page:

Select language

Right here, kind your matter and click on on the Subsequent button. You must see the next web page:

Configure Access Priveliges

Right here, choose Public and click on on the Subsequent button. You must see the next web page:

Enter contact details

Right here, present your e-mail and make contact with web page. Then, click on on the Subsequent button. You must see the next web page:

Organization settings

Right here, present your organization title and deal with. Then, click on on the Subsequent button. You must see the next web page:

Choose a theme

Now, choose your theme and click on on the Subsequent button. You must see the next web page:

Upload Logo for Discourse website

Now, add your brand and click on on the Subsequent button. You must see the next web page:

Upload Icons

Now, choose Icons and click on on the Subsequent button. You must see the next web page:

Set Homepage Title

Now, choose your property web page and click on on the Subsequent button. You must see the next web page:

Select Emojis

Now, choose Emoji as you would like and click on on the Subsequent button. You must see the next web page:

Invite Staff

Now, invite your employees to affix this discussion board and click on on the Subsequent button. As soon as the set up has been accomplished, You must see the next web page:

Discourse is ready

Now, click on on the Finished button. You can be redirected to the Discourse dashboard proven within the following web page:

Discourse has been setup successfully

Congratulations! you’ve efficiently put in and configured Discourse discussion board on Ubuntu 18.04 server.

Debunked: The absurd story about smartphones inflicting children to sprout horns

Previous article

Microsoft OneDrive will get a safer Private Vault, plus extra storage choices

Next article

You may also like

Comments

Leave a Reply