Note: these instructions are written specifically for Raring Ringtail (Ubuntu 13.04) and are not guaranteed to work on other releases. Please leave a comment below if you are using a newer release and having difficulty with the instructions.
Discourse is a modern Q&A platform brought to you by the same people that wrote Stack Overflow (or some of them anyway). Being the curious type, I decided to install all of the prerequisites and document the installation process below.
This process is quite involved but should work if you carefully follow the instructions. These instructions are a blend of what you find here, what you find here, and some of my own wisdom.
PostgreSQL is an integral part of Discourse, so naturally it is important that we set up the PostgreSQL server properly.
Install the server:
sudo apt-get install postgresql postgresql-contrib postgresql-server-dev-9.1
Open a terminal and run the following command:
sudo -u postgres psql postgres
We now have a PostgreSQL interactive prompt, which we can use to create the user and database we will need later.
Enter the following command at the prompt:
CREATE USER xxx WITH PASSWORD '123' SUPERUSER;
Replace xxx with your username. If you're not sure what your username is, run the appropriately named whoami
command. The password is not important and can be set to any value.
Now create the database that Discourse will later use with the following command:
CREATE DATABASE xxx;
Replace xxx with your username. This creates the database and assigns the discourse
user we previously created as the owner.
Redis acts as a key/value store, providing a simple but extremely efficient means of caching data.
Install Redis:
sudo apt-get install redis-server
That's it. (Easy, huh?)
Discourse is written in Ruby, so it only follows that we need the interpreter to run the application.
In addition to the ruby
package, we also need bundler
. Note that we use a specific version of Ruby:
sudo apt-get install ruby1.9.3 bundler
That's it. (This is almost fun, eh?)
Now for the fun part.
Navigate to a directory of your choice where the Discourse source code will be installed. For the sake of this example, we will use ~/discourse
.
Clone the Discourse Git repository:
sudo apt-get install git
git clone git://github.com/discourse/discourse.git
Copy the configuration templates to their appropriate locations:
cp config/database.yml.development-sample config/database.yml
cp config/redis.yml.sample config/redis.yml
Open the config/database.yml
file in a text editor of your choice. Edit the contents to match what you see below:
development:
adapter: postgresql
database: xxx
pool: 5
timeout: 5000
host_names:
- localhost
Again, replace xxx with your username.
Open the config/redis.yml
file and edit the contents to match what you see below:
development:
uri: redis://localhost:6379
host: localhost
port: 6379
password:
db: 0
cache_db: 2
Next run the following command to install all required gems:
bundle install
rake db:migrate
Note that these commands may take some time to complete.
Launch the server with the following command:
bundle exec rails server
If everything installed without error, then you should be able to open the following link in your browser to view your new installation:
Download the official 2buntu app for both Android and Ubuntu Touch.