Easy Ubuntu Server Installation on MacBook Using VMware Fusion's Custom Vnet


How to Download the Ubuntu Image
Visit the official Ubuntu website at https://ubuntu.com/download/server and download the Ubuntu server version instead of the desktop version, as the server requires less RAM and hard disk space. The image size will be approximately 3 GB.
How to Install VMware Fusion on Mac
Go to https://support.broadcom.com/ and create a new account if you donβt have one. You can use your Gmail account for registration. Once logged in, you will see the landing page. Click on the dropdown, then navigate to VMware Cloud Foundation > My Downloads > Free Software Downloads available HERE. Search for Fusion, select VMware Fusion, choose the latest revision, and download it (click "I agree to the Terms and Conditions").
After clicking download, a prompt will appear. Click yes to proceed, fill in your details, and submit.
once you submit , You will be redirected to the download page again. Click on download to obtain VMware Fusion. You will receive a .dmg file; click on it to install Fusion.
Create a virtual machine in VMware Fusion
As mentioned above, we will use the Ubuntu image to create a virtual machine. However, before that, we need to create a custom virtual network (vmnet) with NAT enabled in VMware Fusion. This setup will allow us to create a virtual machine with internet access. By using a custom vmnet with NAT, we are not dependent on our local network, and the network range will always remain static. lets create custom vmnet now
Create a custom Vnet
Search for VMware Fusion on your MacBook and navigate to VMware Fusion > Settings > Network. Unlock the settings and click on the "+" button to add a new network.
now add a vnet and allow NATing
create Virtual machine
We will create a virtual machine using the Ubuntu image. It will have 2 GB of RAM and a 20 GB hard disk.
Click "+" > Create a custom virtual machine (continue) > Ubuntu 64-bit Arm > Create a new virtual disk >
Customize Settings (give the name of the VM) > Finish (it will create a machine without an OS disk, so close it)
Now, go to Settings > CD/DVD (SATA) to browse and connect the Ubuntu image, then select Network Adapter > custom vnet (vmnet3) and connect the Network Adapter.
Now start the VM, and the installation will begin.
Click "Try or Install Ubuntu Server" > "English" > "Continue without updating" > "Done" > "Ubuntu Server" > "Done," then you'll see an IP assigned by DHCP (we'll make it static later) > "Continue" > "Use an entire disk" > "Done," and then choose a username, server name, and password > continue ( skip Ubuntu pro)>
Install OpenSSH server > done > wait for the installation to finish
once finished , reboot the server
Once finished, reboot the server and log in with the username and password you set during installation.
Now you can SSH into the server using 192.168.39.128 (the firewall is disabled).
Note: You can't log in when you are connected to a VPN.
Enable root access and set up a static IP (optional)
Enable root access
grep -n PermitRootLogin /etc/ssh/sshd_config
sudo sed -i '/^#PermitRootLogin prohibit-password$/a PermitRootLogin yes' /etc/ssh/sshd_config
grep -n PermitRootLogin /etc/ssh/sshd_config
## restart ssh service
sudo systemctl restart ssh
## to change the root password
echo "root:ubuntu" | sudo chpasswd
ssh root@192.168.30.128
Configure a static IP
You can configure a static IP if you want.
check your gatway
ssh rohit@192.168.30.128
sudo -i
cp 50-cloud-init.yaml 50-cloud-init.yaml.bkp
root@kubernetes-master:/etc/netplan# ls -l
total 8
-rw-r--r-- 1 root root 391 May 22 07:35 50-cloud-init.yaml
-rw------- 1 root root 391 May 22 07:36 50-cloud-init.yaml.bkp
cat >50-cloud-init.yaml <<EOF
network:
version: 2
ethernets:
ens160:
dhcp4: no
addresses: [192.168.30.128/24] ## check your subent and IP
routes:
- to: default
via: 192.168.30.2 ## check your gateway
nameservers:
addresses: [8.8.8.8, 4.4.4.4]
EOF
chmod 600 50-cloud-init.yaml
root@kubernetes-master:/etc/netplan# ip a show ens160
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:13:38:8e brd ff:ff:ff:ff:ff:ff
altname enp2s0
inet 192.168.30.128/24 brd 192.168.30.255 scope global ens160
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe13:388e/64 scope link
valid_lft forever preferred_lft forever
root@kubernetes-master:/etc/netplan# ip r
default via 192.168.30.2 dev ens160 proto static
192.168.30.0/24 dev ens160 proto kernel scope link src 192.168.30.128
root@kubernetes-master:/etc/netplan# ping -c3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=128 time=33.3 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=128 time=37.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=128 time=37.1 ms
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2006ms
rtt min/avg/max/mdev = 33.335/36.080/37.767/1.957 ms
root@kubernetes-master:/etc/netplan#
root@kubernetes-master:/etc/netplan# ping -c3 google.com
PING google.com (142.250.192.174) 56(84) bytes of data.
64 bytes from del11s11-in-f14.1e100.net (142.250.192.174): icmp_seq=1 ttl=128 time=26.0 ms
64 bytes from del11s11-in-f14.1e100.net (142.250.192.174): icmp_seq=2 ttl=128 time=27.7 ms
64 bytes from del11s11-in-f14.1e100.net (142.250.192.174): icmp_seq=3 ttl=128 time=26.1 ms
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2005ms
rtt min/avg/max/mdev = 26.035/26.611/27.683/0.758 ms
Subscribe to my newsletter
Read articles from Rohit Rai directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Rohit Rai
Rohit Rai
π DevOps Engineer at IBM With a solid background in both on-premise and public cloud environments, I specialize in OpenStack, AWS, and IBM Cloud. My expertise spans across infrastructure provisioning using π οΈ Terraform, configuration management with π§ Ansible, and orchestration through βοΈ Kubernetes and OpenShift. Iβm skilled in scripting with π Python and π₯οΈ Bash, and have deep knowledge of Linux administration. Passionate about driving efficiency through automation, I strive to optimize and scale cloud operations seamlessly. π Additionally, I have a keen interest in data science and am excited about exploring how data-driven insights can further enhance cloud solutions and operational strategies. ππ