FreeNAS + Mercurial

mercurial logoI was recently tinkering around with Mercurial and getting my feet wet using a distributed source version control. I have been using Subversion for about the past year, and has served me well. I wanted to get involved with some of the projects hosted on in order to fork some projects.  The are a number of useful Codeigniter projects and zen-cart addons on there as well. One of the main ideas behind using a DSVC is not needing a centralized server. This seems great, if you are doing your work where will you have access to the network at some point to push/pull those changesets.  I work from a couple locations and need to be able to push/pull those changes. Pricing plans on are very reasonable, but I needed to host a few extra private repositories. Got me thinking to install mercurial on that FreeNAS box sitting quietly in my basement.  I am currently using FreeNAS .69. If you are running another build of FreeNAS, you will need to find the appropriate packages for your build.It took a looking around in the FreeBSD ports to find the packages I needed. It was actually  a lot easier than  I though it would be. Here is a list of the packages you will need for FreeNAS:

  1. Mecurial 1.5.4
  2. Python 2.6.5
  3. Libiconv 1.13.1
  4. Gettext 0.18

Download each of the files to your desktop, and login into your FreeNAS webGUI. Then navigate to System->Packages. Click on the “Add” icon to install a new package. On the next screen you will see a browse button and install button.

FreeNAS install packages
Click to Enlarge

You will need to install the packages in the correct order to satisfy their dependencies. Click on the “Browse” button, then “Install” button for each in this order:

  1. libiconv-1.13.1_1.tbz
  2. gettext-0.18_1.tbz
  3. python26-2.6.5.tbz
  4. mercurial-1.5.4.tbz

Congratulations you now have mercurial installed on your FreeNAS box. You starting hosting your own repositories. I create a folder in my FreeNAS drive and issued a:

$hg init

I copied a few files in the folder from my laptop using Windows Explorer and then typed:

$hg add
$hg commit -m "Import new files into repo"

Now I clone the repo to my laptop using

$hg clone ssh://user:pass@freenas/path/to/repo local-folder

If you omit the user and pass from the url, your will be prompted for them. This seemed like it would be a little more difficult to do as there is very little documentation on the FreeNAS website about packages. I was unable to find any other posts about this setup, so I hope someone else will find it useful.