How to: Gitorious and Sendfile for tarball download with Nginx

On Apache Gitorious uses mod_xsendfile to push the tarballs for download. Unfortunately this is not directly compatible with Nginx because Nginx uses a similar but different implementation.

However the is still a way to make this feature work with Nginx. To do so you first have to edit on of the gitorious controllers to. Assuming that gitorious is installed in /var/www/gitorious/ you have to edit the following file

sudo nano /var/www/gitorious/app/controllers/trees_controller.rb

Once you open the file search for the line

response.headers["X-Sendfile"] = File.join(GitoriousConfig["archive_cache_dir"], real_path)

It is in the function:

set_xsendfile_headers(real_path, user_path, content_type = "application/x-gzip")

and replace with the following:

response.headers["X-Accel-Redirect"] = GitoriousConfig["nginx_sendfile_dir"] + real_path

Save the file and open the gitorious configuration file for editing.

sudo nano /var/www/gitorious/config/gitorious.yml

There you have to add the following line (am not sure the position of the line in the configuration is relevant but you can add the line after the default license line):

nginx_sendfile_dir: "/cache/"

Finally in the nginx virtual host for your gitorious instance you have to add the following line (the alias has to be the archive_cache_dir: from gitorious.yml, let’s suppose you set it to /var/git/tarballs)

