Category: Ubuntu

Tutorial on how to Install Apache, Subversion and Trac with Virtual Hosting suppor in Ubuntu Linux

We recently had to setup Apache, Subversion and Trac all within a virtual hosting environment for one of our Clients to be able to develop easily and effictively among team members. They wanted to use multiple domain names for separate projects. Made sense to us, so we started looking for instructions on setting this up.

We wanted to setup LigHTTPD, however it’s not nearly as easy because of no svn-dav module available, so we stuck with Apache 2 for now.

We found a howto on doing this, however there were a few vital steps and explanations missing so we’ve re-written it in hopes it will help others the trouble of searching to find this information.

So, lets move on to the tutorial shall we.

First install the required packages on your system. We started with a clean Ubuntu JEOS 8.0.4 Install on our server.

# sudo aptitude install enscript libapache2-mod-python python-docutils trac db4.3-util libapache2-svn subversion-tools

Now create a virtual host for your SVN container.

# mkdir -p /var/local/svn/

Now create a development group, and add the web user to it.

# addgroup svngroup; adduser www-data svngroup

Now Add a user to the system and add them to that group

# adduser username
# passwd username

Now add that user to the group required for SVN

# adduser username svngroup

Now setup the permissions for your SVN site.

# chmod 2770 /var/local/svn/

Now setup the repo as you normally would

# svnadmin create /var/local/svn/

Remove the current password file. We’re using HTTPS (or HTTP) instead of SVNSERVE so no need for it.

# rm /var/local/svn/
# touch /var/local/svn/

Allow your group to write to the repo

# chmod -R g+w www-data:svngroup /var/local/svn/

Now set the repo access permissions.

# nano /var/local/svn/

It should look something similar to the following. If in doubt, refer to the Path-Based Auth section of Subversion.


svngroup = username1,username2,username2

@svngroup = rw

Now, create a log directory within apache for your development site.

# mkdir /var/log/apache2/

Now create your virtual host.

# nano /etc/apache2/sites-available/

Copy the following in, editing to suit your environment. Note we’re using a self signed certificate, you can change this to a properly signed one if you have it.

<VirtualHost [server’s IP address]:443>
<Location />
DAV svn
AuthType Basic
AuthName “”
AuthUserFile /var/local/svn/
AuthzSVNAccessFile /var/local/svn/
SVNPath /var/local/svn/
Require valid-user
CustomLog /var/log/apache2/ combined
ErrorLog /var/log/apache2/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/selfsigned.pem
# Add this once there is a real (non self-signed) certificate.
# SSLCertificateKeyFile /etc/apache2/ssl/server.key
<VirtualHost [server’s IP address]:80>
Redirect /

Now, enable the site

# a2ensite

Now, create a username and password to access the svn site.

# htpasswd /var/local/svn/ username1

Now, create your SSL certificate. Details are here if you need them.

# sudo aptitude install ssl-cert

Now, we found out that the default Ubuntu SSL cert is only for 30 days, so, we changed this to be 365 a little more sane no? Thanks for the tip Devio.

# which make-ssl-cert
# nano /usr/sbin/make-ssl-cert

Replace the line near the bottom that looks like this

openssl req -config $TMPFILE -new -x509 -nodes -out $output -keyout $output

With a line that looks like this instead

openssl req -config $TMPFILE -new -x509 -days 365 -nodes -out $output -keyout $output

Exit and save the file. Now we’re ready to generate our final self signed SSL certificate for Apache on Ubuntu. Like this;

# make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/ssl/certs/selfsigned.pem

Make sure to set your “common name” to your server name – ie:

Now you can go ahead and restart Apache to verify your DAV enabled SVN site functions.

# /etc/init.d/apache2 restart

To verify, hit it’s url in a browser

If everthing was successful, you now have SVN setup, with WEB-Dav support in Apache2 on Ubuntu. Continue to setup Trac.

First we have to create the web directory for Trac.

# mkdir -p /var/local/trac/

Now we setup the permissions

# chmod 2770 /var/local/trac/

Create a Trac instance for your project

# trac-admin /var/local/trac/ initenv

Setup the proper ownerships for the directory

# chown -R www-data:svngroup /var/local/trac/

Now make sure the group is added to the repo

# chmod -R g+w /var/local/trac/

Configure Trac where required

# nano /var/local/trac/

Create a directory for log files

# mkdir /var/log/apache2/

Now create a virtual host for your trac instance

# nano /etc/apache2/sites-available/

Now, copy the following into the virtual host configuration, changing to suit your domain and configuration

