on
AngularJS on Ubuntu VM
I wanted to get started with this AngularJS tutorial, and I wanted to set up my environment to do so on an Ubuntu virtual machine.
As I ran through the process of setting up the VM and installing some prerequisite stuff, I ran into a couple small issues. This post will explain what it takes to get up and running quickly.
My host machine is a MacBook Pro running OS X 10.9.2. And I was installing Ubuntu 14.04 as the guest operating system (these instructions might be close to correct for Ubuntu 13.10 as well).
Here’s what I did:
- Downloaded and installed the latest version of VirtualBox
- Downloaded the ISO image of the latest (14.04) 64-bit Ubuntu desktop OS
- Opened VirtualBox and created a new virtual machine, pointing it to the Ubuntu image I just downloaded
At this point I noticed that Ubuntu seemed to be laggy even though I’d given it 8GB of ram. This was remedied by enabling 3D acceleration and bumping up the memory allocated for the display. Note: the virtual machine has to be stopped before these settings can be edited.
[caption id=”attachment_114” align=”alignnone” width=”1142”] Check the ‘Enable 3D Acceleration’ checkbox[/caption]
I also installed the guest additions from the VirtualBox Device menu. After restarting the Guest OS I was able to run Ubuntu in full screen.
Now I was ready to install Git, Nodejs, and npm.
- To install git from the Terminal command line on Ubuntu: $ sudo apt-get install git
- Clone the AngularJS git repository via the instructions in the tutorial
- cd to the project directory
- These instructions were helpful in getting Node.js installed.
- To install Node.js: $ sudo apt-get install nodejs
- As of writing, there is a naming conflict such that
$ node
does not refer to Node.js. The binary for Node.js is at/usr/bin/nodejs
; a work-around is that you can create a symlink so the install scripts don't fail:$ sudo ln -s /usr/bin/nodejs /usr/bin/node
- Install npm:
$ sudo apt-get install npm
- Now run
$ npm start
and you should see the tutorial's phonecat app if you open a browser in the guest OS and browse tohttp://localhost:8000/app/index.html