<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb"><title>intranation.com - Latest Entries</title><link href="http://intranation.com/" rel="alternate" /><id>http://intranation.com/</id><updated>2010-02-14T10:52:53+00:00</updated><subtitle>Latest entries written by Bradley Wright on intranation.com</subtitle><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/intranation-latest" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="intranation-latest" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry><title>Using Dropbox as a Git repository</title><link href="http://intranation.com/entries/2010/02/using-dropbox-git-repository/" rel="alternate" /><updated>2010-02-14T10:52:53+00:00</updated><author><name>Bradley Wright</name><uri>http://intranation.com/about/#bradley-wright</uri></author><id>http://intranation.com/entries/2010/02/using-dropbox-git-repository/</id><summary type="html">&lt;p&gt;So last month &lt;a href="/entries/2010/01/how-set-up-your-own-private-git-server-linux/"&gt;I wrote a bit about setting up your own personal Git repositories on a Linux box&lt;/a&gt;, and how to use that for sharing code.&lt;/p&gt;
&lt;p&gt;I’ve had a slight epiphany since then: what if I just used the awesome &lt;a href="http://dropbox.com"&gt;Dropbox&lt;/a&gt; (&lt;a href="https://www.dropbox.com/referrals/NTE5NjgwOQ"&gt;my referral link&lt;/a&gt;, if you’re likely to sign up) to share Git repositories between computers? Dropbox seems able to get through most corporate firewalls (my &lt;a href="http://thisisglobal.com" rel="nofollow"&gt;previous empoyer&lt;/a&gt; blocked SSH, for example), and is very unobtrusive in its synchronisation behaviour.&lt;/p&gt;
&lt;h2&gt;Enough introductions, make with the commands&lt;/h2&gt;
&lt;p&gt;Okay, here we go. Basically, we’re just going add a new &lt;code&gt;remote&lt;/code&gt; which points at Dropbox (in the same way the &lt;code&gt;origin&lt;/code&gt; remote typically points at your primary external repository). Please note these instructions should be mostly &lt;var&gt;*Nix&lt;/var&gt; agnostic—but they’re only tested on &lt;a href="http://www.apple.com/macosx/"&gt;OS X&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;First, create the Git repository in Dropbox (assuming your repository is named &lt;var&gt;myrepo&lt;/var&gt;):&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;cd ~/Dropbox&lt;/kbd&gt;
&lt;kbd&gt;mkdir -p repos/myrepo.git&lt;/kbd&gt;
&lt;kbd&gt;cd !$&lt;/kbd&gt;
&lt;kbd&gt;git --bare init&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;And that’s the repository created. Basically we made a bare repository in the Dropbox directory.&lt;/p&gt;
&lt;p&gt;Now we can add the new &lt;code&gt;remote&lt;/code&gt; to our existing repository (again, assuming it lives at &lt;var&gt;~/Projects/myrepo&lt;/var&gt;).&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;cd ~/Projects/myrepo&lt;/kbd&gt;
&lt;kbd&gt;git remote add dropbox file://$HOME/Dropbox/repos/myrepo.git&lt;/kbd&gt;
&lt;kbd&gt;git push dropbox master&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;And we’re done. We’ve created the repository, linked a Git remote to it, and pushed the &lt;var&gt;master&lt;/var&gt; branch to the repository. This Git repository will now be available on all computers that your Dropbox account is.&lt;/p&gt;
&lt;h2&gt;Pulling from the repository&lt;/h2&gt;
&lt;p&gt;When you get to a computer that shares this Dropbox account, but hasn’t checked out Git yet, do as follows:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;cd ~/Projects&lt;/kbd&gt;
&lt;kbd&gt;git clone -o dropbox file://$HOME/Dropbox/repos/myrepo.git&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;Which will add your repository locally, and automatically set up a remote called &lt;var&gt;dropbox&lt;/var&gt; which auto–merges with &lt;var&gt;master&lt;/var&gt;.&lt;/p&gt;
&lt;p&gt;I think this approach could be valuable for things like keeping personal documents or text files in version control (or indeed personal coding projects) without bothering to set up your own Linux box or server. Git really does make these things incredibly easy.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/intranation-latest/~4/fnf9eB6z_F4" height="1" width="1"/&gt;</summary><category term="development" /><category term="osx" /><category term="dropbox" /><category term="git" /></entry><entry><title>How to set up your own private Git server on Linux</title><link href="http://intranation.com/entries/2010/01/how-set-up-your-own-private-git-server-linux/" rel="alternate" /><updated>2010-01-09T18:06:55+00:00</updated><author><name>Bradley Wright</name><uri>http://intranation.com/about/#bradley-wright</uri></author><id>http://intranation.com/entries/2010/01/how-set-up-your-own-private-git-server-linux/</id><summary type="html">&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; the ever–vigilant &lt;a href="http://mikewest.org" rel="friend met colleague"&gt;Mike West&lt;/a&gt; has pointed out that my instructions for &lt;a href="#permissions-change"&gt;permissions&lt;/a&gt; and &lt;a href="#git-co-change"&gt;git checkout&lt;/a&gt; were slightly askew. These errors have been rectified.&lt;/p&gt;
&lt;p&gt;One of the things I’m attempting to achieve this year is simplifying my life somewhat. Given how much of my life revolves around technology, a large part of this will be consolidating the various services I consume (and often pay for). The mention of payment is important, as up until now I’ve been paying the awesome &lt;a href="http://github.com/"&gt;GitHub&lt;/a&gt; for their basic plan.&lt;/p&gt;
&lt;p&gt;I don’t have many private repositories with them, and all of them are strictly private code (this blog; &lt;a href="http://yahnyinlondon.com" rel="sweetheart met friend co-resident"&gt;Amanda’s blog templates and styles&lt;/a&gt;; and some other bits) which don't require collaborators. For this reason, paying money to GitHub (awesome though they may be) seemed wasteful.&lt;/p&gt;
&lt;p&gt;So I decided to move all my private repositories to my own server. This is how I did it.&lt;/p&gt;
&lt;h2&gt;Set up the server&lt;/h2&gt;
&lt;p&gt;These instructions were performed on a Debian 5 "Lenny" box, so assume them to be the same on Ubuntu. Substitute the package installation commands as required if you’re on an alternative distribution.&lt;/p&gt;
&lt;p&gt;First, if you haven’t done so already, add your public key to the server:&lt;/p&gt;