# Trac Configuration
<VirtualHost [server’s IP address]:80>
Redirect /
<VirtualHost [server’s IP address]:443>
DocumentRoot /var/local/trac/
Alias /trac/ /usr/share/trac/htdocs
<Directory “/usr/share/trac/htdocs/”>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
<Location />
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonInterpreter main_interpreter
PythonOption TracEnv /var/local/trac/
PythonOption TracUriRoot /
AuthType Basic
AuthName “”
# Use the SVN password file.
AuthUserFile /var/local/svn/
Require valid-user
CustomLog /var/log/apache2/ combined
ErrorLog /var/log/apache2/
SSLEngine on
SSLCertificateFile /etc/ssl/certs/selfsigned.pem
# Add this once there is a real (non self-signed) certificate.
# SSLCertificateKeyFile /etc/apache2/ssl/server.key

Now, enable this virtual host as well

# a2ensite

Configure Trac Permissions for your Trac instance.

# trac-admin /var/local/trac/

Use the following commands to view permissions, and set permissions.

“help permission”

We set the following permissions to one of our users from the command line

# trac-admin /var/local/trac/ permission add username1 TRAC_ADMIN

Now you’re ready to restart Apache with your new Trac VHOST.

# /etc/init.d/apache2 restart

Now you’re ready to restart Apache and visit your Trac installation

Login with your user (username1) and password you setup earlier.

We hope this tutorial helps others when trying to setup SVN and Trac on Ubuntu with Virtual Hosts. Let us know if you have any other handy tips!

Installing Habari Blog on Ubuntu Server to Replace WordPress

You may have heard of Habari, you may not have. It’s yet another blogging software, written from the ground up to take advantage of all the latest technologies available. For this reason it’s not supported everywhere and probably is why you haven’t heard of it yet.

I think this software could replace WordPress if done correctly, it will just take some time to get a little more robust, but the guts of it is definately there.

We recently installed Habari on one of our sites, and written this quick tutorial on how to get it going on your Ubuntu server using Apache.

We assume you’ve already got Mysql, PHP, SQLite and Apache installed on your server. If not, find some Howto’s on that because we’re not discussing it here.

So, first install some pre-requisite software:

# apt-get install libmysqlclient15-dev
# pecl install pdo pdo_mysql pdo_sqlite
# apt-get install sqlite3 libsqlite3-dev php5-sqlite3
# apt-get install php5-dev subversion

Now edit your php.ini

# nano /etc/php5/apache2/php.ini

add this to the bottom of the file:

Now restart apache

# /etc/init.d/apache2 restart

Now create your Apache Virtual Host as per usual for your site.

Now enter your sites directory

# cd /home/username/public_html/

Create the .htaccess file

# nano .htaccess

Enter something similar to the following for the contents of the htaccess file you just created.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /
RewriteRule . index.php [PT]

Order deny,allow
deny from all

Now download the Habari SVN

# svn checkout .

We are using the MPM-ITK module with Apache. This means that all our sites are running per user, instead of as a global user. This is much more secure for multiple user or site environments. It’s very easy to get going in Ubuntu. Just do this.

# apt-get install apache2-mpm-itk

Then add this to whichever vhost you’re containing Habari

<IfModule mpm_itk_module>
AssignUserId username groupname

This means we don’t have to setup crazy permissions for the Habari installer to function. If you don’t want to install MPM-ITK then you can simply follow the Habari Installation Instructions.

Now, to complete the install visit your site through

The settings we used are the following:

Set as “En-US”

Database Setup:
Database Type: sqlite
Data File:
Table Prefix: habari__

Site Configuration:
Site Name: Site Name
Username: admin
Password: Your Password
Password: Your Password Repeated
Admin Email:

Plugins We left Enabled:
– Core Dash Modules
– Habari Media Silo
– Pingback
– Spam Checker
– Undelete


We did have an error during installation when using SQLITE3. We had to modify the default Habari database schema to remove the “IF NOT EXIST” lines. Not sure why this was needed as apparently this support was added in Sqlite 3.3 and Ubuntu comes with 3.4 but whatever, very simple fix for the problem.


Once this is done you should be complete the setup of Habari and can go ahead and install some Plugins or Themes.

We hope you enjoyed this tutorial, let us know if you have any other interesting Habari tips or tricks.

Howto Setup Permissions for Joomla on Plesk with Ubuntu

Most of the howto’s or tutorials we came across about this problem all mention to install suphp and run php as a cgi through it. We weren’t happy with this solution, so we did something different.

Basically the problem is:

Plesk runs apache as “www-data:www-data” while the users are “username:psacln”. So, uploading via sftp or ftp will work fine, but when you go to install something from the control panel in Joomla, it will be installed as www-data:www-data. Obviously, this is a problem since joomla won’t be able to run it properly.

So, our fix was this:

1. Install mod-itk

# apt-get install apache2-mpm-itk

2. Enter your VHOST directory

# cd /var/www/vhosts/[DOMAIN]/conf

3. Edit the vhosts file

# nano vhost.conf

4. Copy the following into the file, changing the user to your domain user.

<IfModule mpm_itk_module>
AssignUserId DOMAINUSER psacln

5. Restart apache like this:

# /etc/init.d/apache2 restart

Now you should have apache back up, and each time it runs it will be running as your domain user, not www-data. Problem solved, without the use of php-cgi. Sweet!