location /cache {
alias /var/git/tarballs;



Ubuntu 10.10 Server with Gitorious and Redmine

The server Installation

To start go to and get the ISO image of ubuntu server 11.10 (64bit or 32bit depending on the architecture of your machine) then either burn the ISO on an empty disk or create a bootable USB Flash drive, using either Linux Live USB creator or any other piece of software of your choice, if your system supports booting from a flash drive.

As soon as you boot from the media you will come across the language selection screen, select English and continue.

On the next screen select Install Ubuntu Server,

At the next screens you will once again get asked to select a language, choose English. In the Select your Location screen you select the location of your server, this has to do with the time zone.

If you get asked to Configure Locales choose United States – en_US.UTF8 and continue. At the Configure the Keyboard screen select NO and in the Country origin of the Keyboard list go and select English (US). Next in the Keyboard Layout select once again English(US).

Next in our installation is the network configuration. You will be asked to enter a hostname for the system, you can add a name for the system depending on your network.

Next there will be the Configure the clock screen. You just have to confirm your timezone (It should be the correct since you choose the country previously).

Now we have to partition our disk(s). We will select the manual partitioning.

 In our example we have 3 physical drives available. We will configure them using the Logical Volume Manager. Select the physical drive. In ca

If  you get a message saying You have selected an entire device to partition…. select Yes. This will be probably be the same  for every drive. If the drive already has partitions you will have to remove them before proceeding. At some point you should see under the first drive some text saying pri/log DrivesSpace GB FREE SPACE go there and press Enter. On the Partition disks screen select Create a new partition and press enter.

When asked for the New partition size write something around 0.6GB, this will be reserved for the /boot partition, and press continue. The Type for the new partition should be Primary

Then you should get across the following: Select the Use as: line, press enter and Select on the menu the Ext4 journaling filesystem, on the Mount Point select /boot and set the bootable flag to on. Then go to Done Setting up the partition to finish with the boot partition.

After finishing with the /boot partition there should be a line under the first drive looking like this #1 primary 600.0 MB f  ext4 /boot and the line containing the word FREE SPACE should be right under this. You also have to create Empty Partitions for every single drive you want to use for the Volume Group.

At this point you should go to the option saying Configure the Logical Volume Manager. In the screen with the Summary of current LVM configuration all the values should be zero. On the LVM configuration action: you should create the Create volume group. Give a name to the volume group, something like server_vg.

When you get asked to select the devices for the new volume group. Select the other drives along with the empty space in the first drive.

After selecting the drives you can continue. the new volume group should contain all your drives. Write the changes and continue.

At this point the summary of the LVM configuration should have 3 Used physical volumes and one Volume Group. The next step is to create logical volumes inside the server_vg or whatever is the name you choose. Select Create logical volume, then select the volume group.

At this point you will get asked for the name of the Logical volume, generally I use as a name for each volume the name of the Mount point that will used for the volume.

The first logical volume will be used for the swap partition. So I will name it swap. When asked for the Logical Volume size use 1.5 times the amount of the server’s RAM.

Then you have to create Logical volumes for at least root(/) and (/home),  I used about 10GB for the root logical volume of my server and the rest for /home.

I also used a separate logical volume for /var, to keep it separate from the root partition, because there resides the web root folder, along with my git repositories etc. For the /var partition I used 20GB.

So we have the following: swap – 1.5*RAM, root – 10GB, var – 20GB and home – the rest of the available space.

At the end of the creation of the logical volumes if you choose Display configuration details as an LVM configuration action you should get a screen that looks like the following.

At this point select Finish, that should take you back to the overview of partitions and mount points. There you should now see the Logical Volumes above the physical ones. At this point we have to format the partitions – logical volumes and assign mount points like we did with the boot partition. To do so go to the numbered entry underneath each volume and press enter. At the Use as: you have to select Ext4 Journaling file system for every single partition except the Swap (for swap it should be swap area). Remember we have named each logical volume after the mount point it is going to host. So it will be easy to select mount points for each volume. /home is for the home volume, / is for the root one, /var for the var. After finishing with the setting for each partition you should select Done setting up the partition to return to the overview.

When you are done with every single partition select Finish partitioning and write changes to disk, to continue. You will then be asked to write the changes to disk, select Yes and continue.

At this point the installation of the base system will start. When that finishes you will asked to create a new user. First you will be asked for the Fullname, then the username, then the password (twice). You will also be asked if you want to encrypt you home directory, that’s up to you, I usually leave it unencrypted. Then it is the proxy configuration, probably you will have to leave it blank and continue.

After a while you will get asked how you want to manage upgrades on the system. I usually prefer to do the updates on my own, so I prefer No automatic updates. Then will be prompted to select software to be installed, installed, ignore every single option and continue we will install everything needed on our own.

When you get prompted for the GRUB installation select Yes, to install the boot loader to the Master Boot Record. At this point you should get an Installation complete message. Remove the installation media and press Continue. The system should reboot at this point.

After the boot process is finished you will be presented with the login prompt, use your username and password to login.

At this point you should first do the following to update the installation to the latest packages.

sudo apt-get update
sudo apt-get upgrade

At this point we are going to install the OpenSSH Server in order to have shell access to our server.

sudo apt-get install ssh

After the installation of the OpenSSH server we have to edit the ssh daemon’s configuration file and change the Port from 22 (the default ssh port) to some other port of our selection. This is done for security reasons. This way you will avoid lot’s of automated brute force attacks that target the default ssh port.

sudo nano /etc/ssh/sshd_config

Now it’s time to restart the sshd to do so.

sudo /etc/init.d/ssh restart

At this point you should be able to connect to the server from another machine using an ssh client (on windows I prefer using Putty).

Installing Apache, MySQL and phpMyAdmin

To install the apache webserver we have to run the following:

sudo apt-get install apache2

After this we have to install php5:

sudo apt-get install php5 libapache2-mod-php5

and then we install the mysql server:

sudo apt-get install mysql-server

During the installation you will be asked to provide the password for the root user of the database. This password is the administrative password for the MySQL database. You will need it for the administration of the MySQL installation, like creating new users/tables editing privileges etc.

After this we are gonna install phpMyAdmin for the easy management of the database.

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

At some point during the installation you will get asked for the automatic configuration of phpMyAdmin. During this you will have to use the MySQL root (administrative user) password to allow the installer to configure automatically phpMyAdmin. After this you will also get asked for a password for the phpMyAdmin administrative user.

Dynamic IP and Dynamic-DNS

If you use a dynamic dns service like DynDNS or no-ip, with the free service you can get up to two different hostnames per account. Since gitorious needs its own hostname you can use own for gitorious and the second one for a normal site that will also host redmine as a sub-uri  and phpmyadmin etc. If you use a router with DD-WRT or running INADYN on the server it self you can configure it to update the two hostnames to your connection’s IP.

To do so in DD-WRT you have to go to Setup then DDNS there add you username – password and in the Host Name field add the following “hostname1 – a hostname2“, now DD-WRT should update both the hostnames with your IP every time it changes. With the usage of the virtual hosts in apache you you can now use the hostname1 for redmine, phpmyadmin, and the website and hostname2 for gitorious.

Preparing for Gitorious – Installing Git System and Various Essentials

First we have to install the git related packages, to do so we have to run the following command:

sudo apt-get install git-core git-svn

After this we are gonna install the MySQL client along with the development libraries. We are gonna need these for the Gitorious installation later.

sudo apt-get install mysql-client libmysqlclient-dev

All the following packages are gonna be needed at some point during the Gitorious installations so we are gonna install them all before starting the installation.

sudo apt-get install apg build-essential libpcre3 libpcre3-dev postfix make zlib1g zlib1g-dev
sudo apt-get install libonig-dev libyaml-dev geoip-bin libgeoip-dev libgeoip1
sudo apt-get install imagemagick libmagickwand-dev libmagick++-dev zip unzip
sudo apt-get install libxslt-dev libxml2-dev
sudo apt-get install libssl0.9.8
sudo apt-get install libcurl4-openssl-dev libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev
sudo apt-get install uuid uuid-dev openjdk-6-jre

Afterwards we will install memcached and add it to the default running services of our server.

sudo apt-get install memcached
sudo update-rc.d memcached defaults

Gitorious setup and configuration.

Ruby Enterprise Edition

At this point we have to get and install the Ruby Enterprise Edition (REE).

Before we start with the installation we are going to create a folder inside our home folder. There we are going to download and unzip all the resources need in this guide.

cd ~/
mkdir tmp
cd tmp

Since we are already inside the temporary directory now we can go to the website of REE and get the latest version. At the point of this installation the latest edition was v1.8.7-2011.03.

To download REE we have to go to the terminal, and download the latest version (get the URL from the download site) using wget.


In order to install REE we have to use dpkg,

sudo dpkg -i ruby-enterprise_1.8.7-2011.03_amd64_ubuntu10.04.deb

In case you downloaded a different, newer version just replace the filename with that of the one you downloaded.

After installing REE you have to append a few lines at the bottom of the /etc/profile file. In order to do so you have to open /etc/profile with an editor (I am gonna use nano) having administrative privilegdes,

sudo nano /etc/profile

and append the following,

export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH="/usr/local/lib"
export LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib"

Afterwards we have also to prepend the following to the /etc/ld/so.conf file.

sudo nano /etc/

to open the file and then add to the top of the file the following:


The next step after this is to run the following:

sudo su
source /etc/profile
sudo ldconfig

Ruby Gems Installation

At this point we are going to get and install Ruby gems. For this we will use again the temporary directory we created before.

cd ~/tmp
tar xvzf rubygems-1.4.2.tgz
cd rubygems-1.4.2
sudo ruby setup.rb

The following gems will be needed for Gitorious so we are gonna install them,

sudo gem install --no-ri --no-rdoc -v 0.8.7 rake
sudo gem install --no-ri --no-rdoc -v 1.1.0 daemons
sudo gem install -b --no-ri --no-rdoc rmagick passenger bundler

Sphinx Search Server Installation

After this we are gonna install the sphinx search server. If you check the website, the recommended version is the Beta of v2.0 or generally some newer version, but we are gonna use version 0.9.9 because that’s the one used in every guide, and it seems to be working fine. (To be honest I didn’t test the system using a newer version so I have no idea if it is working or not). (before downloading the file change in the tmp folder cd ~/tmp).

tar xvfz sphinx-0.9.9.tar.gz
cd sphinx-0.9.9/
./configure --prefix=/usr
sudo make install

Install Apache ActiveMQ

If you check the various guides on the net you will find out that many use as an alternative the stompserver. In our case we will use the Apache ActiveMQ as the messaging system.

Visit the ActiveMQ download page and search for the latest version. Go in the tmp folder we created (cd ~/tmp), copy the url and go to the terminal. There you have to:

sudo tar xzvf apache-activemq-5.5.1-bin.tar.gz -C /usr/local/
sudo sh -c 'echo "export ACTIVEMQ_HOME=/usr/local/apache-activemq-5.5.1"  >> /etc/activemq.conf'
sudo sh -c 'echo "export JAVA_HOME=/usr/" >> /etc/activemq.conf'
sudo chown -R activemq /usr/local/apache-activemq-5.5.1/data

After this you will have to edit the ActiveMQ configuration xml to prepare it for our Gitorious Installation. To do so:

sudo nano /usr/local/apache-activemq-5.5.1/conf/activemq.xml

Inside the xml file find the <transportConnectors> tags and add the following line inside:

<transportConnector name="stomp" uri="stomp://"/>

Then we have to create a symbolic link of the ActiveMQ init script inside the /etc/init.d:

sudo ln -sf /usr/local/apache-activemq-5.5.1/bin/activemq /etc/init.d/

Make it executable:

sudo chmod +x /etc/init.d/activemq

And finally add it to to the services with default priority so it starts when the machine starts.

sudo update-rc.d activemq defaults

Getting and configuring Gitorious

First we have to create the folder that will host the Gitorious installation inside the /var/www

sudo mkdir -p /var/www/gitorious

After this we have to create a new user for git. To do so:

sudo adduser --system --home /var/www/gitorious/ --no-create-home --group --shell /bin/bash git

At this point we will clone the gitorious repository to the folder we previously created.

sudo git clone git:// /var/www/gitorious

Then we have to give the ownership of the gitorious folder to the git user and then change the rights to the directory.

sudo chown git:git /var/www/gitorious/

sudo chmod -R g+sw /var/www/gitorious/

Afterwards we have to go to the gitorious directory:

cd /var/www/gitorious/

And then run the following:

sudo git submodule init
sudo git submodule update

Then we have to create a symbolic link of the gitorious in the binary path:

sudo ln -s /var/www/gitorious/script/gitorious /usr/bin

Then we have to create some folders inside the gitorious folder, and change the rights:

sudo mkdir -p tmp/pids
sudo chmod ug+x script/*
sudo chmod -R g+w config/ log/ public/ tmp/

Configuring the rest of the services

First we have to edit the git-daemon init script:

sudo nano /var/www/gitorious/doc/templates/ubuntu/git-daemon

In the file search for the line that starts with RUBY_HOME= and change it’s existing value, if it has one with the your ruby installation path. If you installed ruby enterprise edition as suggested, from the .deb package then it is probably in /usr/local.


You have to do the same for the git-poller script, it is in the same directory as the git-daemon.

Then we have to create the symbolic links of the following scripts in the /etc/init.d/

sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-ultrasphinx /etc/init.d/git-ultrasphinx
sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-daemon /etc/init.d/git-daemon
sudo ln -s /var/www/gitorious/doc/templates/ubuntu/git-poller /etc/init.d/git-poller

Next we have to make the scripts executable.

sudo chmod +x /etc/init.d/git-ultrasphinx
sudo chmod +x /etc/init.d/git-daemon
sudo chmod +x /etc/init.d/git-poller

And then we have to add them to the services with default priority.

sudo update-rc.d git-ultrasphinx defaults
sudo update-rc.d git-daemon defaults
sudo update-rc.d git-poller defaults

Next we have to get in the gitorious folder and  install the bundle:

cd /var/www/gitorious/
sudo bundle install

Afterwards we have to create the directories that will host the git repositories along with the tarballs for gitorious and give the ownership to git (user/group).

sudo mkdir /var/git
cd /var/git
sudo mkdir repositories
sudo mkdir tarballs
sudo mkdir tarballs-work</pre>
sudo chown -R git:git /var/git/

Check the ownership of the gitorious folder, if the owner is not the git and the git group then

sudo chown -R git:git /var/www/gitorious/

Preparing for the SSH authentication

Then we have to prepare the server for the SSH authentication. To do so we have to get logged in as the git user.

sudo su git
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 .ssh/authorized_keys

Configuring Gitorious

Next we have to configure Gitorious itself. I supposed you are still logged as the git user, if not do so (sudo su git).

Go in the Gitorious home directory (cd ~/) and copy the sample configuration files to create the new configurations files.

cp config/database.sample.yml config/database.yml
cp config/gitorious.sample.yml config/gitorious.yml
cp config/broker.yml.example config/broker.yml

The next step will be to edit the config/gitorious.yml file, but before doing so we have to use apg -m 64 on the terminal in order to create the cookie secret code. Copy the generated code to some text editor and remove the newlines, so it will be a single line string.

Now we can proceed with the file editing. To so use nano config/gitorious.yml (Remember you should be logged as git and in the user’s home directory).

Once inside the gitorioys.yml configuration file, you have to search for the line that starts with the production: string. This is the section of the configuration file that interests us.

In gitorious_host: you should put the host name used for your gitorious instance eg.

Note: The repository paths should be in /var/git we created previously so there will be no need to edit it in the configuration file, unless you decided to change the path.

In cookie_secret: you will have to paste the output of the apg -m 64 command you kept in the text editor previously.

Next you have to go to the is_gitorious_dot_org: false line. Uncomment it and make sure it is false. Also if you don’t want your repositories to be available to public you have to uncomment the public_mode: false, if it is not false you will have to make it. You can also search through the configuration file and find if you want to change any other options, they are pretty much well commented so you will have no trouble figuring out what each one does. You can also remove or comment the whole test: section.

The next step will be the to create and migrate the database. Before we do anything at all we have to create the gitorious user and the related table in our database. Most people prefer to do so through the terminal in their guides, if you want to do so you can follow one of the links in the end to find how to do so, if you don’t already know. My own approach will be using phpMyAdmin.

Go to the phpMyAdmin page (it should be something like hostname/phpmyadmin or serverip/phpmyadmin). Log in and then go to the tab Priviledges. Once in there click on the Add new User option.

In the field User Name: you should put gitorious, in the Host: field you have to select localhost and generate a random password. Keep the generated password noted somewhere because we are going to need it in the database.yml configuration file. Then find the Database for user section and select Create database with same name and grant all privileges. Finally click on the create user button to create our new database user.

Now we have to return to the terminal and open the database.yml configuration file for editing (nano config/database.yml). Once open search for the production: section and edit it so it looks like this:

  adapter: mysql
  database: gitorious
  username: gitorious
  password: the password we kept previously
  host: localhost
  encoding: utf8

Now we can finally exit from the git user (just type exit and you should be back to your normal user). Then change to the gitorious folder (cd /var/www/gitorious) once there run the following:

sudo rake db:setup RAILS_ENV=production

Then we have to create the administrative user for gitorious.

sudo env RAILS_ENV=production ruby script/create_admin

As soon as we create the administrative user we have to get the ultrasphinx running. To do so we have to run the following (we should be in the /var/www/gitorious):

rake ultrasphinx:bootstrap RAILS_ENV=production

If you by any case get the following error:

ERROR: index 'main': sql_range_query: Unknown column '' in 'field list'

You have to got to app/models/project.rb and replace the following,

s.collect(:name, :from => “ActsAsTaggableOn::Tag”, :as => “category”

with this,

s.collect(‘’, :as => “category”

Also there is a chance that you will also get a message about the “address” being deprecated. In that case you will have to do the following,

sudo nano config/ultrasphinx/default.base

In the default.base search for the searchhd text and replace the word address with listen. After this the bootstrap command should run without issues.

Then we have to change the rights for a few folders and files (some of the folders there should already have the proper rights).

sudo chmod -R g+w config/environment.rb script/poller log tmp
sudo chmod ug+x script/poller

Then we have to add a cron job for ultrasphinx. To do so we have to type sudo crontab -e and add inside the following,

* * * * * cd /var/www/gitorious &&/usr/local/bin/rake ultrasphinx:index RAILS_ENV=production

Configuring Logrotate

Go inside the gitorious directory (cd /var/www/gitorious) and copy the logrotate template and make it executable,

sudo cp doc/templates/ubuntu/gitorious-logrotate /etc/logrotate.d/gitorious
sudo chmod +x /etc/logrotate.d/gitorious

Install the Passenger module

Now we have to install the apache passenger module to do so:

sudo passenger-install-apache2-module

At some point the passenger installation will generate something like the following,

Please edit your Apache configuration file, and add these lines:
   LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/
   PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
   PassengerRuby /usr/local/bin/ruby

Keep it noted for a moment because we will need it for the passenger module configuration files.

First we are going to create the .conf file, to do so type sudo nano /etc/apache2/mods-available/passenger.conf. Inside the empty file add the PassengerRoot and PassengerRuby lines and save the file. It should look something like the following,

PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
 PassengerRuby /usr/local/bin/ruby

Then we are going to create the .load file, to do so type sudo nano /etc/apache2/mods-available/passenger.load. Inside the empty file we should add the LoadModule line. It should look something like the following,

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/

Note: the paths or the versions may differ so adjust accordingly.

Also at this point we will also install the xsendfile mod for apache.

sudo apt-get install libapache2-mod-xsendfile

Check the xsendfile mod version and keep it noted for the virtual host configuration.

dpkg -l | grep libapache2-mod-xsendfile

Then we have to enable some apache modules:

sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod passenger
sudo a2enmod expires
sudo a2enmod ssl
sudo a2enmod xsendfile

At this points we have to disable the default apache site if it is enabled,

a2dissite default

and then restart apache sudo /etc/init.d/apache restart.

Then we have to append the following to ~/.bashrc as the git user (sudo su git).

#User specific aliases and functions
export RUBY_HOME=/usr/local
export GEM_HOME=$RUBY_HOME/lib/ruby/gems/1.8/gems

Finally we have the apache configuration for gitorious. We will start with the configuration for the port 80. Type in the terminal sudo nano /etc/apache2/sites-available/gitorious. In the empty file created add something that looks like the following,

<VirtualHost *:80>
   DocumentRoot /var/www/gitorious/public
   ErrorLog /var/www/gitorious/log/gitorious-error.log
   CustomLog /var/www/gitorious/log/gitorious-access.log combined
   <IfModule mod_xsendfile.c>
     XSendFile on
     XSendFilePath /var/git

If the version of xsendfile mod is <0.10 you have to use the following instead in the IfModule mod_xsendfile.c tags.

 <IfModule mod_xsendfile.c>
    XSendFile on
    XSendFileAllowAbove on

Now we can activate the the gitorious site with the command a2ensite gitorious.

Then we have to create the apache configuration for the port 443 (the SSL connection) to do so go type sudo nano /etc/apache2/sites-available/gitorious-ssl. In the empty file created you have to add something that looks like the following

<IfModule mod_ssl.c>
<VirtualHost *:443>
        DocumentRoot /var/www/gitorious/public
        ErrorLog /var/www/gitorious/log/gitorious-ssl-error.log
        CustomLog /var/www/gitorious/log/gitorious-ssl-access.log combined

        <IfModule mod_xsendfile.c>
            XSendFile on
            XSendFilePath /var/git

	#   SSL Engine Switch:
        #   Enable/Disable SSL for this virtual host.
        SSLEngine on

        #   A self-signed (snakeoil) certificate can be created by installing
        #   the ssl-cert package. See
        #   /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
        #   If both key and certificate are stored in the same file, only the
        #   SSLCertificateFile directive is needed.
        SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
        SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

        #   SSL Protocol Adjustments:
        #   The safe and default but still SSL/TLS standard compliant shutdown
        #   approach is that mod_ssl sends the close notify alert but doesn't wait for
        #   the close notify alert from client. When you need a different shutdown
        #   approach you can use one of the following variables:
        #   o ssl-unclean-shutdown:
        #     This forces an unclean shutdown when the connection is closed, i.e. no
        #     SSL close notify alert is send or allowed to received.  This violates
        #     the SSL/TLS standard but is needed for some brain-dead browsers. Use
        #     this when you receive I/O errors because of the standard approach where
        #     mod_ssl sends the close notify alert.
        #   o ssl-accurate-shutdown:
        #     This forces an accurate shutdown when the connection is closed, i.e. a
        #     SSL close notify alert is send and mod_ssl waits for the close notify
        #     alert of the client. This is 100% SSL/TLS standard compliant, but in
        #     practice often causes hanging connections with brain-dead browsers. Use
        #     this only for browsers where you know that their SSL implementation
        #     works correctly.
        #   Notice: Most problems of broken clients are also related to the HTTP
        #   keep-alive facility, so you usually additionally want to disable
        #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
        #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
        #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
        #   "force-response-1.0" for this.
        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        # MSIE 7 and newer should be able to use keepalive
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown


After saving the file you can activate the gitorious ssl site by typing a2ensite gitorious-ssl then you have to restart apache in order to load the new configuration with /etc/init.d/apache2 restart.

At this point you may also want to disable the password access for the git user, to do so type sudo nano /etc/ssh/sshd_config and add the following line at the end of the file:

Match User git
 PasswordAuthentication no

Then  you can reload the SSH configuration with sudo /etc/init.d/ssh reload. Now the git user should be accessible only by using public-private key combinations.

Installing Redmine

Previously in the guide we created a tmp folder in the home folder, if you kept the directory change in it cd ~/tmp (if you deleted or just started the guide from this point you can create it before changing in it by mkdir ~/tmp). After changing in the tmp folder you can open your browser and go to RubyForge to find the link to the latest version of redmine. In my case the latest version was the 1.2.1. Copy the link location and then go to the terminal type the wget command and paste it after the command. After downloading the file un-tar it and go in the redmine folder.

tar -xvzf redmine-1.2.1.tar.gz
cd redmine-1.2.1/

At this point we have to create the redmine user in the database.

Go to the phpMyAdmin page (it should be something like hostname/phpmyadmin or serverip/phpmyadmin). Log in and then go to the tab Priviledges. Once in there click on the Add new User option.

In the field User Name: you should put redmine, in the Host: field you have to select localhost and generate a random password. Keep the generated password noted somewhere because we are going to need it. Then find the Database for user section and select Create database with same name and grant all privileges. Finally click on the create user button to create our new database user.

Then we have to copy the example configuration file in order to create the database.yml file.

cp config/database.yml.example config/database.yml

And then we have to edit the new database configuration file so it looks like this,

  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: The randomly generated password for the redmine user
  encoding: utf8

At this point we are gonna install the needed gems for redmine to run properly, so you have to install,

sudo gem install --no-ri --no-rdoc -v=0.4.2 i18n
sudo gem install --no-ri --no-rdoc -v=1.1.0 rack

Next we have to move the redmine folder inside /opt, to do so:

sudo mkdir /opt/redmine
cd /opt/redmine
sudo cp -r ~/tmp/redmine-1.2.1 .

Then get inside the new redmine directory it should be /opt/redmine/redmine-1.2.1 and run the following to generate the session store, migrate the database and load the default data.

rake generate_session_store
sudo RAILS_ENV=production rake db:migrate
sudo RAILS_ENV=production rake redmine:load_default_data

During the default data loading if you get asked for a language, accept the default language (English). Then we have to change ownership on a few folders in the redmine folder, and change the rights on a few more.

sudo chown -R www-data:www-data files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

The passenger module should already be loaded since we installed Gitorious previously.

Now we have to configure the virtual host for redmine. I have to note at this point that Redmine will be configured in the hostname with the phpmyadmin etc.

In the virtual host configuration you have to add the following lines:

PassengerAppRoot /opt/redmine/redmine-1.2/
RailsBaseURI /redmine
RailsEnv production

Then we have to create a symbolic link for redmine public directory in the webroot of the hostname that hosts everything other than gitorious, supposing that the webroot /var/www/ then you have to:

sudo ln -s /opt/redmine/redmine-1.2.1/public /var/www/redmine

We also have to edit the passenger.conf file and add the following line:

PassengerDefaultUser www-data

If you use Eclipse as an IDE for development you may also want to install in the redmine installation the plugin for the Eclipse MyLyn integration. To do so you have to get in the redmine directory and execute the following:

sudo ruby script/plugin install git://

In case you get at some point the the following warning due to having two virtual hosts for port 443 on the same server,

[warn] _default_ VirtualHost overlap on port 443, the first has precedence

you have to edit the ports.conf file, sudo nano /etc/apache2/ports.conf, go inside the <IfModule mod_ssl.c>tags and add NameVirtualHost *:443 above the Listen 443 line, then save the file.

Resources Used

Redmine SUB-URI and Apache configuration

While trying to setup Redmine in a sub-uri I run across an issue will trying to setup apache. Passenger would display the following error: No such file or directory – config/environment.rb while trying to access the Redmine webpage.

After trying a few suggestions on the issue I managed to get Redmine to work with the following configuration:

The passenger.load configuration file was the following (the paths will probably vary depending on the installation):

LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/
PassengerRoot /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.9
PassengerRuby /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby
PassengerDefaultUser www-data

In the Virtual Host configuration I added the following:

        PassengerAppRoot /usr/local/lib/redmine-1.2/
        RailsBaseURI /redmine
        RailsEnv production

PassengerAppRoot represents the path that redmine is installed.
RailsBasedURI represents the sub directory in the URL that represents Redmine eg.

(for this to work is also essential to have a symbolic link of the redmine-*.*/public inside the web root folder).