&lt;pre&gt;&lt;kbd&gt;ssh myuser@server.com mkdir .ssh&lt;/kbd&gt;
&lt;kbd&gt;scp ~/.ssh/id_rsa.pub myuser@server.com:.ssh/authorized_keys&lt;/kbd&gt;&lt;/pre&gt;

&lt;p&gt;Now we can SSH into our server and install Git:&lt;/p&gt;

&lt;pre&gt;&lt;kbd&gt;ssh myserver.com&lt;/kbd&gt;
&lt;kbd&gt;sudo apt-get update&lt;/kbd&gt;
&lt;kbd&gt;sudo apt-get install git-core&lt;/kbd&gt;&lt;/pre&gt;

&lt;p&gt;...and that’s it.&lt;/p&gt;

&lt;h3&gt;Adding a user&lt;/h3&gt;

&lt;p&gt;If you intend to share these repositories with any collaborators, at this point you’ll either:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Want to install something like &lt;a href="http://eagain.net/gitweb/?p=gitosis.git"&gt;Gitosis&lt;/a&gt; (outside the scope of this article, but &lt;a href="http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way"&gt;this is a good, if old, tutorial&lt;/a&gt;); or&lt;/li&gt;
&lt;li&gt;Add a “shared” Git user.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We’ll be following the latter option. So, add a Git user:&lt;/p&gt;

&lt;pre&gt;&lt;kbd&gt;sudo adduser git&lt;/kbd&gt;&lt;/pre&gt;

