Before you begin OSQA installation, you first need to get the source code from subversion. You can receive instruction on how to do this from our Download OSQA page . This guide covers the installation of OSQA on the Ubuntu operating system using a MySQL database. If you've achieved a successful installation on Windows, Mac, or any other OS, we are interested in adding your installation methods to our upcoming guides for those systems. To successfully install OSQA, simply perform the instructions in each section as you scroll down the page.
This doc was based on Ubuntu 10.4 but should work with older or newer versions with minor adaption (if any).
Checkout the OSQA source tree from Subversion:
For this tutorial, Apache will act as the web server for OSQA. Out of the box Apache will happily serve up static web content; for our purposes we'll also need to configure it to run the OSQA Python code.
In order to install the Apache web server and the Mod_WSGI Python support libraries on Ubuntu, run the following command:
Create a new file in the /home/osqa/osqa-server directory named osqa.wsgi. Copy the following contents into the file:
This server will be dedicated to running OSQA, so the default Apache configuration files will not be needed. Remove the default Apache configuration files:
Open a new OSQA configuration file for editing in /etc/apache2/sites-available with the following command:
Paste in the following content:
Link to the OSQA config in the sites-enabled directory:
OSQA can make use of MySQL for its database backend. This guide assumes that MySQL will be OSQA's database. The following steps will walk through how to install MySQL and set up the intial OSQA user and database.
Run the following command to install the MySQL client and server packages:
|MySQL Root User Password|
During the installation process, you will be prompted to configure the password for the root MySQL user. Make sure you make a note of this, as the password will be needed during future MySQL administration tasks.
Typical installations have a dedicated user in MySQL for OSQA. To add this user, first login to the MySQL console as the MySQL root user:
After supplying the root user password, you will be presented with the MySQL command prompt (mysql>). Enter the following command and press Enter to create the OSQA MySQL user:
OSQA uses its own "osqa" database within MySQL. To prepare this database you need to run the following two lines in the MySQL console. Enter the following lines, pressing Enter after each line to submit the command:
OSQA requires Python 2.x to run (this installation guide was tested against Python v2.6.6). Recent Ubuntu distributions have shipped with Python installed by default. To ensure that Python is installed on your machine, run this command:
If Python is not installed on your system, you can install Python by running the following command:
Having the Python setup tools handy will allow you to install the required libraries quickly and easily. Install python-setuptools by running this command:
OSQA depends on a number of other libraries to run successfully. Install the required libraries by executing the following commands:
|While these packages are also available from Ubuntu repositories, the easy_install method more reliably delivers the most recent version of the desired library.|
Change your directory to the osqa installation directory. Then copy and rename the file settings_local.py.dist to settings_local.py. You can do this with the following command:
Next, you will need to open the newly created settings_local.py file and edit it as specified below.
Osqa needs to know the server domain name so that it can use that information to create URLs, such as for email validation messages. Enter your domain name in the APP_URL field as shown below:
Now you will populate the blank MySQL osqa database with the necessary tables and data. From inside the OSQA directory, run the following command:
You will be prompted to create a new "super user." You should promptly answer "NO". Once you get your site running, create a new user through the normal OSQA account creation process and that will be your super user.
With that command you have successfully defined the schema. With South installed, you also have the ability to migrate between databases--a useful feature as OSQA is updated. However, as this is a fresh install, you will need to convince South that the schema is already up to date by "faking" a migration. You can do that with the following command:
With the database now prepared, you are ready to start the Apache server and begin using your new OSQA installation.
Apache will need read and write permissions to various OSQA files in order to support OSQA. The best way to give Apache read permissions to the OSQA files is to grant group ownership to the Apache group (www-data). The following command will make all OSQA files owned by the "osqa" user and the Apache group:
Apache will need write access to the templates/upfiles and log directories. The following commands will grant write permissions to the Apache group for those two directories:
Once all of the installation and configuration is complete, you can start Apache and OSQA. Do this by restarting the Apache instance to load the new configuration:
Apache will load OSQA as it starts back up. It should report "[ OK ]" when the restart is finished. You can check the status by examining the general Apache error log at /var/log/apache2/error.log and the OSQA-specific log at /var/log/apache2/osqa.error.log.
If everything started up ok, you can being using OSQA by visiting the this URL: http://localhost/