Archive for the ‘Linux’ Category

Installing Trac on 64 Bit Ubuntu 8.04 (Hardy)

Tuesday, March 9th, 2010

This is a fairly basic guide which is mostly for my reference, but feel free to use it. I do not take responsibility for server failure, data loss or if your switch starts sending toast over the internet to your computer after following this guide. Follow this rough guide at your own risk.

NOTE: This guide is roughly based on a more complete guide here

Some assumptions are going to be made here.

  • You have subversion installed already and your repos are in /var/svn
  • You have set this up for access via apache. (Quick Guide coming soon)
  • Your websites are in their own directory in /var/sites/

First install the required programs from the universe repository. If you are using ubuntu (Hardy) server, you will need to edit the /etc/apt/repos.d file.

sudo nano /etc/apt/sources.list

Enter the following lines to the end of the file

deb http://archive.ubuntu.com/ubuntu/ hardy universe
deb http://archive.ubuntu.com/ubuntu/ hardy-updates universe

Save the file and now do the following to refresh the package list.

sudo apt-get update
sudo apt-get upgrade

This will ensure that you have the latest and greatest of your currently installed packages to avoid any unforeseen problems. Now we need to install trac, you may get away with the following and apt will get any other dependencies for you.

sudo apt-get install trac

Or I used the command similar to the guide I saw.

sudo apt-get install enscript libapache2-mod-python python-docutils trac db4.3-util

Now once this is complete, create the directory for your trac instance and change the owner to the web server user. Depending on which distribution this could be httpd, apache or ww-data. In Ubuntu it is www-data.

sudo mkdir /var/sites/trac.yourdomain.com
sudo chown -R www-data:www-data /var/sites/trac.yourdomain.com

And now we use the trac-admin program to initialise the environment, just follow the steps and remember where your svn repos are kept.

trac-admin /var/sites/trac.yourdomain.com initenv

Now to create the apache site, we are using named virtual hosts. So create the file and then open it for editing.

sudo touch /etc/apache2/sites-available/trac
sudo nano /etc/apache2/sites-available/trac

Now the following site configuration will vary from person to person, the referenced guide at the start of this tutorial will show you more advanced features like self signed certificates for ssl rather than authenticating in plain text like the configuration below.

NameVirtualHost trac.yourdomain.com
<VirtualHost trac.yourdomain.com:*>
   ServerAdmin admin@yourdomain.com
   DocumentRoot /var/sites/trac.yourdomain.com
   DirectoryIndex  Index.html
   ServerName trac.yourdomain.com
   ServerSignature Off
   ErrorLog /var/log/apache2/trac_error_log
   TransferLog /var/log/apache2/trac_access_log
   <Directory "/var/sites/trac.yourdomain.com">
      Options +Indexes +MultiViews
      Order allow,deny
      Allow from all
   </Directory>
   <Location />
      SetHandler mod_python
      PythonHandler trac.web.modpython_frontend
      PythonInterpreter main_interpreter
      PythonOption TracEnv /var/sites/trac.yourdomain.com/
      PythonOption TracUriRoot /
      AuthType Basic
      AuthName "Trac"
      # Use the SVN password file.
      AuthUserFile /etc/subversion/passwd
      Require valid-user
   </Location>
</VirtualHost>

The Auth User File for subversion is generated when setting up the repos, which will be included in another guide.

Save and close the file (Ctrl + O and then Ctrl + X). Now before we start the new site we need to compile a python module (clearsilver) for python 2.5 as this is broken in hardy 64 bit. You will need the compilation tools installed and the required dependencies, which is just a single command.

sudo apt-get install build-essential zlib1g-dev python-dev autoconf build-dep python-clearsilver

Now download the latest version and extract the compressed file into a directory.

wget http://www.clearsilver.net/downloads/clearsilver-0.10.5.tar.gz
tar zxvf  clearsilver-0.10.5.tar.gz

Now we need to edit the configure scripts for compiling the module to allow it to build for python 2.5 so using our favourite text editor nano do the following:

nano clearsilver-0.10.5/configure.in

Now press Ctrl + W and type ‘python_versions’ and press enter.

Change the line to be the following

python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"

Save and close the file. Now we repeat the process with the configure file

nano clearsilver-0.10.5/configure

press Ctrl + W and type ‘python_versions’ and press enter.

Change the line to be the following

python_versions="2.5 2.4 2.3 2.2 2.1 2.0 1.5 24 23 22 21 20 15"

and Save and close the file. You can now build and install the module by doing the following

./configure
make
sudo make install

Now we need to copy the module binary into the python directory to replace the broken one.

sudo cp -bi python/neo_cgi.so /usr/lib/python2.5/site-packages/neo_cgi.so

Enable the trac site in apache.

sudo a2ensite trac

Now you can start the site up by either restarting or reloading apache

sudo /etc/init.d/apache2 reload

OR

sudo /etc/init.d/apache2 restart

Now surf up trac.yourdomain.com enter the user name and password (if you have set this up) and away you go!

Anyway I hope this is of some help to someone. :D

Special thanks to fluffypixies for the guide on fixing the python problem which can be found here.

The Weekend & MySQL fail

Friday, October 16th, 2009

This has been a long week, with MySQL fails left right and centre.

The actual MySQL server ships with a bomb ready to go off as we found out at work. For every connection to the server it does DNS lookups for the user to verify where the connection is coming from and for a production server all connections will be from a limited amount of known hosts. So when the hosting provider’s DNS blows up in your face, you are left with a MySQL server which is not allowing any connections what so ever, the web servers go nuts with requests failing and retrying and a lot of clients on the phone giving you a good ear bashing. (Plus the boss gets a headache)

You can switch the DNS lookups off, the solution was found here:

http://www.mysqlperformanceblog.com/2008/05/31/dns-achilles-heel-mysql-installation/

Another fail comes in the form of the Administrator GUI tool which started today. When connecting to a remote database through an SSH tunnel, (which might I add has worked for the past 2 years.) I get the wonderful 2013 MySQL error, sadly Google has yet to provide me with a solution, however Navicat Lite has provided a clue which is the also unhelpful: Lost connection to MySQL Server at ‘reading initial communication packet’, system error: 0.

If I find a solution, I’ll post it here.

Ah well, at least the weekend is now here, I can go get drunk off my face and make a tit of myself in front of the general public. Also I’ve just realised that Grey Area is now 2 years old! A rather quiet celebration as there is no user base here.

Squash, Screen and Irssi

Tuesday, October 13th, 2009

First off,seeing as I am testing out this new VPS to see if it is more suited to my needs. (despite being a complete turncoat and using Windows instead of Linux). I mean to be honest as long as the web server works and I can serve ASP.NET either through IIS or Mod_Mono I am happy. Well I say happy, I don’t enjoy spending endless tweaking of config files to see if changing settings will finally allow the web server to start serving files properly. Platform ambivalent, you could say.

Anyway, I’m currently hunting for a nice replacement to screen on Linux for Windows, as that is one of the main things that I use my VPS for, logging on to the server, bring up the stored screen and use irssi to spread more white noise on to the internet. Anyway, been looking at Cygwin which doesn’t appear to have changed much since I last tried it about 2-3 years ago. So far I have been running a separate SSH Server called freeSSHd and starting a bash shell from there, however putty doesn’t seem to handle this well and the command execution seems particularly slow.

Going to try using just Cygwin for the SSH Daemon and see how the command execution time goes, it might actually work! Anyway, anyone have any suggestions for screen and irssi replacements?

On another note, Played squash with my Boss and co-worker last night, make a complete arse of myself and my left arm has fallen out with me. Still good fun though and now off to be shamed at work. :D