Install Tracks on Ubuntu or Debian


This time we are going to learn how to install Tracks, a Getting Things Done™ implementation, that I use it and like a lot. We are going to install it on an Apache2 web server with FastCGI, using MySQL as the database engine, and of course we also have to install Ruby On Rails because it is a requirement of Tracks. I think the best thing would be use Subversion to get the sources of Tracks because doing it so would make upgrading the installation a snap.

Note: If at any time it asks for something and I don’t specify something is because default option is the safe bet.

Step 1: Add the needed apt-get sources

  1. I’m going to use VIM text editor to edit files, you can use any other you want(in case you don’t know how to use vim) by replacing the word vim on the commands that appears.
    sudo vim /etc/apt/source.list

    Make sure that the lines that contain universe are uncommented, that means without any # in front of it. Once you uncommented them exit the editor.

  2. Update the available packages list by running the following command.
    sudo apt-get update

    That will check the /etc/apt/source.list file and update the package list accordingly.

  3. Move to the next step.

Step 2: Install Apache2

  1. To install Apache2 we simply run:
    sudo apt-get install apache2
  2. Move to the next step.

Step 3: Install MySQL

  1. To install MySQL we simply run:
    sudo apt-get install mysql-server-5.0
  2. Now you probably want to change the root password for the server, to do that we first need to log into mysql.
    mysql -u root
  3. Now that we select a password and we change it executing the following commands:
    SET PASSWORD FOR 'root'@'localhost' =
      PASSWORD('newPassword');

    and

    SET PASSWORD FOR 'root'@'%' =
      PASSWORD('newPassword');
  4. Now we need to create the database that Tracks is going to use, I suppose you are still logged into MySQL
    CREATE DATABASE tracks;
  5. Create the user for that database.
    CREATE USER 'tracks'@'%' IDENTIFIED BY 'aPassword';
  6. And finally grant the permission for that user
    GRANT ALL ON tracks.* TO 'tracks'@'%';
  7. Move to the next step.

Step 4: Install Ruby

  1. We are going to install Ruby with apt-get too, but this time we need a lot more packages than before.
    sudo apt-get install ruby rdoc ri ruby1.8

    and some needed libraries

    sudo apt-get install libzlib-ruby libyaml-ruby
  2. Move to the next step.

Step 5: Install Gems

  1. Now the first thing that we are going to install without apt-get install. Go to the Ruby Gems download page and find the latest *.tgz and right click the link and copy the link location, the latest at the moment I wrote this post was RubyGems-0.9. After you copied the link, you need to tell the shell to download it. For that you do:
    wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
  2. Now we need to untar it.
    tar xzvf rubygems-0.9.0.tgz
  3. Enter the extracted directory
    cd rubygems-0.9.0
  4. Install it.
    sudo ruby setup.rb
  5. Move to the next step.

Step 6: Install Ruby On Rails and Ruby-MySQL

  1. We are going to start with Rails.
    sudo gem install rails --include-dependencies
  2. And now we install mysql.
    sudo gem install mysql

    and we need to choose the newest package available.

  3. Move to the next step.
      1. We are going to use an alternative mod_fastcgi that happened to work better to me, to install that one we do.
        sudo apt-get install libapache2-mod-fcgid
      2. Now we need to configure the module. It’s a matter of personal choice actually, but this settings are what I recommend. First open up the configuration file.
        sudo vim /etc/apache2/mods-enabled/fcgid.conf

        and replace all the configuration with this one instead

        <IfModule mod_fcgid.c>
          AddHandler fcgid-script .fcgi
          SocketPath /var/lib/apache2/fcgid/sock
          IPCConnectTimeout 20
          DefaultInitEnv RAILS_ENV production
          IdleTimeout 60
          ProcessLifeTime 6000
          MaxProcessCount 32
          DefaultMaxClassProcessCount 2
          IPCConnectTimeout 6
          IPCCommTimeout 6
        </IfModule>
      3. Move to the next step.
      1. Firstly we need to get the sources, if you don’t have subversion installed, this is the moment to install it with
        sudo apt-get install subversion
      2. Now we can get the sources, be sure to grab the newest SVN URL from the Tracks Download Page and use the latest SVN URL replacing the red part.
        sudo svn checkout http://www.rousette.org.uk/svn/tracks-repos/tags/tracks-1.043 /var/www/tracks
      3. Now we change the current dir to where the Tracks sources are.
        cd /var/www/tracks
      4. There we need to copy some files and then we need to edit them
        • sudo cp config/database.yml.tmpl config/database.yml
        • sudo cp config/environment.rb.tmpl config/environment.rb
        • sudo cp -R log.tmpl/ log
      5. Lets edit config/database.yml now.
        sudo vim config/database.yml

        There we are going to change the red parts.

        development:
          adapter: mysql
          database: tracks
          host: localhost
          username: tracks
          password: aPassword
          socket: /var/run/mysqld/mysqld.sock
        
        test:
          adapter: mysql
          database: tracks_test
          host: localhost
          username: root
          password:
        
        production:
          adapter: mysql
          database: tracks
          host: localhost
          username: tracks
          password: aPassword
          socket: /var/run/mysqld/mysqld.sock
      6. Now we edit config/environment.rb.
        sudo vim config/environment.rb

        and we change there the line that starts with SALT =(line 54) to something random, for example:

        SALT = "somethingRandom"
      7. Finally we run the command that adds the needed MySQL content.
        sudo rake db_schema_import
      8. Move to the next step.
      1. Now the only thing that keeps you away from using your tracks is a simple configuration on Apache2, so lets jump off. We need to create a new file for this configuration, so let’s do it so.
        sudo vim /etc/apache2/sites-available/tracks
      2. There you should put something like this and change the red parts.
        <VirtualHost *>
          ServerName tracks.domain.tld
          DocumentRoot /var/www/tracks/public/
          ErrorLog /var/www/tracks/log/apache.log
        
          <Directory /var/www/tracks/public>
            Options ExecCGI FollowSymLinks
            AllowOverride all
            Allow from all
            Order allow,deny
          </Directory>
        </VirtualHost>
      3. Lets enable the site.
        sudo a2ensite tracks

        This will create a symlink in /etc/apache2/sites-enabled

      4. Finally we have to restart the web server.
        sudo apache2 force-reload
      5. Enjoy!
    1. Step 7: Install FastCGI for Apache2

      Step 8: Get Tracks and configure it

      Step 9: The Last Mile. Configure VirtualHosts

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.


