Ubuntu 24.04 VM

Creating a Virtual Machine running Ubuntu 24.04

Why use a Virtual Machine?

There are a couple of reasons why it can be a good idea to make use of a Linux Virtual Machine. One reason is that this is a good way to start learning more about the Linux operating system. Learning basic Linux commands and how to manage a Linux machine is a good practical skill to have. Another reason is that Linux provides a good environment to upgrade your programming skills, especially with respect to creating simple web applications.

Getting VMware Workstation Pro

Go to this VMware workstation and fusion to start. If you have an account, you can start by going to the Login dropdown on the upper right. If you don’t have an account you need to create one. Hovering over the Login will show a small window that has Register as an option.

broadcom

If that does not work, you can go to Broadcom Support and click on the Register button.

broadcom support

If you are registered, click on the DOWNLOAD FUSION OR WORKSTATION button. After logging in you should arrive at the page shown below:

broadcom downloads

Click on the link labeled Free Software Downloads available HERE (Click on HERE). That should take you to the free downloads page shown next. Scroll down until you can see VMware Workstation Pro.

free downloads

If you click on VMware Workstation Pro, you should arrive at this page:

vmware workstation pro

Select the version for your host operating system. If you are on a Macintosh computer, on the previous page, select VMware Fusion instead of VMware Workstation Pro.

In the next screen shot, you can see that I am going to download VMware Workstation Pro for Linux 17.6.3. That was the latest version available on 06/01/2025.

linux download

This will download a .bundle file. In my case, it was this file, VMware-Workstation-Full-17.6.3-24583834.x86_64.bundle.

Change into the directory you downloaded this bundle file into and run the following commands:

$ chmod +x VMware-Workstation-Full-17.6.3-24583834.x86_64.bundle
$ sudo ./VMware-Workstation-Full-17.6.3-24583834.x86_64.bundle

You should get a message of "Installation was successful."

Start up the VMware workstation player

Start up VMware Player and accept the license agreement. Click next and accept the end user license agreement. Click next. Select No to checking for updates on startup and click Next. You don’t have to join the customer experience program. Click on Finish. This should start up the vmplayer main page:

vmplayer main page

Download Ubuntu 24.04 iso

Before you can create a new virtual machine, you need to download the iso file. I use the Ubuntu LTS versions for the iso. Since Ubuntu is Debian-based, packages are widely available for most standard Linux operations. I chose the Ubuntu flavor, because Ubuntu is popular enough to have a lot of community support. At the time this page was created (06/01/2025), the version I chose was Ubuntu 24.04.2 LTS. Click on this lilnk, Download Ubuntu Desktop, to download the iso file for this:

Creating a new virtual machine in VMware player

After you have downloaded the iso file above, go to the VMware player start page and click on the first item "Create a New Virtual Machine".

When the virtual machine wizard starts up, select the Use ISO image option, and Browse for the iso file you just downloaded.

select iso file

Click on Next. Personalize Linux by entering your username and password. This will be a sudoer account that you will use to manage your virtual machine. Click on Next.

Change the Name of the virtual machine to a name of your choice. If the default location does not suit you, you can change this location. Click on Next.

For the Maximum disk size, I would choose 30 GB or larger if you have the space. If you think that you might transfer the virtual machine files to another machine, you can choose the option Split virtual disk into multiple files. Click Next.

The default amount of Memory (RAM) will be 4096 MB (4 GB). If you want to change this, click on the Customize Hardware button and change the memory there.

memory customize

Click on Finish, to start the installation. If you get an error message saying the the kernel module 'vmmon' could not be found, this could be because you have secure boot enabled. At least, this is what happened on my host machine. With secure boot disabled, this error went away.

Click on the Install Ubuntu icon. Choose your language (English), click Next to accept the defaults as they usually will be correct. Use the correct kind of connection to the internet. If the prompt says you can get an updated installer, you can click on Update now. You will have to close the installer and relaunch it. Click on the Install Ubuntu icon to relaunch.

You can just choose the Interactive installation and go with the Default selection of apps. Don’t install any proprietary software. Select Erase disk and install Ubuntu and click Next. Create your account for the virtual machine and make sure that you are requiring your password to login. Select your timezone and click Next. Finally, click Install.

The installation process will take a number of minutes, depending on how fast your host computer is. When it is done, click on the Restart now button.

When your virtual machine starts up, you can start by right-clicking on your Desktop and selecting Open in Terminal. From the terminal, run the following commands:

$ sudo apt update
$ sudo apt upgrade

The first command updates to use the latest package repositories. The second command will update any software apps you have that have upgrades available.

It is quite likely that if you try to resize the window for your virtual machine, that it will not fill your monitor properly. If this happens, run the following command.

$ sudo apt install open-vm-tools

Restart your virtual machine by going to the power icon in the upper right of the desktop bar. This will bring up a small window that allows you to select another power button.

restart virtual machine

When, you select that second power button, the next window will allow you to select Restart.

restart vm2

With the open-vm-tools package installed, you should be able to resize to fill your monitor with your virtual machine window after restarting the virtual machine.

Installing programming software

The following software apps are a good start to the tools you will likely need in order to work on your programming skills. You may find other apps that are useful, and you are encouraged to install those also. But, the following will show a good set of apps to begin with:

sudo apt install build-essential
sudo apt install openjdk-21-jdk

Line 1 installs basic compilers for C and C++, giving you the ability to build apps using makefiles. Line 2 installs the tools for programming in Java.

My opinion, is that to work in computer technology, you should learn three programming languages. These languages are Java, Python and JavaScript. Fortunately, Python is already installed in the default set of apps for Ubuntu. Since JavaScript runs in the browser, the ability to use basic JavaScript programs is also already installed. So, the above installs will allow you to do Java, C and C++ programming.

Installing text and code editors

$ sudo apt install geany

Geany is a simple text editor that is good enough for writing simple programs. So, I find that it is quite useful.

Installing Visual Studio Code

One of the best code editors you can install is Visual Studio Code. It is very full featured, as there are many extensions available for this editor. It is used by both novice and professional programmers, and I highly recommend it.

Go to this link, Visual Studio Code download, to download Visual Studio Code. Since we are running Ubuntu 24.04, download the .deb version for Debian,Ubuntu:

download vs code

That will download a .deb file that starts with code. Open a terminal in the directory you downloaded the file and run the following command:

$ sudo dpkg -i code_xxxx_amd64.deb

where xxxx is the version number of the file you downloaded.

Add the Microsoft repository and signing key during the installation process. After the installation, pin VS Code to the dash:

add vs code to dash

Start by clicking on the Apps icon in the upper left corner. This will bring up a search bar. Type 'vs' into the search bar and the icon for Visual Studio Code will appear. Right-click on this icon and select Pin to Dash. Now, you can start up Visual Studio Code by clicking on the icon in the Dash.

Visual Studio Code extensions

The following screen shot shows the Visual Studio Code extensions that I use most often:

installed extensions

Here is a screen shot that shows how to install a Visual Studio Code extension:

extensions search

In order to install a Visual Studio Code extension, do the following:
1. Click on the Extensions icon on the left side of the Visual Studio Code editor.
2. Type a search string into the search bar.
3. Click on the Install button for the extension you want to install.

You will get a message asking if you trust the authors. Click on the Trust Publisher & Install button to install the extension.

Installing Node.js and npm

If you are going to learn about creating simple web applications, you will need to install Node.js and npm (Node Package Manager). One of the simpler ways of installing them both that works on any operating system is to install nvm (Node Version Manager).

On Ubuntu (and other Linux distributions) a good way to install nvm is to use the installation script that can be found at this site. On that site scroll down until you see the script that allows installing using curl:

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

To run this, we need to install curl first. The curl tool can be very useful for testing web HTTP routes that are commonly used in web applications. So, this is a worthwhile tool to install in any case.

Installing curl

$ sudo apt install curl

After installing curl, here are the steps you can follow to install nvm and get Node.js and npm installed.

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
$ source ~/.bashrc
$ nvm install --lts

Line 1 runs the curl script to install nvm. Line 2 uses the source command to load ~/.bashrc. This saves you from having to log out and log back in so that ~/.bashrc would be loaded. Line 3 installs the LTS (long term support) versions of both Node.js and npm.

Checking the Node and npm versions

$ node -v
$ npm -v

As of 06/02/2025, the node version was v22.16.0 and the npm version was 10.9.2.

Installing chromium-browser

I like the Development Tools that come with the Chromium browser better than the ones that come with Firefox. So, I install the Chromium browser and will be using that for my examples. To install Chromium, run this command:

$ sudo apt install chromium-browser

After installing Chromium, I go to the Apps icon and pin Chromium to the Dash.

Some additional tools

Here are some additional tools that I like to install:

The tree tool

sudo apt install tree

The tree tool is very useful for displaying the directory structure for your folders and files. Here are a few examples:

$ tree <dir> -d -L 2

The -d will display only directories. Using -L n will display only up to n levels.

Here are some examples on my host computer:

$ tree /home/vern/snap -d -L 2
/home/vern/snap
├── chromium
│   ├── 3137
│   ├── 3153
│   ├── common
│   └── current -> 3153
├── firefox
│   ├── 6198
│   ├── 6227
│   └── common
├── firmware-updater
│   ├── 167
│   ├── common
│   └── current -> 167
└── snapd-desktop-integration
    ├── 253
    ├── common
    └── current -> 253

$ tree /home/vern -d -L 1
/home/vern
├── Desktop
├── Documents
├── Downloads
├── Dropbox
├── gems
├── Music
├── pCloudDrive
├── Pictures
├── Public
├── snap
├── Templates
├── Videos
└── vmware

If you want to display the files in addition to the directories, just leave off the -d option.

You can also use the -P pattern option to specify the pattern to match. This works well with the --prune option to leave out empty directories.

$ tree /home/vern/Documents/test_website -P "*.adoc|*.yml" --prune
/home/vern/Documents/test_website
├── antora-playbook.yml
├── antora.yml
├── modules
│   └── ROOT
│       ├── examples
│       │   ├── page1_pre.adoc
│       │   └── page2_pre.adoc
│       ├── nav.adoc
│       └── pages
│           ├── index.adoc
│           ├── page1.adoc
│           └── page2.adoc
├── node_modules
│   └── thread-stream
│       └── test
│           └── yarnrc.yml
└── prebuilt
    └── files
        ├── page1_pre.adoc
        └── page2_pre.adoc

That only shows nonempty directories that contain either an .adoc file or a .yml file.

The -P pattern and --prune* options work well with the -I pattern that ignores directories that match the specified pattern. Here is a similar command to the previous, but ignoring the node_modules directory:

$ tree /home/vern/Documents/test_website -P "*.adoc|*.yml" -I "node_modules" --prune
/home/vern/Documents/test_website
├── antora-playbook.yml
├── antora.yml
├── modules
│   └── ROOT
│       ├── examples
│       │   ├── page1_pre.adoc
│       │   └── page2_pre.adoc
│       ├── nav.adoc
│       └── pages
│           ├── index.adoc
│           ├── page1.adoc
│           └── page2.adoc
└── prebuilt
    └── files
        ├── page1_pre.adoc
        └── page2_pre.adoc

So, I find the tree tool to be useful when I want to check the directory structure of my projects.

The http-server tool

There is a Node package called http-server that can serve out your local webpages. This will allow getting around CORS (Cross-Origin Resource Sharing) problems. This will also let you see how your web pages will behave when you serve those pages out with a web server like Apache or Nginx.

A simple web page may load correctly by just opening a local file directly in the browser. But, if your webpage tries to do something like read in data from a file the same directory this can cause the browser to block reading that file. This is because the browser will treat URLs starting with file:/// as though they are from a different domain. Using the http-server node package will allow treating that directory and even its subdirectories as coming from localhost, so no CORS errors will be triggered.

To install the http-server node package, you run the following command in a terminal:

$ npm install -g http-server

The -g (global) option will install this package so it can be run from any terminal.

To verify which node packages are installed globally, you can run this command:

$ npm ls --depth=0 -global
/home/vern/.nvm/versions/node/v22.14.0/lib
├── corepack@0.31.0
├── http-server@14.1.1
└── npm@10.9.2

To run the http-server, change into the top level directory of where your webpages are located first. Then, run the following command:

$ http-server -a localhost -p 8080
Starting up http-server, serving ./

http-server version: 14.1.1

http-server settings:
CORS: disabled
Cache: 3600 seconds
Connection Timeout: 120 seconds
Directory Listings: visible
AutoIndex: visible
Serve GZIP Files: false
Serve Brotli Files: false
Default File Extension: none

Available on:
  http://localhost:8080
Hit CTRL-C to stop the server

As you can see, the -a option is to specify the address of the host, and the -p nnnn option is to specify the port being listened on.

As mentioned earlier, the http-server can be very useful when running .html files locally. Cross origin resource sharing will be blocked by most web browsers if you just try to open the files using file:///. This will apply to any AJAX requests. If you get any errors stating that what you are doing does not allow file:/// origins, then using the simple http server should make the pages work.

There may be other tools that I may install later for some guides/lessons. That will be documented at that time.