Also I changed ownership of the redmine-1.2 folder and the symlink redmine folder to the apache user/group (I am under the impression that it was necessary).

Changing author in git

While transferring my code repositories from SVN to git, I completely forgot to change the author name in the commits, so the wrong user appeared. I could possibly just reconvert the svn repository to git to fix the issue but since I have been trying to merge the the SVN generated git with a new git that was the continuation of the last SVN checkout, when I succeeded I didn’t want to go through all that process again. Luckily I found the following post “How to change the author in git“.

The following code is taken from the source specified above:

git filter-branch --commit-filter '
        if [ "$GIT_COMMITTER_NAME" = "Wrong Commiter Name" ];
                GIT_COMMITTER_NAME="Right Commiter Name";
                GIT_AUTHOR_NAME="Right Commiter Name";
                git commit-tree "$@";
                git commit-tree "$@";
        fi' HEAD

Back to my Hometown

I am back to my hometown for a few days, (due to the orthodox easter) though I am not a believer myself I have to visit and join my family for this. It’s nice, but actually today (easter) was a pretty tiring day. I have a few days to sleep well, and the bed here is not as comfortable as my bed back in the city.

Since I am already here, I also did some maintenance stuff on my home computer here, like whatever updates got released since my last time here, since I am actually the only one that does something like this, I am even guessing that this computer doesn’t get much use at all. I actually have to do some updates-maintenance to my brothers computer tomorrow (that’s the one computer in the house that gets used regularly).

