So I recently purchased a super cheap 1U rack-mount barebone server from newegg made by ASUS. Luckily newegg had an awesome combo deal too with an Intel Xeon X3220 2.4GHz processor for about $360, then $20 for 2GB of RAM and I was pretty much set (after picking up a couple 1TB hard drives for a sweet RAID 1 array ;D)
Anyway, the real point of this post isn’t the server, it was the living hell that was the setup process for a decent remote source code repository. Originally I was going to install subversion, but a friend told me about Git so I decided to give it a try. After some searching on google, I learned about Gitosis which is described as:
Gitosis manages multiple repositories under one user account, using SSH keys to identify users. However, users do *not* need shell accounts on the server, instead they will talk to one shared account that does not allow arbitrary commands.
First I give credit where it is due, here is a list of my sources for setting everything up:
Now all of these articles were pretty helpful in their own right, but I am not sure if I was being an idiot, but I just couldn’t get the setup I wanted to work right. It seemed like each of those articles were missing some pieces that were very important to get everything to work together right, and most just referenced the scie.nti.st post, with a little modification, coming ever closer to a complete walkthrough but yet leaving much to be desired. Hopefully I can put all the pieces together, so that any poor fool that attempts this can avoid the hair pulling experience I had.
To begin, I will go over what I started with. I installed the 64-bit(amd64) version of Ubuntu Server 8.10 and made sure to at least install OpenSSH, giving the server a static IP address, and giving it a hostname using the built in DNS in my router. All of these parts are easy enough, and walkthroughs are only a google search away.
Now to start the real work, first true step is to install Git itself. Now my first instinct was to run:
sudo apt-get install git
Which would be a bad move, since that will install “GNU Interactive Tools” which is not the Git revision control system. The package for Git has a slightly different name in the Ubuntu package system, but before I get into that I should mention that the version installed with
apt-get will be kind of old and if you want to get the most current version of Git, you need to download the source code and compile/install it yourself.
Installing Git From Source:
First we install some needed libraries and such for the compiling/installing:
sudo apt-get install libexpat1-dev zlibc curl gettext
sudo aptitude install build-essential
Now navigate to (or create) whatever folder you want to do the work in and download then extract the source files. Before you blindly copy and paste my commands though I would recommend going to www.kernel.org/pub/software/scm/git/ and looking for the most up to date (that you feel comfortable using) version to download, I downloaded and compiled git-1.6.1.tar.gz as it was the most up to date version as of this writing.
tar -zxvf git-1.6.1.tar.gz
Now we are getting somewhere, you should have everything you need now to get this baby installed. Next up to do:
sudo make install
So after those commands, as long as you didn’t get any weird errors (if you did, google is your friend) then the most up to date version of Git should be installed. But “if it asks for an installation location it is recommended to install all the source to /usr/src”
The alternative to installing from source is to use
apt-get to install Git for you by running:
sudo apt-get install git-core
Now that git is installed Gitosis can now be installed and setup. Start by navigating to the directory where you want to download the Gitosis files to and run:
git clone git://eagain.net/gitosis.git
sudo apt-get install python-setuptools
python setup.py install
These commands will download the needed Gitosis files using git, then install everything needed to install and run Gitosis and finally install Gitosis on the machine.
In my next post I will go over the configuration needed to actually remotely setup and use a Git repository.