Jaime Frutos Morales's blog


How to install and configure Trac using Apache and a Subversion backend in Ubuntu 9.10

Filed under: SysAdmin, Ubuntu — acidborg @ 13:34

Description: “Trac is an enhanced wiki and issue tracking system for software development projects. Trac uses a minimalistic approach to web-based software project management. Our mission is to help developers write great software while staying out of the way. Trac should impose as little as possible on a team’s established development process and policies. It provides an interface to Subversion (or other version control systems), an integrated Wiki and convenient reporting facilities. Trac allows wiki markup in issue descriptions and commit messages, creating links and seamless references between bugs, tasks, changesets, files and wiki pages. A timeline shows all current and past project events in order, making the acquisition of an overview of the project and tracking progress very easy. The roadmap shows the road ahead, listing the upcoming milestones“.


  • Install Trac and Subversion: apt-get install trac subversion apache2 libapache2-mod-python
  • Create a directory for the Subversion repository: mkdir svn-trac
  • Create the Subversion repository: svnadmin create svn-trac
  • Create the Trac environment: trac-admin trac initenv
  • Something like this will be shown:

    Creating a new Trac environment at /home/acidborg/trac

    Trac will first ask a few questions about your environment in order to initialize and prepare the project database.

    Please enter the name of your project. This name will be used in page titles and descriptions.

    Project Name [My Project]> My Trac

    Please specify the connection string for the database to use. By default, a local SQLite database is created in the environment directory. It is also possible to use an already existing PostgreSQL database (check the Trac documentation for the exact
    connection string syntax).

    Database connection string [sqlite:db/trac.db]> sqlite:db/trac.db

    Please specify the type of version control system, By default, it will be svn.

    If you don't want to use Trac with version control integration, choose the default here and don't specify a repository directory in the next question.

    Repository type [svn]> svn

    Please specify the absolute path to the version control repository, or leave it blank to use Trac without a repository. You can also set the repository location later.

    Path to repository [/path/to/repos]> /home/acidborg/svn-trac

    Creating and Initializing Project
    Installing default wiki pages
    Project environment for 'My Trac' created.

    You may now configure the environment by editing the file:


    If you'd like to take this new project environment for a test drive,
    try running the Trac standalone web server `tracd`: tracd --port 8000 /home/acidborg/trac

    Then point your browser to http://localhost:8000/trac.
    There you can also browse the documentation for your installed
    version of Trac, including information on further setup (such as
    deploying Trac to a real web server).

    The latest documentation can also always be found on the project
    website: http://trac.edgewall.org


Configuration (using the Apache web server):

  • Give the ownership of svn-trac and trac to the Apache user and group: chown -R www-data:www-data svn-trac trac
  • Give the proper rights on svn-trac and trac to the apache user and group: chmod -R 770 svn-trac trac
  • Create the configuration file to run Trac on Apache ( /etc/apache2/conf.d/trac ) with the following content (replace [ and ] for angle brackets):

    [Location /trac]
    SetHandler mod_python
    PythonHandler trac.web.modpython_frontend
    PythonInterpreter main
    PythonOption TracEnv /home/acidborg/trac
    PythonOption TracUriRoot /trac
    SetEnv PYTHON_EGG_CACHE /tmp
    [Location /trac/login]
    AuthType Basic
    AuthName "TRAC User Authentication"
    AuthUserFile /etc/.trac.htpasswd
    Require valid-user

  • Create a user for Trac (acidborg in this case): htpasswd -c /etc/.trac.htpasswd acidborg
  • Give the proper permissions to that file: chmod 640 /etc/.trac.htpasswd && chown root:www-data /etc/.trac.htpasswd
  • Restart Apache: apache2ctl restart
  • Give the new user writing permission in the Trac environment: trac-admin /home/acidborg/trac permission add acidborg authenticated

You can configure the look & feel and many other preferences of your Trac editing the file trac.ini in your Trac environment (/home/acidborg/trac/conf/trac.ini in this example).


Book review: Apache Server 2 Bible

Filed under: Books, SysAdmin — acidborg @ 14:07

I have just finished reading “Apache Server 2 Bible” by Mohammed J. Kabir . Although it’s a reference book, I read it all because I wanted to revise all the Apache-related subjects that I already know and learn the ones that I don’t. This book explains all the Apache installation, configuration and management in great detail, including CGI, FastCGI, SSI, mod_perl, PHP and Java Servlets. I strongly recommend it as you’ll discover a lot of things that you don’t know about the Apache server and its configuration and you’ll learn many tricks about its management.

Apache Server 2 Bible


How to install and configure Sphinx in Ubuntu 9.10 with MySQL support

Filed under: Databases, Ubuntu — acidborg @ 21:40