These days I was testing an issue I had since way back, with this computer. Some times when the computer was getting loaded with stuff, it would make a click sound after which the HDD would stop spinning and the computer would freeze. I was testing various stuff. I have two IDE drives installed on this machine, an 80GB Western Digital ATA-100 HDD and an Optiarc optical drive (DVD-RW). The HDD was set as master on the IDE-0 and the optical as master on the IDE-1. The thing I did was changing the setup HDD to IDE-1 and optical to IDE-0 without changing the cables used, up to this point, for the last 24hours the computer didn’t freeze at all, before it would freeze once every few hours. My suspicion is towards the cable, but I can’t tell for sure if I don’t check it.

One more of the things I did, was to replace the ArchLinux, on the secondary partition with Ubuntu 10.04 Beta as a secondary OS, and configure the linux up to my liking making it accessible only for me. I also installed BURG and the redit theme so now the boot selection menu looks something like the following:

OS Selection Menu
OS Selection Menu

I also installed some needed software, including the client for linux. I recently found out that the linux client is perfect for iPod scrobbling. I stopped using iTunes some time now, I used to prefer iTunes to since iPod due to the fact that I could scrobble the music I listened on the go, but many times the feature didn’t actually work, and I suspect an iTunes issue, so I decided to stop using iTunes, because I don’t really like it. Lately I usually add music to my iPod through Winamp in Windows and scrobble it through the linux client. It’s actually really easy, you just connect your iPod, go Scrobble iPod on the client menu, then select the path where your iPod is mounted and there you go, and this stuff works every single time unlike the iTunes& combo on Windows. I also installed conky with conky colors and some other useful stuff. Here is a screenshot of the desktop:


