I do a lot of work with Ubuntu, 90% or so of that work is from an Ubuntu instance. Often that instance happens to be a local VM running in VMware Fusion (or sometimes Virtual Box). Often I’ll start with a base server image which isn’t entirely setup for SSHing into the instance. These are the steps to get that installed and ready to go.
First install the image, in this particular situation I’m using the Ubuntu 12.04 LTS Server image. Here’s a quick walk through video or…
…just keep following the steps here.
That will take a few minutes to install, on machines these days I’ve experience just about 8-15 minutes. There are a million other options to do this too, such as starting with a clean Ubuntu image using Vagrant, which takes all of about 1-2 minutes, sometimes a bit more if you have to download the image. But either way, get one built and running.
Once the image is installed, login and install openssh-server and openssh-client. Here’s a short video installing the SSH Server and Client.
sudo apt-get install openssh-server openssh-client
Once that’s installed I pull up my IP address with ifconfig.
The ifconfig command shows a lot of information regarding the network configuration associated with the various network adapters in the machine that it is executed on. In the image I’ve circled the local IP address that is assigned to the instance.
Now that you have the local IP of the instance, bring up a local terminal (in this case I’m on OS-X, but if you’re on Windows pull up Putty or on Linux or another *nix variant pull up a shell). In the terminal you can now enter the follow SSH command to log in from the local machine versus the running instance. This comes in handy when you want to treat the machine like an actual hosted machine somewhere, in which you wouldn’t be directly logged into the server.
Getting VMware Tool Installed
This assumes that you mount the installation files (aka the cdrom) via the built into mount option in the VMware Fusion menu.
Once that’s mounted, the machine is ready to install the tools on. However, there are a few other things to install just before installing these. First get the latest updates for apt-get with the update command.
sudo apt-get update
Now install the latest gcc, make, kernel headers and other important tools.
sudo apt-get install gcc make build-essential
sudo apt-get install linux-headers-$(uname -r)
In the above, everything can be put on one line, but I separated the linux-headers just for extra clarity. I can now via remote SSH on the local machine or directly into the virtual machine and run the following commands to install the VMware Tools.
sudo mkdir /mnttools
sudo mount /dev/cdrom /mnttools
tar xzvf /mnttools/VMwareTools-x.x.x-xxxx.tar.gz -C /tmp/
sudo ./vmware-install.pl -d
Finish everything up with a good reboot.
sudo shutdown -r now
Now I have the VMware Tools installed and able to SSH remotely, giving me the ability to use the virtual machine as I would an actual hosted instance.