&lt;p&gt;Now you’ll need to add your public key to the Git user’s &lt;code&gt;authorized_keys&lt;/code&gt;:&lt;/p&gt;
&lt;pre id="permissions-change"&gt;&lt;kbd&gt;sudo mkdir /home/git/.ssh&lt;/kbd&gt;
&lt;kbd&gt;sudo cp ~/.ssh/authorized_keys /home/git/.ssh/&lt;/kbd&gt;
&lt;kbd&gt;sudo chown -R git:git /home/git/.ssh&lt;/kbd&gt;
&lt;kbd&gt;sudo chmod 700 !$&lt;/kbd&gt;
&lt;kbd&gt;sudo chmod 600 /home/git/.ssh/*&lt;/kbd&gt;
&lt;/pre&gt;
&lt;p&gt;Now you’ll be able to authenticate as the Git user via SSH. Test it out:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;ssh git@myserver.com&lt;/kbd&gt;&lt;/pre&gt;

&lt;h2&gt;Add your repositories&lt;/h2&gt;
&lt;p&gt;If you were to not share the repositories, and just wanted to access them for yourself (like I did, since I have no collaborators), you’d do the following as yourself. Otherwise, do it as the Git user we added above.&lt;/p&gt;
&lt;p&gt;If using the Git user, log in as them:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;login git&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;Now we can create our repositories:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;mkdir myrepo.git&lt;/kbd&gt;
&lt;kbd&gt;cd !$&lt;/kbd&gt;
&lt;kbd&gt;git --bare init&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;The last steps creates an empty repository. We’re assuming you already have a local repository that you just want to push to a remote server.&lt;/p&gt;
&lt;p&gt;Repeat that last step for each remote Git repository you want.&lt;/p&gt;
&lt;p&gt;Log out of the server as the remaining operations will be completed on your local machine.&lt;/p&gt;
&lt;h2&gt;Configure your development machine&lt;/h2&gt;
&lt;p&gt;First, we add the remotes to your &lt;em&gt;local machine&lt;/em&gt;. If you’ve already defined a remote named &lt;var&gt;origin&lt;/var&gt; (for example, if you followed GitHub’s instructions), you’ll want to delete the remote first:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;git remote rm origin&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;Now we can add our new remote:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;git remote add origin git@server.com/myrepo.git&lt;/kbd&gt;
&lt;kbd&gt;git push origin master&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;And that’s it. You'll probably also want to make sure you add a default merge and remote:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;git config branch.master.remote origin &amp;amp;&amp;amp; git config branch.master.merge refs/heads/master&lt;/kbd&gt;&lt;/pre&gt;

&lt;p&gt;And that’s all. Now you can push/pull from &lt;var&gt;origin&lt;/var&gt; as much as you like, and it’ll be stored remotely on your own &lt;var&gt;myserver.com&lt;/var&gt; remote repository.&lt;/p&gt;

&lt;h2&gt;Bonus points: Make SSH more secure&lt;/h2&gt;

&lt;p&gt;This has been extensively covered by the &lt;a href="http://articles.slicehost.com/2009/3/31/debian-lenny-setup-page-1"&gt;excellent Slicehost tutorial&lt;/a&gt;, but just to recap:&lt;/p&gt;

&lt;p&gt;Edit the SSH config:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;sudo vi /etc/ssh/sshd_config&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;And change the following values:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Port 2207
...
PermitRootLogin no
...
AllowUsers myuser git
...
PasswordAuthentication no&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Where &lt;var&gt;2207&lt;/var&gt; is a port of your choosing. Make sure to add this so your Git remote:&lt;/p&gt;
&lt;pre id="git-co-change"&gt;&lt;kbd&gt;git remote add origin ssh://git@myserver.com:2207/~/myrepo.git&lt;/kbd&gt;&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/intranation-latest/~4/qFbjsNlm098" height="1" width="1"/&gt;</summary><category term="development" /><category term="sysadmin" /><category term="linux" /><category term="git" /></entry><entry><title>Python virtualenv quickstart with Django</title><link href="http://intranation.com/entries/2009/12/python-virtualenv-quickstart-django/" rel="alternate" /><updated>2009-12-20T21:59:00+00:00</updated><author><name>Bradley Wright</name><uri>http://intranation.com/about/#bradley-wright</uri></author><id>http://intranation.com/entries/2009/12/python-virtualenv-quickstart-django/</id><summary type="html">&lt;p&gt;One of the solutions to the &lt;a href="http://jessenoller.com/2009/07/17/trapped-in-python-package-send-food/"&gt;ghetto of Python package management&lt;/a&gt; is to use a sand-boxed Python install like &lt;a href="http://pypi.python.org/pypi/virtualenv"&gt;virtualenv&lt;/a&gt;. This is the very same technique we use at &lt;a href="http://smarkets.com/"&gt;Smarkets&lt;/a&gt; to simultaneously run &lt;a href="http://pylonshq.com/"&gt;Pylons&lt;/a&gt; and &lt;a href="http://djangoproject.com/"&gt;Django&lt;/a&gt; alongside each other on a single server.&lt;/p&gt;
&lt;p&gt;This post is briefly about how to get up and running in a few minutes using virtualenv and Django.&lt;/p&gt;
&lt;h2&gt;Install virtualenv&lt;/h2&gt;
&lt;p&gt;Installing virtualenv is easy on a Linux or Mac system, but the instructions that follow are Linux (Ubuntu, actually) specific. First you'll need setuptools:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;sudo apt-get install python-setuptools&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;Then we can &lt;kbd&gt;easy_install&lt;/kbd&gt; virtualenv:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;sudo easy_install virtualenv&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;We need to use &lt;kbd&gt;sudo&lt;/kbd&gt; here because it has to install to a global location. Don’t worry, this is the last time we’ll need to do something as &lt;var&gt;root&lt;/var&gt;.&lt;/p&gt;
&lt;h2&gt;Create your virtualenv&lt;/h2&gt;
&lt;p&gt;&lt;kbd&gt;cd&lt;/kbd&gt; to wherever it is you keep your projects (for me, in &lt;var&gt;~/src&lt;/var&gt;), and run:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;virtualenv --no-site-packages venv&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;In this instance I’ve chosen &lt;var&gt;venv&lt;/var&gt; as the name for my virtual environment. The &lt;var&gt;--no-site-packages&lt;/var&gt; command tells virtualenv not to symlink the global site packages into my local environment, just take the Python standard library. This is important, because it helps us avoid the dependency difficulties mentioned above.&lt;/p&gt;
&lt;p&gt;At this stage you might want to add &lt;var&gt;venv&lt;/var&gt; to your list of ignored files, as you don’t want it to be committed to source control:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;echo "venv" &amp;gt;&amp;gt; .gitignore&lt;/kbd&gt;&lt;/pre&gt;
&lt;h2&gt;Installing Django&lt;/h2&gt;
&lt;p&gt;Now, the trick with virtualenv is that it creates its own Python and easy_install binaries, which means you can install/run things specifically in your environment. Let’s install Django:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;./venv/bin/easy_install django&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;And it’s done. easy. You might also want to install the MySQL bindings and &lt;a href="http://ipython.scipy.org/moin/"&gt;IPython&lt;/a&gt; for ease of use:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;./venv/bin/easy_install ipython python-mysql&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;To start a new Django project, you’ll note that a &lt;var&gt;django-admin.py&lt;/var&gt; file will have been installed for you in the environment:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;./venv/bin/django-admin.py startproject myapp&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;Obviously you can skip this step if you have an existing Django project.&lt;/p&gt;
&lt;h2&gt;Running Django&lt;/h2&gt;
&lt;p&gt;Now the last step, which is probably obvious by now, is to run Django’s runserver with the virtual Python binary:&lt;/p&gt;
&lt;pre&gt;&lt;kbd&gt;cd myapp&lt;/kbd&gt;
&lt;kbd&gt;../venv/bin/python manage.py runserver 0.0.0.0:8000&lt;/kbd&gt;&lt;/pre&gt;
&lt;p&gt;And you’re away!&lt;/p&gt;
&lt;h2&gt;Closing&lt;/h2&gt;
&lt;p&gt;Just make sure whenever you need to add another package that you install it in the virtualenv, and not in the global packages directory. If you want to deploy using virtualenv, here are &lt;a href="http://code.google.com/p/modwsgi/wiki/VirtualEnvironments"&gt;some instructions for using mod_wsgi&lt;/a&gt; with virtualenvs.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/intranation-latest/~4/DG-vyk5XO14" height="1" width="1"/&gt;</summary><category term="development" /><category term="django" /><category term="python" /><category term="linux" /></entry><entry><title>A week using Emacs</title><link href="http://intranation.com/entries/2009/06/week-using-emacs/" rel="alternate" /><updated>2009-06-29T13:04:56+00:00</updated><author><name>Bradley Wright</name><uri>http://intranation.com/about/#bradley-wright</uri></author><id>http://intranation.com/entries/2009/06/week-using-emacs/</id><summary type="html">&lt;p&gt;
    From a consensus vote of two (&lt;a href="http://binaryclub.com/" rel="friend met co-worker"&gt;Hunter&lt;/a&gt; and &lt;a href="http://jasontrost.com" rel="co-worker friend met"&gt;Jason&lt;/a&gt;) out of three, &lt;a href="http://www.gnu.org/software/emacs/"&gt;Emacs&lt;/a&gt; is the preferred editor of &lt;a href="http://smarkets.com"&gt;Smarkets&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
    Historically, my editor experience runs roughly thus:
&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Notepad (early days of learning HTML from liberally using “View source”);&lt;/li&gt;
    &lt;li&gt;Dreamweaver (college);&lt;/li&gt;
    &lt;li&gt;Homesite (post-college until 2007); and&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; (2007 onwards, when thankfully I’ve had a Mac).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
    with a little &lt;a href="http://www.vim.org/"&gt;Vi(M)&lt;/a&gt; interspersed here and there as my server—side editor.
&lt;/p&gt;
&lt;p&gt;
    In an effort to fit in a bit better with the team (and because they continually bang on about it like it’s the greatest thing since the Internet), I’ve committed to trying Emacs for a week of full time development. I’ll write up a review of my thoughts at week end.
&lt;/p&gt;
&lt;h2&gt;Misgivings&lt;/h2&gt;
&lt;p&gt;
    In the interests of disclosure, I have some misgivings about Emacs:
&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;The lack of respect it will have for OS X–wide keyboard shortcuts. Having to re-learn keyboard commands just to cut and paste (for example), will drive me up the wall;&lt;/li&gt;
    &lt;li&gt;Using Elisp to configure it;&lt;/li&gt;
    &lt;li&gt;The auto—indent mode of Emacs doesn’t work very well with my HTML coding style. Emacs thinks it knows when/where you’d like to indent code, and pressing “tab” will guess for you. I prefer HTML to just indent 4 spaces when I tab.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
    See you back here in a week for the review (and hopefully solutions to common web developer problems that Emacs causes).
&lt;/p&gt;
&lt;img src="http://feeds.feedburner.com/~r/intranation-latest/~4/8ie8NA1Vmcw" height="1" width="1"/&gt;</summary><category term="personal" /><category term="development" /><category term="osx" /><category term="linux" /><category term="emacs" /></entry><entry><title>Development virtual machines on OS X using VMWare and Ubuntu</title><link href="http://intranation.com/entries/2009/03/development-virtual-machines-os-x-using-vmware-and/" rel="alternate" /><updated>2009-03-22T00:04:00+00:00</updated><author><name>Bradley Wright</name><uri>http://intranation.com/about/#bradley-wright</uri></author><id>http://intranation.com/entries/2009/03/development-virtual-machines-os-x-using-vmware-and/</id><summary type="html">&lt;p&gt;&lt;strong&gt;Update 21st Febuary, 2010:&lt;/strong&gt; If you get this error when installing VMWare Tools: &lt;code&gt;mount: unknown filesystem type 'iso9660'&lt;/code&gt;, it’s because you’re using Ubuntu 9.10 in JeOS mode. The solution is to &lt;a href="http://ubuntuforums.org/showthread.php?t=1314412"&gt;upgrade your kernel to the generic, rather than virtual, kernel&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 26th November, 2009:&lt;/strong&gt; &lt;a href="http://mikewest.org"&gt;Mike West&lt;/a&gt; has pointed out that the Linux headers required differ from version to version, so I’ve updated the instructions to reflect the header install required. Also, the JeOS version of Ubuntu 8.04 &lt;abbr title="Long term support"&gt;LTS&lt;/abbr&gt; is &lt;a href="http://cdimage.ubuntu.com/jeos/releases/8.04/release/"&gt;available at a different &lt;abbr title="Uniform resource locator"&gt;URL&lt;/abbr&gt; than the normal distribution&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 29th June, 2009:&lt;/strong&gt; &lt;a href="http://blogs.vmware.com/teamfusion/2009/06/vmware-fusion-205-update-now-available.html"&gt;VMWare Fusion 2.0.5 has been released&lt;/a&gt;, which contains an updated VMWare Tools package for Ubuntu 9.04. This removes the requirement to edit the source files as &lt;a href="http://swearingscience.com/2009/04/04/ubuntu-904-beta-in-vmware-fusion/"&gt;outlined here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 21st June, 2009:&lt;/strong&gt; it’s been pointed out that Ubuntu 8.10, which this article was originally written for, has been replaced by the &lt;a href="https://wiki.ubuntu.com/HardyHeron"&gt;8.04 &lt;abbr title="Long term support"&gt;LTS&lt;/abbr&gt; release&lt;/a&gt;. If you want a stable version of Ubuntu, rather than the bleeding edge, you’re best off using this release.&lt;/p&gt;

&lt;p&gt;I’ve been using Linux as my primary development environment for a number of months now, despite being an abject Mac fanboy. Why?&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;I often want to try new software (&lt;a href="http://www.python.org/download/releases/2.6.1/"&gt;Python 2.6&lt;/a&gt;, &lt;a href="http://nginx.net/"&gt;Nginx&lt;/a&gt;, &lt;a href="http://www.modwsgi.org/"&gt;mod_wsgi&lt;/a&gt;, or &lt;a href="http://couchdb.apache.org/"&gt;CouchDB&lt;/a&gt;, for example), and neither &lt;a href="http://www.macports.org/"&gt;MacPorts&lt;/a&gt; nor &lt;a href="http://www.finkproject.org/"&gt;Fink&lt;/a&gt; are really appropriate to my needs, as it’s too easy to break your system using it (and to give you an idea of how invasive MacPorts is, just take a look at the &lt;a href="http://guide.macports.org/#installing.macports.uninstalling"&gt;uninstallation instructions&lt;/a&gt;!);&lt;/li&gt;
    &lt;li&gt;&lt;abbr title="Macintosh Operating System 10"&gt;OS X&lt;/abbr&gt;, being both a consumer desktop OS and a &lt;a href="http://en.wikipedia.org/wiki/OSX#History"&gt;BSD–derived UNIX&lt;/a&gt;, is nothing like any of the commodity hosting available (usually Debian–derived systems like &lt;a href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt; for me), so releasing stuff requires more testing (both locally and then in a “production–like” environment) before I can be sure it’ll work; but mostly&lt;/li&gt;
    &lt;li&gt;The penalty for screwing up is too high. I live in fear of trashing the default Apache or Python on my Mac and not being able to recover from it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I will continue to use my Mac as my main machine, because I love &lt;a href="http://www.omnigroup.com/applications/omnifocus/"&gt;OmniFocus&lt;/a&gt;, and &lt;a href="http://www.apple.com/safari/"&gt;Safari&lt;/a&gt;, and &lt;a href="http://vmware.com/products/fusion/"&gt;VMWare Fusion&lt;/a&gt;, and all the other applications on my Mac. I love the toolset available to me, and value the user experience.&lt;/p&gt;
&lt;p&gt;So what’s the solution? Virtualisation, of course. Thanks to VMWare’s shared folders feature, we can mirror our local folders into the VM, making it super–easy to run our code in Linux (and it also means we don’t have to use Samba).&lt;/p&gt;
&lt;p&gt;Following are some (hopefully) bulletproof instructions for setting up &lt;a href="http://www.ubuntu.com/products/whatisubuntu/serveredition/jeos" title="Juice"&gt;JeOS&lt;/a&gt; (a virtual–machine friendly version of Ubuntu Server, as pointed out to me by &lt;a href="http://dannyamey.com/" rel="friend met colleague"&gt;Danny Amey&lt;/a&gt;) in VMWare in such a way as to make it an ideal development environment.&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Firstly, get the latest Ubuntu Server from the &lt;a href="http://www.ubuntu.com/getubuntu/download"&gt;download page&lt;/a&gt; (via BitTorrent or any other convenient method). Note that JeOS is listed as a feature of the distribution: &lt;q&gt;Ubuntu Server Edition JeOS (pronounced "Juice") is an efficient variant of our server operating system, configured specifically for virtual appliances&lt;/q&gt;;&lt;/li&gt;
    &lt;li&gt;Then start VMWare Fusion up, and create a new Virtual Machine. I recommend 256MB RAM and HDD of about 10GiB. Name it whatever you like (let's say “JeOS” for this example);&lt;/li&gt;
    &lt;li&gt;When asked for a CD–ROM, point VMWare at the location of the ISO you just downloaded;&lt;/li&gt;
    &lt;li&gt;You’ll want to turn printers off, as JeOS doesn't seem to deal very well with printers—probably because it’s quite minimal and doesn't ship with printer capability;&lt;/li&gt;
    &lt;li&gt;Follow the other steps as normal.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You now have a fresh virtual machine. Polish the settings (change HDD size, for example), and start it up.&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Initially you’ll see a language screen. Choose the appropriate language (“English” for me, obviously);&lt;/li&gt;
    &lt;li&gt;After choosing the language, you’re presented with an install menu. At this point, we need to differ from the usual Ubuntu install process and change our install mode. Hit “F4” (or “fn + F4”) to open the modes menu, and select “Install a minimal virtual machine”;&lt;/li&gt;
    &lt;li&gt;Follow the rest of the install process as usual (name your user, name your server etc.).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It’s worth nothing that at this point I don’t normally install any of the pre–configured server options—I just leave it as bare bones as possible.&lt;/p&gt;

&lt;p&gt;Now the machine will start up, so we can install VMWare tools. This gives us the benefit of Shared Folders, which let us treat the machine as a local folder, so we can use &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; or other local tools to edit files within the system. This is the real key to making the development VM usable.&lt;/p&gt;

&lt;p&gt;After the machine starts up in a VMWare window, log in and type &lt;kbd&gt;ifconfig&lt;/kbd&gt;. Take note of the IP address in the &lt;samp&gt;eth0&lt;/samp&gt; section alongside &lt;samp&gt;inet addr:&lt;/samp&gt;. This is the IP address of your virtual machine (if you’re using &lt;acronym title="Network Address Translation"&gt;NAT&lt;/acronym&gt;—if you’re using bridged it’ll be a non-local IP).&lt;/p&gt;

&lt;p&gt;Since the terminal provided by basic Linux is a bit sparse on features, install SSH with &lt;kbd&gt;sudo apt-get install ssh&lt;/kbd&gt;. When this completes, log out and open Terminal.app.&lt;/p&gt;

&lt;p&gt;SSH into the system with &lt;var&gt;ssh [username]@[ip address]&lt;/var&gt;. You’ll need to accept the dialogue about the MAC address fingerprint.&lt;/p&gt;

&lt;p&gt;Now we need to update the system a bit. Run:&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt;&lt;kbd&gt;sudo apt-get update&lt;/kbd&gt; (this updates the package sources);&lt;/li&gt;
    &lt;li&gt;&lt;kbd&gt;sudo apt-get upgrade&lt;/kbd&gt; (this updates the installed packages); and&lt;/li&gt;
    &lt;li&gt;&lt;kbd&gt;sudo apt-get dist-upgrade&lt;/kbd&gt; (only if there’s a newer version of Ubuntu floating around—probably not at time of writing)—if you do this, see &lt;a href="#addendum"&gt;below&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p id="addendum"&gt;&lt;strong&gt;Note:&lt;/strong&gt; if you ran &lt;kbd&gt;dist-upgrade&lt;/kbd&gt; above, you should restart your virtual machine now with: &lt;kbd&gt;sudo shutdown -r now&lt;/kbd&gt;. Otherwise you may get clashes with kernel versions in the next step (thanks &lt;a href="http://www.isolani.co.uk/" rel="friend met colleague"&gt;Mike Davies&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Now we can get on with installing VMWare tools.&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt;&lt;kbd&gt;sudo apt-get install linux-headers-$(uname -r) build-essential&lt;/kbd&gt; (installs some software required to build the components of VMWare tools);&lt;/li&gt;
    &lt;li&gt;In Fusion, install VMWare tools with the “Virtual Machine &amp;gt; Install VMWare Tools” menu dialogue. This causes a fake CD–ROM to be inserted into the machine;&lt;/li&gt;
    &lt;li&gt;Back in SSH, mount the CD with &lt;kbd&gt;sudo mount /cdrom&lt;/kbd&gt;;&lt;/li&gt;
    &lt;li&gt;Create a new directory to compile source code: &lt;kbd&gt;mkdir -p ~/src&lt;/kbd&gt;;&lt;/li&gt;
    &lt;li&gt;Enter the CD: &lt;kbd&gt;cd /cdrom/&lt;/kbd&gt;&lt;/li&gt;
    &lt;li&gt;Copy the source code of VMWare across: &lt;kbd&gt;cp VMwareTools-[HIT TAB TO COMPLETE] ~/src&lt;/kbd&gt;;&lt;/li&gt;
    &lt;li&gt;&lt;kbd&gt;cd ~/src&lt;/kbd&gt;;&lt;/li&gt;
    &lt;li&gt;&lt;kbd&gt;tar zxfv VMwareTools-[HIT TAB TO COMPLETE]&lt;/kbd&gt;;&lt;/li&gt;
    &lt;li&gt;&lt;kbd&gt;cd vmware-tools-distrib&lt;/kbd&gt;;&lt;/li&gt;
    &lt;li&gt;Now we can install VMWare Tools: &lt;kbd&gt;sudo ./vmware-install.pl [--default]&lt;/kbd&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;At this point you can basically accept all the default dialogue options until it completes. &lt;strong&gt;Edit:&lt;/strong&gt; as &lt;a href="http://mikewest.org/" rel="friend met colleague"&gt;Mike West&lt;/a&gt; has rightly pointed out, passing the &lt;code&gt;--default&lt;/code&gt; flag to the install command automatically accepts all defaults for you.&lt;/p&gt;
&lt;p&gt;Now you’ve installed VMWare Tools, so it’s time to mount the remote folder:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;In the VMWare Library, edit the Settings of your currently running virtual machine;&lt;/li&gt;
    &lt;li&gt;Select the “Sharing” settings option;&lt;/li&gt;
    &lt;li&gt;Add a new folder (in mine my code is stored in &lt;samp&gt;~/Projects&lt;/samp&gt;) and share it with Read/Write permissions;&lt;/li&gt;
    &lt;li&gt;Close the menu dialogue to save your choice.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This folder is now available to the VM at &lt;samp&gt;/mnt/hgfs/[NAME OF FOLDER]&lt;/samp&gt;, except there’s one issue: because of the way the mount works, the VM can’t write back to the shared folder (which is a problem if you’re compiling anything, for example). Here’s how you enable read–write for real:&lt;/p&gt;

&lt;ol&gt;
    &lt;li&gt;Work out your user and main group ID by typing: &lt;kbd&gt;id&lt;/kbd&gt; (this will usually be &lt;var&gt;1000&lt;/var&gt; and &lt;var&gt;1000&lt;/var&gt;);&lt;/li&gt;
    &lt;li&gt;Edit your sharing settings with: &lt;kbd&gt;sudo vi /etc/fstab&lt;/kbd&gt;;&lt;/li&gt;
    &lt;li&gt;Edit the line starting with: &lt;samp&gt;.host:/    /mnt/hgf&lt;/samp&gt; to look like: &lt;samp&gt;.host:/    /mnt/hgfs    vmhgfs    defaults,ttl=5,uid=1000,gid=1000  0&lt;/samp&gt;, where &lt;samp&gt;uid=1000&lt;/samp&gt; and &lt;samp&gt;gid=1000&lt;/samp&gt; are the actual user and group IDs we discovered back in the first step.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now your VM can write back to the shared folder, and all is well.&lt;/p&gt;

&lt;h2&gt;Bonus topics&lt;/h2&gt;

&lt;h3&gt;Link your shared folder into your home directory&lt;/h3&gt;

&lt;p&gt;If you want the shared folder reflected in your user home directory, just use a symlink:&lt;/p&gt;

&lt;pre&gt;&lt;kbd&gt;ln -s /mnt/hgfs/Projects ~/projects&lt;/kbd&gt;&lt;/pre&gt;

&lt;h3&gt;Run the VM in headless mode&lt;/h3&gt;

&lt;p&gt;So you don’t need to start VMWare each time, you can run the virtual machines as a separate process outside of VMWare Fusion. This is called “&lt;a href="http://communities.vmware.com/docs/DOC-1201"&gt;headless mode&lt;/a&gt;”. From a local terminal on your Mac, type:&lt;/p&gt;

&lt;pre&gt;&lt;kbd&gt;defaults write com.vmware.fusion fluxCapacitor -bool YES&lt;/kbd&gt;&lt;/pre&gt;

&lt;p&gt;and restart VMWare. When you start your machine, choose “View &amp;gt; Enter Headless”. The screen will disappear for that machine, and it’ll keep running. Now you can close VMWare with a running VM and not have the machine stop. &lt;a href="http://github.com/bradleywright/homedir/blob/70072383df8149edc6a754e8d11ea7fd8d0ce8f9/bin/vm"&gt;Use this script I wrote to start machines via the command line&lt;/a&gt; (so you can even bypass VMWare Fusion altogether).&lt;/p&gt;

&lt;h2&gt;Final notes&lt;/h2&gt;

&lt;p&gt;At this point it’s wise to use the snapshot feature of VMWare Fusion to save the state of your machine, in case you completely trash it and want to restore from scratch. This is one of the biggest wins of virtualisation in my opinion—making it easy and non–dangerous to experiment.&lt;/p&gt;

&lt;p&gt;Also, thanks to Danny for helping me out a bit and &lt;a href="http://nefariousdesigns.co.uk" rel="friend met colleague"&gt;Tim Huegdon&lt;/a&gt; for being my guinea pig.&lt;/p&gt;

&lt;h2&gt;Update: A note on Symfony&lt;/h2&gt;

&lt;p&gt;A &lt;a href="http://johngrimsey.co.uk/" rel="colleague"&gt;few&lt;/a&gt; &lt;a href="http://rajatpandit.com/" rel="friend met colleague"&gt;people&lt;/a&gt; have written and asked me about how to get &lt;a href="http://www.symfony-project.org/"&gt;Symfony&lt;/a&gt; running under this set up. Symfony has slightly peculiar requirements in that it needs to have a PHP/Apache writable directory in which it can dump the compiled YML files it uses for configuration. The solution to this is to patch &lt;samp&gt;/etc/apache2/apache2.conf&lt;/samp&gt; as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;User [your username here]
Group [your groupname here (usually the same as the username)]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and then reboot Apache.&lt;/p&gt;

&lt;p&gt;This configuration means that Symfony runs with the same permissions as your primary user, which gives it full control over your project directories, and also inherits the permissions granted by HGFS. Needless to say: &lt;strong&gt;never do this on a public web server&lt;/strong&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/intranation-latest/~4/NbVCZxqI4_Q" height="1" width="1"/&gt;</summary><category term="development" /><category term="sysadmin" /><category term="osx" /><category term="linux" /><category term="ubuntu" /><category term="vmware" /></entry></feed>