Description: “Sphinx is a full-text search engine, distributed under GPL version 2. Commercial license is also available for embedded use. Generally, it’s a standalone search engine, meant to provide fast, size-efficient and relevant fulltext search functions to other applications. Sphinx was specially designed to integrate well with SQL databases and scripting languages. Currently built-in data sources support fetching data either via direct connection to MySQL or PostgreSQL, or using XML pipe mechanism (a pipe to indexer in special XML-based format which Sphinx recognizes). As for the name, Sphinx is an acronym which is officially decoded as SQL Phrase Index. Yes, I know about CMU’s Sphinx project“.


  • Install the packages needed: apt-get install gcc make libmysqlclient15-dev libmysql++-dev
  • Download Sphinx from here.
  • Decompress it: tar xvfz sphinx-*.tar.gz
  • Enter its directory: cd sphinx-*
  • Run configure: ./configure --prefix=/usr/local/sphinx --with-mysql
  • Compile Sphinx: make
  • Install Sphinx (as root): make install


  • Enter Sphinx’s directory: cd /usr/local/sphinx/etc
  • Make a copy of its default configuration: cp sphinx.conf.dist sphinx.conf
  • Modify it to fit you database schema and preferences (I recommend reading Sphinx’s official documentation and this tutorial by IBM first).
  • Create all indexes: /usr/local/sphinx/bin/indexer --all
  • Something like this will be shown:

    Sphinx 0.9.9-rc2 (r1785)
    Copyright (c) 2001-2009, Andrew Aksyonoff

    using config file '/usr/local/sphinx/etc/sphinx.conf'...
    indexing index 'software'...
    collected 10 docs, 0.0 MB
    sorted 0.0 Mhits, 100.0% done
    total 10 docs, 649 bytes
    total 0.013 sec, 48970 bytes/sec, 754.54 docs/sec
    total 2 reads, 0.000 sec, 16.3 kb/call avg, 0.0 msec/call avg
    total 5 writes, 0.000 sec, 0.4 kb/call avg, 0.0 msec/call avg


  • You can perform a basic search using: /usr/local/sphinx/bin/search desired_word . It matches all words by default, but you can change this behaviour. Run /usr/local/sphinx/bin/search without arguments to show the available options.
  • Example: /usr/local/sphinx/bin/search samba

    Sphinx 0.9.9-rc2 (r1785)
    Copyright (c) 2001-2009, Andrew Aksyonoff

    using config file '/usr/local/sphinx/etc/sphinx.conf'...
    index 'software': query 'samba ': returned 1 matches of 1 total in 0.000 sec

    displaying matches:
    1. document=10, weight=2
    description=Samba is a SMB/CIFS file, print, and login server. It seamlessly integrates Linux/Unix Servers and Desktops into Active Directory environments using the Winbind daemon.

    1. 'samba': 1 documents, 2 hits

The use of /usr/local/sphinx/bin/search is just for test and debugging purposes. There are native API ports for PHP, Python, Java, Perl, and Ruby. I will explain the integration between PHP and Sphinx on another post.


Ubuntu 9.10 CD shipment

Filed under: Ubuntu — acidborg @ 21:14

Today, my official CD of Ubuntu 9.10 (Karmic Koala) arrived. I’d like to thank Canonical for the gift. It will be very useful when installing Ubuntu on friends’ computers because people trust official CDs and that will make my work as a GNU/Linux evangelist easier.


HP Deskjet F2480 in GNU/Linux

Filed under: Linux — acidborg @ 21:04

Today, I bought a HP Deskjet F2480 printer. It’s an all-in-one printer (print, copy & scan) to print a few documents at home. It works nicely in GNU/Linux (both printing and scanning) and its driver is free software. Just download it from here (“Download HPLIP”) and run it using: sh hplip-*.run. After that, answer a few questions (AUTOMATIC installation mode) and that’s all.

I recommend it if you are looking for a cheap GNU/Linux-friendly all-in-one printer.


Wikipedia’s 2009 fund-raising campaign

Filed under: Life — acidborg @ 13:30

Wikipedia’s 2009 fund-raising campaign has started. I have already donated some money, as I did last year. I encourage every Wikipedia reader to do the same if we want to support and maintain it.


Upcoming book: ModSecurity 2.5 by Magnus Mischel

Filed under: Books, SysAdmin — acidborg @ 21:01

I’m pleased to have been chosen to review an upcoming book called “ModSecurity 2.5” by Magnus Mischel. It’s going to be published this month by Packt Publishing.

ModSecurity 2.5 book

As I explained in my previous post (Installing ModSecurity for Apache in Ubuntu Server 9.04), ModSecurity is a web application firewall that can work either embedded or as a reverse proxy. It provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring, logging and real-time analysis.

I’m looking forward to reading the book and reviewing it, because I think ModSecurity is a great tool and very useful if you work in web-based environments.


How to create and manage a Git repository

Filed under: SysAdmin — acidborg @ 15:05

Description: “Git is a free distributed revision control, or software source code management project with an emphasis on being fast. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.”

All the documentation about Git could be found here.


  • Ubuntu & Debian: apt-get install git-core
  • Fedora: yum install git

Git searches for its configuration files using this order (if one file is found, the rest are ignored):

  • .git/config : Repository-specific configuration settings
  • ~/.gitconfig : User-specific configuration settings
  • /etc/gitconfig : System-wide configuration settings

You can edit them directly or using the git config command. Examples:

git config --global user.name "Jaime Frutos Morales"
git config --global user.email "acidborg@gmail.com"

You can see all your current configuration settings using git config -l .

Creating a repository:

  • To create a repository in your current directory: git init

It will create a directory called .git in your current directory which contains the repository.

Adding and removing files:

  • To add a file or directory to your repository: git add file_name
  • To add all the files and subdirectories of your current directory to the repository: git add .
  • To remove a file from the repository: git rm file_name
  • To commit changes to the repository: git commit . In Git, adding a file to the repository and committing it are different actions, so after adding files to your repository, you have to commit them to save the changes. You will be asked to enter a short description of the commit in order to track the changes on the repository.
  • To see the status of your repository (files added, removed, committed, etc): git status

Viewing commits:

  • To list all the commits made to the repository: git log
  • To see the details of a specific commit knowing its ID (the sequence of letters and numbers after the commit word): git show commit_id
  • To list the changes made by the last commit: git show
  • To list a short description of all commits: git show-branch
  • To show the differences in files between two commits: git diff commit_id1 \ commit_id2

Blog at WordPress.com.