Other Posts
Update Wordpress in 5 easy steps.
Compile Psi on Windows

Write a Comment

Take a moment to comment and tell us what you think. Some basic HTML is allowed for formatting.

Reader Comments

Can you tell me how to make it so that tracks appears here:

http://localhost/tracks?

I don’t have a top level domain for this computer. Is there a way to go to tracks and have it work if I did it as you suggested (i.e. http://tracks.localhost doesn’t work)? Thanks.
Stephen

Take a look at Apache Alias but you can always modify your /etc/hosts file

[…] Link Original: Want some reference? - » Install Tracks on Ubuntu or Debian […]

In the SVN line, it asks you for a user and password, use ‘guest’ for both. You can also add –username=guest right after the “co” command in the SVN line.

“In the SVN line, it asks you for a user and password, use ‘guest’ for both. You can also add –username=guest right after the “co” command in the SVN line.”

Yes that is true, and in fact I use that but it broke the style of the page because it overfulls the box. That’s why I took it out.

Thanks for the tip though.

Type your comment here.I got as far as this step:
# Now the only thing that keeps you away from using your tracks is a simple configuration on Apache2, so lets jump off. We need to create a new file for this configuration, so let’s do it so.

sudo vim /etc/apache2/sites-available/tracks

When I do that I get an error message that “tracks” is a directory and there isn’t a doc to edit.
What I did is I attempted to create the file, but didn’t see what it was to be named.
I haven’t had a chance to work with Apache to much so I am a newbie when it comes to the configurations.

If you are getting that error then it is because you’ve created a folder there that’s called tracs, see if you are using that folder and if not delete it, otherwise just create another file with another name, it doesn’t matter the name of the file.

Regards,
c00i90wn

1st, thanks for this guide!

I had it going great on my ubuntu 7.04, then i upgraded to 7.10 and the one thing the upgrade broke (which is less than usual) was my tracks.

Now when I go to http://0.0.0.0:3000/ i get a page that starts with:

wrong number of arguments (1 for 0)
/var/www/tracks/script/../config/../vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:551:in `initialize’

with the /var/www/tracks… stuff going on for about 30 lines with various different messages at the end of each line.

I went back through you guide and check that everything is still there but have not found it.

Any thoughts?

Thanks!

Tim Madden: Changes on a system upgrade are many and a lot of things are prone to fail. Saying that according to your errors I would say it’s because of incompatible version between mysql and ruby-mysql. Try going trough the ruby-mysql installation all over again to upgrade the version you have.

Regards,
/ME

c00i90wn: Yes, you are correct. I actually go it fixed last night. Thank G! I was going to post here today, so here it is.

It was the connection between ruby and mysql. I needed to install ruby1.8-dev to get it going. The details are posted on the tracks forum should anyone else want to understand it.

Upgrades in Linux can be a pain, but, despite the tracks trouble, 7.10 was pretty clean for me. More things got fixed than broke. Actually, only tracks broke (so far :) 7.10 rocks! Highly recommend. Best yet.

Sorry, meant to post the url to the forum thread:
http://www.rousette.org.uk/projects/forums/viewthread/177/

After running Tracks on the uniform server I decided that I wanted to use the email function that was posted so am trying to use Apache2 now. I have gotten everything configured per all the instructions I can locate but all that comes up is the “It works” web page. I have gone over all the Apache configurations and can not find where it is pointing to that particular .html page in “apache2-default.
What am I missing here.
Help is greatly appreciated.
Thanx

c00i90wn, are you interested in revising this guide to fit the upcoming 1.5 release? Maybe we can get a link added to the manual to this page… The current draft of the manual does not mention linux installs.

Yes sure, no problem, let’s arrange how’ll do it and when! I’m sending you my IM contact via mail.

Painfully Slow!

1st, thanks for this guide. I just went through it for Tracks 1.6 on Ubuntu Server 8.04. Hit some obstacles (e.g. “db_schema_import” does not exist in the rake command). Also the “gem install mysql” failed, but found a solution.

Now all done and working, but the application is painfully slow. It takes 10 to 15 seconds to load each page. Is this normal? Or am I missing something?