Setting Up PostgreSQL
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
Now create the database that Discourse will later use with the following command:
git clone git://github.com/discourse/discourse.gitsudo -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 thediscourseuser we previously created as the owner. Setting Up RedisRedis acts as a key/value store, providing a simple but extremely efficient means of caching data.
Install Redis:
sudo apt-get install redis-serverSetting Up Ruby
Discourse is written in Ruby, so it only follows that we need the interpreter to run the application.
In addition to therubypackage, we also needbundler. Note that we use a specific version of Ruby:
sudo apt-get install ruby1.9.3 bundlerSetting Up Discourse
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
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
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:
http://localhost:3000
For more detail
use following links
http://www.rosehosting.com/blog/how-to-install-and-setup-discourse-on-an-ubuntu-12-04-vps
https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-ubuntu-for-development/14727
No comments :
Post a Comment