Then today I decided to play some game on my brother’s PSP so I downloaded “Lunar: Silver Star Harmony” but I couldn’t play it. I got some error and after some Google search I found out that I had to upgrade the firmware. The PSP had the 3.71 M33 CFW and according to a few forum I had to install the 5.50 GEN-D3 in order to play the game. I spend a great amount of time trying to figure out how to update the firmware, since it was my first time upgrading a PSP with CFW. For some time I was placing the needed files in different folders so I was getting a “Corrupted Data” in the PSP menu and I couldn’t upgrade, when I figured out I updated to 500 M33-6 (after figuring out how to bypass the battery check). According to a guide 500 M33-6 was the minimum requirement in order to upgrade to 5.50 GEN-D3 Final. Then I used the XGEN updater and finally I installed the firmware I needed, and finally started the game. However I spend most of my time on the update process that I didn’t have any time left to play… I ll try to continue with it tomorrow.

I actually got some photos from the preparation of the food today, and a few of the trees near the place we were, but I am kind of tired to search for the usb cable for my phone, to transfer the photos on my computer. I guess I’ll post them tomorrow in a new post.

ArchLinux Everywhere xD

Due to elections in Greece these in the 4th of October, I had to travel back to my hometown in order to vote. So I had some time for some maintenance on the village computer an Athlon XP 2600+ with 1GB ram and stuff. I decided to shrink a little bit more the windows partition (I have Windows 7 installed with some essential software),  I usually use it for web browsing mostly and my parents (actually my mother, because my father doesn’t even know how to power on the computer) use it to burn audio/mp3 cds. So I had a small partition with Ubuntu linux as a form of supporting OS installation, because I generally had some issues with this PC.

So having enough spare time and nothing actual to do while there, I decided to reformat the computer, setup Windows 7 from scratch properly (last time I didn’t create a System Reserved partition), and leave some more room for ArchLinux to get installed. I created a 60MB /boot partition a 512MB swap partition and around 25GB root partition. It took me a while to finish with whatever I had in mind to do with my ArchLinux installation, due to the reason that it took me some time to figure the proper drivers for my nvidia GPU. Apparently in the latest drivers nvidia dropped support for older GPUs like the FX 5 series so trying to install the latest wouldn’t get my GPU working properly. After this I some how found that 173 was the latest drivers that supported my GPU and got it working.

The only actually issue I had with that computer, was with flash movie players in sites like youtube and stuff. I many times tend to open a great number of videos, watching one and having other loading for example. So I tried to do the same on the old computer… and the result… CPU usage 100% after opening the second video/tab.

Operation ArchLinux


So up to this point I was able to get ArchLinux up, and running :), I used the xorg-server with the maximize fix with ATi catalysts in order to get my eyecandy working flawlessly, installed the catalyst 9.9 from the AUR again, I finished setting up Gnome, and I configured the system starting with GDM instead of console, I got my ArchLinux Gnome Login screen, and a black ArchLinux desktop, with black glossy Icons, GnomeDo with docky theme, Compiz-Fusion running, conky to do the System Monitoring etc. I have to admit it really looks wonderful :D.

Now I only have to do some tweaking, for example, I am not sure why, but the icons on the desktop seem to appear only at the moment I scroll over them and then disappear again… I also want to finish with some other things revolved around eyecandy. First of all I want to install Splashy with Uvesafb support and finally Grub2 with some nice ArchLinux theme.

Here is a screenshot of the desktop so far:


Nah Not for me…

Well this so far was my best experience with Gentoo after all these years that I try to mesh around with various linux distributions. I honestly can’t call myself an expert, however through these years I gained some experience by meshing around and through an Operating Systems course (focused around UNIX/Linux and bash shell) I attended a year ago. I have to admit that it was one of the most interesting lessons I have attended lately. So this time I was able to reach the desktop stage… I could launch GDM and use Firefox and stuff… It is the first time I reached that far. Usually something would go wrong while compiling the packages or even while setting up the base system.

However even this time things didn’t go exactly as I intended. So first of all, I was unable to get my Creative Audigy soundcard working, so there was no sound for me. I tried reconfiguring and recompiling the kernel, first using the audigy driver as a part of the kernel, and then compiling it as a module… obviously I was doing something wrong because I didn’t manage to modprobe the audigy (emu10k1) driver module. Probably I didn’t study enough to get it done properly. Secondly I was unable to get the crappy fglrx module loaded with the kernel. After using modprobe fglrx there was always the same error, something like the following:

