Revision history [back]
At the risk of asking the obvious... have you seen the installation docs? True, they don't cover everything in great detail but they're evolving. Always check the docs before following anything here. This is only intended to help fill in some detail and they will probably be updated more frequently and thus, these steps may be out of date by the time someone reads this.
These may not be the absolute best docs and I make no guarantees they are the most secure or efficient but generally, this is how I got myself up and running on RHEL 6 with Postgres 9.2, Askbot 0.7.48. I'm doing this from memory so it may be missing a detail or two. Hopefully it will help you and maybe others.
Speaking of others, if anyone has things to add or fix, comments are of course welcome!
- Install Postgres (this will vary depending on what platform you're on and whether you want to install from source or use a package manager). Using a package manager is much easier (not sure if the devel package is needed but I always install it). I wanted to use Postgres 9.2 which wasn't available by default in my repo list, so I added the PGDG repo.
- Download the Postgres 9.2 RPM (look up the correct file for your distribution here)
wget http://yum.pgrpms.org/9.2/redhat/rhel-6-x86_64/pgdg-redhat92-9.2-7.noarch.rpm
- Install the RPM
sudo rpm -i pgdg-redhat92-9.2-7.noarch.rpm
- Download the Postgres 9.2 RPM (look up the correct file for your distribution here)
- Install the Postgres packages
sudo yum install postgresql92-server.x86_64 postgresql92-devel.x86_64
.
- If yum complains that there's no match, do a
sudo yum search postgres
to see what is available. There may be a packages with the version in the name likepostgresql92-server.x86_64
. Or if there's an existing Postgres package that is a version you're happy with, you can skip the steps for installing the RPM.
- If yum complains that there's no match, do a
- Initialize Postgres
sudo /etc/init.d/postgresql-9.2 initdb
- Start Postgres
sudo /etc/init.d/postgresql-9.2 start
- Create an admin user so you can administer the database
sudo su
su postgres
psql postgres
You're now in the postgres console (I'll indicate that with a
#
at the beginning of the line but don't type that). Create your user for administrating the site and change the password for the defaultpostgres
user for security.
# CREATE USER yourusername WITH SUPERUSER PASSWORD 'yoursecretpassword';
# ALTER ROLE postgres PASSWORD 'SomeSecretSuperPassword';
# \q
Edit the Postgres host authentication file which will allow you to connect from the localhost
sudo vi /var/lib/pgsql/9.2/data/pg_hba.conf
edit the line that starts withlocal
at the bottom to the following:
local all all md5
- Restart Postgres
sudo /etc/init.d/postgresql-9.2 restart
- Add the Postgres binaries to your path
sudo su
echo 'PATH=/usr/pgsql-9.2/bin:$PATH' >> /etc/profile.d/postgres_paths.sh && chmod 0755 /etc/profile.d/postgres_paths.sh
- You may need to source this file now in order to add the binaries to your path for use now
source /etc/profile.d/postgres_paths.sh
- Create a database user for askbot. This is interactive. Answer as indicated below.
createuser -U yourusername --interactive askbot_user -P
Enter password for new role:
(enter a password)
Enter it again:
(enter it again)
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
- Create the database named
askbot
owned by the askbot_user (by default the database will be owned by the user creating it, specified by the -U option, but we explicitly set it as well here for good measure)
createdb -U askbot_user -E utf8 -O askbot_user askbot -T template0
Password:
(enter the password for askbot_user) Make sure some variables are pre-set the way askbot expects
psql -U yourusername
# ALTER ROLE django IN DATABASE "shotgun-askbot" SET client_encoding = 'UTF8';
# ALTER ROLE django IN DATABASE "shotgun-askbot" SET default_transaction_isolation = 'read committed';
# ALTER ROLE django IN DATABASE "shotgun-askbot" SET timezone = 'UTC';
\q
Install virtualenv
sudo pip install virtualenv
- Install virtualenvwrapper
sudo pip install virtualenvwrapper
- Create your virtualenv
mkvirtualenv askbotdev
- Activate your virtualenv (should be active already but just in case)
workon askbotdev
- Install pyscopg2
pip install psycopg2
- If this generates an error, you may need to install
gcc
and/orpython-devel
(I had to install both). Then retry installing psycopg2 again.
sudo yum install gcc
sudo yum install python-devel.x86_64
- If this generates an error, you may need to install
- Install askbot (again, this depends on how you want to install things. I'm using a clone of the GitHub repo which is intended to be pretty stable. This worked for me the best. If you want to use the package as-is from the latest official release you can follow the instructions in the docs. But these will describe cloning from GitHub.
- clone the GitHub repo to the directory called
askbot-src
in your home directory.
cd ~
git clone https://github.com/ASKBOT/askbot-devel.git askbot-src
- Run the askbot setup.py which will download and install all of the required python modules (into your virtualenv because that's what's active). The
develop
parameter ensures that askbot will not be installed as a packaged module. Instead it will be linked to the github repo you just cloned.
cd askbot-src
python setup.py develop
- create a directory for your project in your home directory
cd ~/
mkdir projects
cd projects
askbot-setup
(answer the questions presented to you)
- clone the GitHub repo to the directory called
- Initialize the database. (answer
yes
when asked if you want to create a superuser and provide the username and password. This will be the admin account for your site).
python manage.py syncdb
- Run the database migrations to bring the database up to date.
python manage.py migrate askbot
python manage.py migrate django_authopenid
- Start the development server to see if we're rockin'
python manage.py runserver 0:0:0:0:8000
which will use any available interface for the server. The port can be anything above 1024 that isn't in use, 8000 is a good standard. - Open your web browser and navigate to the server on port 8000. If you're running this locally, http://localhost:8000 or http://127.0.0.1:8000.