install trac 1.1.2-dev on ubuntu 12.04

I tried to make a good tutorial to figure out, how to install trac 1.1.2-dev on ubuntu 12.04. This was mainly done as a walkthrough for me, and I hope that you ‘ll find nice too.

I asume that you have a fresh install of ubuntu 12.04, so you firstly have to do:

sudo apt-get update
sudo apt-get upgrade.

Out of our scope I am just saying that, I allways want to take the role of root, even on an ubuntu linux system so the first thing I do is:

sudo passwd root

after setting a password for a root user, you are able to do:


and then you are logged in a root session.

One more thing that helps me a lot is to set bash_autocompletion for root user. This is tricky and easy in Ubuntu. You have to edit the the .bashrc file in your home directory. For the root user is:


so lets do it:

vi /root/.bashrc

and then just comment out the 3 last lines in this file and more accurately these 3 lines:

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
 . /etc/bash_completion

now we are ready to proceed to the installation guide.

install trac 1.1.2-dev on ubuntu 12.04

lets apt-get install all packages needed:

apt-get -y install python-setuptools python-genshi python-genshi-doc mysql-client-5.5 mysql-server-5.5 python-mysqldb python-babel python-docutils enscript subversion git apache2 libapache2-mod-python mercurial python-dev python-pygments

I hope that I haven’t forget a package 😛

Database preparation

At the time of installing mysql-server-5.5 you will be asked to set a root password for the database server. Choose one to enter. After the successful installation of mysql server and all the other package, lets prepare our database server for the trac installation.

use the mysql client you just installed:

mysql -u root -p

enter the root password you have chosen

In this section I have to say that for each trac project you will need a database, so lets the database a relative name. I named mine trac_myproject. So enter on mysql console the following commands:

CREATE DATABASE trac_myproject DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
GRANT ALL ON trac_myproject.* TO tracuser@localhost IDENTIFIED BY 'tracpass';
flush privileges;

tracuser and tracpass in the above example are just example names.

Now write down the db connection string, that you will need when you will create your first trac project.


As an advice I ‘ll say that you shouldn’t use the char @ as member of the password beacuse trac will fail to make the connection to the database.

Once we are ready with the database lets get our hands dirty with trac!

Trac latest dev and TracMercurial plugin installation

we have to get the sources for the trac and TracMercurial:

I got the clones of these repositories to my root directory:

cd /root

clone repositories

svn co
hg clone

install trac

get into the directory trunk

cd trunk
python install

install TracMercurial

get into mercurial-plugin directory

cd ../mercurial-plugin
python bdist_egg

After this procedure a python egg file has been created for the plugin, which we will copy into our project’s folder later. After this procedure we can use trac commands to create environment to create projects and more.

Create our trac environment directory

We can now create our trac environment diractory. You can initialize anywhere you want. My opinion is to create a directory under /usr/share/ directory named trac. Under this directory you can deploy your trac projects. Keep in mind that this directory will be exposed to web access.

mkdir /usr/share/trac
trac-admin /usr/share/trac/myproject initenv