FATAL: Error inserting fglrx (/lib/modules/2.6.30-gentoo-r5/video/fglrx.ko): Operation not permitted

I found some suggestions online on what should I do in that case but after messing around with the kernel for a while, I was still unable to get it working. So after spending some serious time to play around with Gentoo I will try again to setup a proper ArchLinux system. Even if it is not as easy as distributions like Ubuntu, OpenSUSE or Mandriva, in the installation I am sure it is easier and faster than Gentoo… I ll guess I will postpone Gentoo for sometime in the future. Either way it was a good experience. I still learned on thing or two with this thing.

Always Something will go wrong when I try to install gentoo…

Well not much to say actually, but usually when I try to install Gentoo on a computer, always, at some point something will definitely go wrong.. that’s the reason I never successfully installed Gentoo up to this point, this time the actual problem however was something small. For some reason the character encoding on the terminal changed? The output was various ASCII characters and the text was unrecognizable, however the solution to this was easy. I just rebooted the system, booted again from the liveCD, mounted the partitions once more and then CHROOTed again to continue from where i stopped last time.

Let’s hope that the installation will finish without any problems….

Partitioning Problems

Usually during the installation of various distributions I tend to use the default partitioning tool. However in some distros either the tool works in a way that I don’t really like or, sometimes i have a problem to much the partitioning scheme in mind with the one that actually make. For example when I tried to make a multiboot system with Windows XP, Windows 7, Backtrack 4, Mandriva Linux 2009 Spring, OpenSuse 11 and Ubuntu 9.04 , the scheme I had in mind was, each Windows version on it’s own primary partition, the same going for Backtrack, and then a huge extended partition with 4 logical partitions inside, one for each distro and one for Swap. And it seemed to work fine actually, up to the point that OpenSuse installed itself on a primary partition (probably my fault that this happened but anyway), and so I was left with 4 primary partitions, one extended in the middle with Mandriva and the Swap, and a huge unallocated space at the end of my disk, in which I intended to install Ubuntu back I was unable. So I used the Gparted on the Ubuntu livecd to fix the partitions and I deleted the Opensuse one. But for some reason I was unable to resize the extended partition so I had to wipe out all the non-Windows partitions and make create them from scratch with Gparted, at least this way I was able to make the partitioning the way I wanted.

Now today I started my tries to get Gentoo installed, on the space I left after yesterdays ArchLinux Installation. Well the scheme was 1 primary partition for /boot and a huge extended after this including the root partition and the swap file of Arch and also the root partition and of Gentoo… however again I was unable to resize the extended which I created with ArchLinux’s partition editor. So again I wiped out almost all the disk and created the partitions from scratch… I guess I ‘ll have to reinstall ArchLinux again later, but now it will be easier… at least I will not repeat the same mistakes…