8

I have a spare Ubuntu machine lying around and I would like to install Discourse on it.

How do I do this? I'm running Ubuntu 13.04.

4
  • 1
    The instructions assume you need vagrant to install Ubuntu, and are apparently geared towards people mainly using Windows or Mac and who would benefit from a separate VM to install and play with discourse. If Seth has an "ubuntu machine lying around" with 13.04 already installed, he can just clone the git repo and set it up locally.
    – roadmr
    Jun 4, 2013 at 20:28
  • Also, it's useful for us to have instructions pertaining to Ubuntu directly on this site. Hopefully given by someone who has done this.
    – Seth
    Jun 4, 2013 at 20:31
  • Setting things up locally and manually is documented here: github.com/discourse/discourse/blob/master/docs/…. However it does seem a bit complex, the vagrant VM has all the needed services (pgsql, redis) already preconfigured so may be easier to get started with.
    – roadmr
    Jun 4, 2013 at 20:48
  • @chaskes it's not strictly required, as described in my second comment you can install and configure the needed services manually. It does look like using Vagrant is easier.
    – roadmr
    Jun 4, 2013 at 20:53

6 Answers 6

7

The instructions assume you need vagrant to install Ubuntu, and are apparently geared towards people mainly using Windows or Mac and who would benefit from a separate VM to install and play with discourse. If Seth has an "Ubuntu machine lying around" with 13.04 already installed, he can just clone the git repo and set it up locally.

Setting things up locally and manually is documented here on GitHub. However it does seem a bit complex, the vagrant VM has all the needed services (pgsql, redis) already preconfigured so may be easier to get started with.

That said, if you're feeling brave, you can follow these steps to install and configure things on your local Ubuntu machine.

Disclaimer, it is a complex procedure that involves many moving parts, I tested this procedure on a freshly installed 13.04 system but if things go wrong, you should be prepared to decypher error messages and fix things. You should be comfortable with:

  • Ubuntu package installation.
  • Text file editing.
  • Having some knowledge of Postgres commandline usage.
  • Being minimally familiar with Ruby, Rails and rubygems.
  • Some git doesn't hurt, but it's only used for the initial cloning phase

OK, here goes

Install needed packages:

sudo apt-get install git ruby ruby-bundler build-essential libxml2-dev libxslt1-dev redis-server postgresql libpq-dev postgresql-contrib-9.1

Create a postgresql database and grant permissions to the user who is going to run discourse (I'll assume it's named "john", it could/should be your username):

sudo -u postgres createdb discourse_development
sudo -u postgres psql -c "create user john with password 'whatever' "
sudo -u postgres psql -c "grant all privileges on database discourse_development to john"
#This is a bit of postgresql magic to add the required hstore and pg_trgm extensions
sudo -u postgres psql discourse_development -c "create extension hstore; create extension pg_trgm"

Clone the repository:

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

Use Bundler to install ruby gems and dependencies including rails:

bundle install

You may run into dependency problems here, as other packages may be needed to build native extensions. If you get yellow text with errors in this step, look at the error messages to figure out which packages to install (with apt-get).

Configure the database data (postgres and redis):

cp config/redis.yml.sample config/redis.yml
cp config/database.yml.sample config/database.yml
# Now edit config/database.yml and in the discourse_development section add
# username: john
# password: whatever
# Follow the format for the other entries (adapter:, database:)

Run the migrations to initialize the database, then seed it:

bundle exec rake db:migrate
bundle exec rake db:seed_fu
sudo -u postgres psql discourse_development < pg_dumps/production-image.sql

then launch the development web server:

bundle exec rails s

Finally, open your browser and connect to the local dev server at

http://localhost:3000
3
  • Unfortunately this didn't work for me. I got errors with all the bundle commands. They seem to be caused by changes to Discourse since you posted the directions. I may try again, and I may not.. I will let you know what happens.
    – Seth
    Jun 10, 2013 at 4:18
  • Well I purged and tried again and followed the similar instructions here: 2buntu.com/1332/installing-discourse-on-ubuntu I'm really not sure why those worked..
    – Seth
    Jun 10, 2013 at 23:08
  • The Vagrant image is the recommended setup for development as it gets you up and running tests with minimal effort.
    – MikeyB
    Jul 20, 2013 at 23:13
6

Cloud deployment (with Juju)

If you have a cloud provider and want to skip a lot of manual jumping around, you can use the Juju charm!

After you've successfully bootstrapped an environment, run the following:

juju deploy cs:~marcoceppi/discourse
juju deploy postgresql

Then create relations

juju add-relation discourse postgresql:db-admin

Discourse requires db-admin level access in order to enable the hstore plugin. Finally, expose discourse:

juju expose discourse

Configuration and other caveats can be found in the Charm's README. These options include configuring admins, where to fetch the Discourse source, version pinning, and other tuning options.

Disclaimer, I am the author of this charm.

1
  • 1
    I actually like this answer better than mine :) (Juju FTW). My only concern would be, you're saying "if you have a cloud provider", but the OP clearly mentions he just has a spare Ubuntu machine lying around. Could you perhaps provide, or point to, instructions on how to set up this lone machine as a juju provider? (maybe set it up as a local provider, I've done this with varying degrees of success). Then this would look like the easiest way to deploy discourse.
    – roadmr
    Jun 5, 2013 at 13:43
5

Bare Metal

I've just completed an article describing this exact process

In summary, you need to:

  • Install and configure PostgreSQL
  • Install Redis and Ruby 1.9.3+
  • Clone the Discourse Git repository
  • Make the appropriate config. changes
  • Run bundle exec rails server
1
  • This is out of date and missing many steps. Aug 7, 2018 at 0:36
4

The project itself also has documentation on how to install on Ubuntu using Docker (which is the only officially supported way):

For development you can use this program which is a simple single command after you install Docker.

1
  • The linked instructions are the official recommendation for production deployments. If you have any feedback or suggestions, please do let us know!
    – MikeyB
    Jul 20, 2013 at 23:14
0

At Bitnami we have completely Linux installers for Discourse and Ubuntu-based virtual machines and cloud images for Amazon, Azure. You can check it out at the Bitnami Discourse page

(Disclaimer, I am one of the developers of Bitnami :)

0

You can use Cloud 66 EasyDeploy

Cloud 66 EasyDeploy

Which means you can then deploy Discourse on AWS, DigitalOcean, Rackspace, Linode or Joyent with a couple of clicks (and get a lot more like DB backups, scaling and monitoring as well!)

DISCLAIMER: I work for Cloud 66.

4
  • 1
    Could you provide some instructions for doing this within your answer?
    – Seth
    Oct 3, 2013 at 16:31
  • Is this service free of cost?
    – jokerdino
    Oct 3, 2013 at 16:54
  • All you need to do to deploy Discourse with Cloud 66, is to signup for an account at cloud66.com, and use the Git URL to build a new stack. The whole process is a wizard so should be very straight forward and you can find general Cloud 66 Stack help at help.cloud66.com/getting-started/your-first-stack.html
    – Khash
    Oct 4, 2013 at 10:34
  • You can find information about features and pricing at www.cloud66.com
    – Khash
    Oct 4, 2013 at 10:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .