UTM - Run Ubuntu Virtual Machine on Mac
This blog is a step by step guide on how to run a Ubuntu (Linux) Virtual Machine on MacOS using UTM (Open Source Virtual Machine Tool). Also the settings needed to share Clipboard and Directory between Ubuntu and MacOS.
Youtube video:
The video shows the step by step description of this blog
Download UTM
Download Ubuntu ISO file
Download Intel or AMD 64-bit architecture Ubuntu LTS iso file from
Create Ubuntu Virtual Machine
- Open UTM
- File Menu -> New
- Select Virtualize
- Select Linux
- Set Memory as 12288 MiB
- Set CPU Cores as 3 or higher
- Check Enable display output
- Uncheck Enable hardware OpenGL acceleration
- Click Continue
- Uncheck Use Apple Virtualization
- Select Boot Image Type as Boot from ISO image
- Click Browse and select the download Ubuntu LTS iso image
- Click Continue
- Set size of the drive as 64 GiB or higher
- Click Continue
- Do not set any shared directory at this point, we will setup the shared directory once Ubuntu installation is completed. Skip this step for now and click Continue
- In Summary, set Name as Ubuntu-Linux
Install Ubuntu
- Click the Play button next to Ubuntu-Linux to begin installation
- Using Keyboard, select Try or Install Ubuntu option and press Enter key
- Choose Language as English and click Next
- Skip Accessibility and click Next
- Select keyboard layout as English (UK) or English (US) or Indian and click Next
- For Internet, select Use wired connection
- Skip Update and click Next
- Select Install Ubuntu and click Next
- Select Interactive Install and click Next
- Select Extended selection and click Next
- Check Install third party software
- Check Install support for additional media formats
- Click Next
- Select Erase disk and install Ubuntu
- Click Next
- Set Your Name as ubuntu
- Set Computer Name as ubuntu-utm
- Set Your username as ubuntu
- Type password and confirm password
- Check Require my password to log in
- Uncheck use active directory
- Click Next
- Select your timezone and Click Next
- Click Install
- Once installation is complete, click Restart now
- When you see the message 'Please remove the installation medium', click 'Drive image options' icon on the top right corner, then hover on 'CD/DVD' and select 'Eject'. And then press Enter key
- Now the installation is complete and wait for the restart
Clipboard and Directory Sharing
The following settings or changes are very important to enable clipboard and directory sharing between Ubuntu and MacOS
- Show Apps -> Terminal and execute sudo apt install spice-vdagent spice-webdavd
- After installing the packages Power Off Ubuntu Machine
- In the UTM app, right click Ubuntu-Linux and select Edit
- Go to sharing secting
- Tick Enable clipboard sharing
- Set Directory Share Mode as 'SPICE WebDAV'
- Click Browse and choose any directory (eg Downloads) on MacOS
- Untick Read Only
- Click Save
- Start Ubuntu-Linux
Access the shared directory in browser at http://127.0.0.1:9843/
Or by executing the command in terminal
firefox http://127.0.0.1:9843/
Connect the shared directory in Files explorer
- Files -> + Other Locations -> Click Spice client folder
- Wait for another Spice client folder to appear in the Files under Networks.
- Double click the Spice client folder to open the shared directory
- To open the directory in Terminal go to the Address bar and Click Current folder Menu and select Open in Terminal
Note: The following command can be used to open the + Other Locations in Files application if it is not visible in Files due to screen resolution
nautilus other-locations:///
Manually mounting MacOS host directory
Follow the steps below to manually mount MacOS host directory to a different location
Install/Upgrade davfs2 package:
sudo apt-get install -y davfs2
Create a directory under user's home directory to mount:
mkdir $HOME/webdav_mount
Mount the MacOS host directory:
sudo mount -t davfs http://127.0.0.1:9843/ $HOME/webdav_mount
Leave username as empty and press Enter key
Leave password as empty and press Enter key
Access the host directory using Terminal:
cd $HOME/webdav_mount
Access the host directory using Files Explorer:
nautilus $HOME/webdav_mount
Adding multiple displays
Perform the following steps to add additional displays (monitor) for Ubuntu
- In the UTM app, right click Ubuntu-Linux and select Edit
- Click + New option and select Display
- Click the newly created Display section
- Select Emulated Display Card as virtio-gpu-pci
- Tick Resize display to window size automatically
- Click Save
- Restart the Ubuntu-Linux vm to see the addtional display (monitor)
Changing mouse scroll speed
Since this Ubuntu is a virtual machine, it doesn't have the ability to control the mouse scroll speed. To control the scroll speed in Ubuntu, adjust the scroll speed in host operation system (MacOS) using the following options for built-in touchpad or external mouse
MacOS -> System Settings -> Accessibility -> Pointer Control -> Trackpad Options -> Scroll Speed
MacOS -> System Settings -> Accessibility -> Pointer Control -> Mouse Options -> Scroll Speed
Change Ubuntu Settings
The following settings or changes are optional, but doing it makes the experience with Ubuntu smoother
- Show Apps -> Settings -> Mouse & Touchpad:
- Uncheck Mouse Acceleration
- Set Scroll Direction as Natural
- Show Apps -> Settings -> System -> Date & Time -> Clock & Calendar:
- Check Seconds
- Show Apps -> Settings -> Ubuntu Desktop
- Uncheck Show Home Folder
- In Dock -> Show on, select All displays
- Show Apps -> Settings -> Privacy & Security -> Screen Lock
- Blank Screen Delay: Never
- Automatic Screen Lock: Off
- Automatic Screen Lock Delay: Never
- Lock Screen on Suspend: Off
- Show Apps -> Settings -> System -> Users
- Click Unlock button to unlock administrator settings
- Automatic Login: On
- Change username or password if required
Comments
Post a Comment