now you will  be asked for a name of the project and the db connection string for this project ( mysql://tracuser:tracpass@localhost:3306/trac_myproject )

chown -R www-data:www-data /usr/share/trac/myproject

with the trac-admin command we created and initialized a project environemnet. Now you can create and initialize as much projects as you want under /usr/share/trac directory

We changed the group and owner of the project directory to apache user (www-data) to the project because we will now setup apache with mod_python module to serve the trac projects.

Apache Configuration

Usually main apache configuration file is /etc/apache2/apache2.conf, and we will edit it a litle to use python module for apache.

vi /etc/apache2/apache2.conf

Add the following lines at the end of the file:

<Location "/trac">
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /usr/share/trac
PythonOption TracUriRoot /trac

You should now check if module mod_python is enabled. Check if a file python.load exists under /etc/apache2/mods-enabled/ directory. If it does not exist create it your self:

vi /etc/apache2/mods-enabled/python.load

and add this line to the file:

LoadModule python_module /usr/lib/apache2/modules/


Basic Authentication

If you want basic authentication via apache then add to the /etc/apache2/apache2.conf file the following lines:

vi /etc/apache2/apache2.conf

add the following

<LocationMatch "/trac/[^/]+/login">
 AuthType Basic
 AuthName "Trac"
 AuthUserFile /etc/trac/trac.htpasswd
 Require valid-user

save and exit

mkdir /etc/trac
htpasswd -c /etc/trac/trac.htpasswd admin

enter a password for the admin user

Now restart apache:

service apache2 restart

You can now visit the http://your-ip/trac/ or if you want to visit it locally

I installed trac to a remote server so I visit my projects by using it’s ip. Keep in mind that you should check for firewall settings to allow access to port 80.

Configure the project to use TracMercurial

now we should copy the python egg file we created when installing the TracMercurial plugin into project’s plugin directory.

cp /root/mercurial-plugin/dist/TracMercurial- /usr/share/trac/myproject/plugins/.

the name of the egg may vary depending of the dev version.

now lets make a profile for the mercurial, because it will be needed at next steps.

vi /root/.hgrc

and add the following lines by your needs.

username = Administrator <admin@trac>

Ofcourse this is a test environment, and we will create the repository inside the trac project directory. In an mercurial server environment you can include the actual repository directories.

mkdir -p /usr/share/trac/myproject/hg/
cd /usr/share/trac/myproject/hg/

now lets init a hg project

hg init (project-directory)
cd (project-directory)
(add some files)
hg add
hg commit -m 'Initial commit'

Our last configuration step is to configure project see the repository

vi /usr/share/trac/myproject/conf/trac.ini

check if these lines exist and if not, add them

node_format = short
show_rev = yes
tracext.hg.* = enabled

then under [trac] tag edit the corresponding to match:

repository_dir = /usr/share/trac/myproject/hg/(project-directory)
repository_type = hg

now you should do one more time:

chown -R www-data:www-data /usr/share/trac/myproject
service apache2 restart

I hope that all work fine!!!


enable apt-get autocomplete

Debian Administration

I was wondering how to enable auto complete of packages for apt-get command in Backtrack linux. I recalled a day when I firstly installed Ubuntu on my laptop, and I was searching for a way to manipulate packages. I was not able to know every package nor versioning. Thus, searching on the Internet I finally found the bash_completion. This is a utility with very powerful abilities for users and programmers. In order to understand better what bash_completion is, I advice you to take a look at debian’s article about bash_completion utility .


Now lets tell how to enable this feature if not already enabled.  There are two ways both includes shell commands and the changes last for the terminal session you use.


source /etc/bash_completion


. /etc/bash_completion

From now on you are able to use Tab key to autocomplete / suggest commands like:

apt-get ins [TAB]
apt-get install dove[TAB]
apt-get install dovecot[TAB]
dovecot dovecot-gssapi dovecot-pgsql
dovecot-antispam dovecot-imapd dovecot-pop3d
dovecot-common dovecot-ldap dovecot-postfix
dovecot-core dovecot-lmtpd dovecot-sieve
dovecot-dbg dovecot-managesieved dovecot-solr
dovecot-dev dovecot-mysql dovecot-sqlite
apt-get install dovecot dovecot-antispam dovecot-ldap

If you want to permanently enable this utility you have to edit your



vi /etc/bashrc

You have to find the following lines in this file:

# enable bash completion in interactive shells
#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#. /etc/bash_completion


and uncomment (deleting the #) the following lines

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion

This how to, tutorial enable apt-get autocomplete, is the same for all debian based distributions like ubuntu, linux mint, debian, kubuntu, backtrack linux and more…


How to install mercurial on centos

Mercurial is a free, distributed source control management tool. It efficiently handles projects of any size and offers an easy and intuitive interface. You can setup mercurial on a server just to keep your teams repository. It’s pretty easy to install it to your CentOS machine , or vm. You can just run the command:

yum install mercurial


and that’s all. I think that it’s easy to install it to other Linux distributions too. Now all you have to do is to add a group for the developers and a user for each of them to have access to the repositories.

If your team of developers use windows as their primary operating system Mercurial is the right choice for a scm. Mercurial just works on Windows. The definitive Mercurial book (written by Bryan O’Sullivan – a fellow Irishman) is concise, and exhaustive. Better yet, if you want that warm fuzzy feeling a GUI gives you, then look no further than TortoiseHg – a top quality tool. It’s good to learn Mercurial mainly on the command line. I wanted to understand how Mercurial worked, and how it is different from SVN.

Kolab install on Centos 6.3

I tried to install kolab on Centos 6.3 following this quick how to , that I found on kolab groupware community:

I tried to follow these steps on Centos 6.3 and I found some problems during installation.  I googled a lot and I found some useful things:

The first two steps on the quick how to guide on are correct:

  • Install the epel-release package linked to from this page. At the time of this writing, this means executing:
# rpm -Uvh
  • Install the kolab-2.4-community release package linked to from this page. At the time of this writing, this means executing:
# rpm -Uvh

From now on there are some problems and up to here the quide was perfect, and I think that it was very useful.

When I followed the next step installing the Kolab Groupware:

# yum install kolab

I got some problems like:

Error: Package:  1:qt-mysql-4.6.2-24.3l6.i686 (@base/$releasever)
Removing: mysql-libs-5.1.61-4.el6.i686
Updated By : mysql-libs-5.5.24-1el6.kolab_2.4.i686
(kolab-2.4-development) Not found
Error: Package:  1:qt-mysql-4.6.2-24.3l6.i686 (@base/$releasever)
Removing: mysql-libs-5.1.61-4.el6.i686
Updated By : mysql-libs-5.5.24-1el6.kolab_2.4.i686
(kolab-2.4-development) Not found

as one guy reffered to the mailing list of kolab.

the problem is that there is the package qt-mysql-4.6.2-20.el6.x86_64 that is must be removed. If you try to execute:

#rpm -e qt-mysql-4.6.2-20.el6.x86_64

you will got an error that akonadi depends on this package and cannot be removed. In my system I do not need this package, so I removed it by executing:

#yum remove akonadi.x86_64

Then I was able to remove the package qt-mysql-4.6.2-20.el6.x86_64.

#rpm -e qt-mysql-4.6.2-20.el6.x86_64

Now that this package was removed, there is no problem to install kolab with the command:

#yum install kolab

All the things were done more easily when I followed the advice of  Jeroen van Meeuwen here

The installation completed, now it’s time to try setup and configure it!

Good luck to everyone trying to install and deploy kolab!

script – linux : How to record a session

If you are trying to find a way to record a session on shell, that’s your case. A simply and firly good option offers almost all linux – unix like distros.

When you are ready to record your session type

script "session name"
do whatever you want to do

to end the session recording.

If you dont enter a session name typescript will be the name of the produced session record.

This tool is powerfull! Just try it, record your job and when you need to redoit recall it from your archive.

Alias and Permanent Alias

First of all, for those that don’t know what an alias is, alias is a way to pair a command with a name of your choice. For example I use all the time the command ls passing arguments -lah. So I made an alias for this command with the name ll. From now on whenever use the ll command the shell knows to execute the ls -lah.

An alias lasts for a session. When the session ends the alias exprires.

So before telling you how to set alias and view aliases of the system, you must know how long an alias should exist.

If you want to get all the alias for the session you are just type


If you want to set an alias for the current session just type

$alias ll='ls -lah'

If you want to remove an alias for the current session just type

$unalias ll

If you want to add an alias permanently, you have to edit your bash file.

For linux mint this files is name bash.bashrc and is located under /etc directory.

The filename and directory varies on each linux distribution.

Aliases in Centos

You can add a permament alias in centos using the following simple steps:

1st step Create a file in /etc/profile.d/ directory

create a file with filename relative to the command you want to make an alias (this is just a mnemonic hint) inside the directory: /etc/profile.d/ as is shown in the following example:

vi /etc/profile.d/

In this example I need to create an alias for ldapsearch, so I name my file

2nd step Define the alias in the file

Insert in the alias’s definition file something like the following:

# Initialization script for bash and sh
# export AFS, if you are in AFS environment
alias ldapsearch='/usr/bin/ldapsearch -h -D uid=searchuser,dc=example,dc=com -w searchpass -x -b dc=example,dc=com -s sub -LLL'

3rd step Give the right permissions to the file

You have to run the following command, where is an example

chmod 755 /etc/profile.d/

4th step Restart your session Or Source the file you created

Now you have to either restart your session, by exiting the terminal, and open a new one, or use the following command:

source /etc/profile.d/

Now you are ready to create your own aliases, to make your terminal experience even better!