dev-guides

Setting up an Ubuntu Linux VM in VMware

You will be doing development and testing on a Linux system. To make this easy to do in an isolated environment running on your own personal computer, you will create a virtual machine (VM) in which you will install Linux. This guide provides instructions for installing Ubuntu Linux in a VMware VM.

Download and Install VMware

Download and install the latest version of VMware’s desktop hypervisor. Once you’re in the Broadcom portal, go to the My Downloads tab. Then, you may need to click on the button in the top right corner beside your name, and select VMware Cloud Foundation.

Use:

Select the version labeled with for Personal Use.

Download Ubuntu Linux

There are many GNU+Linux distributions, but we will use Ubuntu. Ubuntu is a distribution derived from Debian. This class used to use Debian, but Ubuntu provides more recent kernel versions.

We will be using Ubuntu 24.04.1. All files mentioned below can be found here.

Always verify the checksums of your downloads. You can follow the instructions here. Try to understand what each of these steps does. You will need to use the checksum files SHA256SUMS and SHA256SUMS.gpg.

Create a VM

Create a new virtual machine in VMware using the Ubuntu ISO image you just downloaded. For example, on VMware Fusion, this can be done by selecting New from the File menu. Select the Install from disc or image option and choose the relevant ISO file.

For the OS for the VM, choose Ubuntu 64-bit ... if available. Depending on your platform, it may not be an option yet. In that case, choose Other Linux 6.x kernel 64-bit .... On some systems, you may need to click on Go Back after uploading your ISO file to set the OS.

If prompted to select boot firmware, choose Legacy BIOS.

If you are using an M1/2/3/4 machine, the above two options may be selected for you by default upon selecting the Ubuntu ISO image.

This is important! The default settings for memory and storage are probably too small. Customize your VM as detailed below. Note that on some platforms, you may need to press Finish and actually create the VM before you can edit these settings. Once the VM is created, click on Virtual Machine and then Settings.

Note:
You can change the number of CPU cores and the amount of RAM in VMware’s settings anytime the VM is powered off. Adding more resources can greatly reduce the time it takes to compile the kernel later on.

Installing Ubuntu

After configuring the VM, start the VM. The VM will now boot from its CD-ROM drive containing the Ubuntu GNU/Linux install disk, which is virtually mapped to the ISO file that you downloaded.

Select Try or Install Ubuntu. You will then be guided through a somewhat lengthy installation process. Most of the default settings are acceptable - below is an outline for some of the choices you should be making:

Then, select Restart now. This might take a while. It’s okay if you see a message on removing installation media. You can simply click Ok.

After your system restarts, you may also be prompted to configure the following additional settings:

Setting Up Ubuntu

Once you reboot, you’ll be greeted with a login screen. Use the user account you created earlier (e.g. we would use alex here as our username).

Welcome to your VM’s desktop environment, click on the “Show Apps” icon at the left bottom of your screen. Then, open the terminal.

You’ll be logged into your user account, which does not have superuser/root privileges yet. Switch into the root account using the following command:

$ sudo su -

Type in the password you set for the root account. Now you should be logged in as root:

#

You’ll notice through this guide (and others) that certain shell commands begin with $, while others begin with #. These shell prompts represent the permissions you should run the command with; you should not be typing the prompts in. The convention is that commands with $ should be run as a regular user (e.g. alex), whereas commands beginning with # should be run as a superuser (e.g. root, or using sudo).

Installing your first package

Update your package lists:

# apt update

This retrieves the most up-to-date list of packages from APT’s repositories, which tell apt all the things it can install. First, let’s upgrade all packages that can be upgraded:

# apt upgrade

Now we can install sudo, as well as some other useful packages for getting through the rest of setup:

# apt install sudo git build-essential net-tools linux-headers-$(uname -r)

Feel free to also install any programs you are accustomed to using, such as vim, emacs, tmux, htop, etc. Just add these to the list of programs for apt for install in the above command, after net-tools.

Using your Ubuntu VM

Two tips you may find useful for using your VM include using SSH to connect to your VM and using Vim and cscope for development.

Shutting down your Ubuntu VM

Shutting down a VM using VMware e.g. using Virtual Machine -> Shut Down may not always work properly. See this link for more details. To ensure a graceful shutdown is performed, you should always shut down your VM from within the guest operating system itself. In Linux, you can do this by running sudo shutdown.

Snapshots

Once you’ve set up your VM to your satisfaction, you should take a preliminary snapshot. Snapshots capture the current running state of the VM, store it, and then allows you to revert to that state at a later point. In general, you should snapshot your VM before executing something that can compromise the system. Taking a snapshot now will allow you to revert to a clean state in case your VM breaks somehow.

If you’re running low on disk space, you should take a snapshot while your VM is shut down. Otherwise, VMWare will snapshot the VM’s current memory. While this may be useful sometimes, it adds several extra gigabytes to your snapshot size.


Acknowledgements

The initial guide was designed by the following TA of COMS W4118 Operating Systems I, Fall 2024, Columbia University:

The guide was updated by the following TAs of COMS W4118 Operating Systems I, Spring 2025, Columbia University:


Last updated: 2025-01-23