How to Replace Old MacOS With Linux on Mac Mini Server

Kamol
By DevOps For DevOps
4 min readApr 2, 2023
Photo by Matúš Gocman on Unsplash

There are several reasons why you may want to consider installing Ubuntu on an old Mac Mini:

  • Increased Performance: Ubuntu is a lightweight operating system that runs efficiently on older hardware. Installing Ubuntu on an old Mac Mini can breathe new life into the device and improve its overall performance.
  • Open-Source Software: Ubuntu is an open-source operating system with a wide range of free and open-source software. This can be an excellent option for users who want to avoid the cost of expensive proprietary software.
  • Security: Ubuntu is known for its robust security features, which can help protect your data and keep your system safe from viruses and other threats.
  • Customization: Ubuntu is highly customizable, allowing you to tweak and adjust the system. This can be an excellent option for users who want to tailor their operating system to their needs.
  • Community Support: Ubuntu has a large and active community of users and developers who can provide support and guidance if you run into any issues with your system.

Overall, installing Ubuntu on an old Mac Mini can be a great way to extend the life of the device and get more use out of it. However, it’s important to note that installing Ubuntu on a Mac Mini can be complex and may require some technical steps.

Installation Steps

Here are the general steps to install Ubuntu on an old Mac Mini:

  1. Create a bootable USB drive with Ubuntu: You can download the Ubuntu ISO file from the official website and use the following command to create a bootable USB drive.
diskutil list  # note the devices seen
# insert flash drive
diskutil list # note the new device seen, e.g. /dev/disk2
diskutil unmountDisk /dev/diskN
sudo dd if=ubuntu-22.04.2-live-server-amd64.iso of=/dev/rdiskN bs=1m
diskutil eject /dev/diskN

2. Boot from the USB drive: Connect the USB drive to your Mac Mini and reboot the system. Hold down the Option key as the system restarts to enter the boot menu, and select the USB drive as the boot device.

3. Start the Ubuntu installer: Once you’ve booted from the USB drive, you’ll be presented with the Ubuntu installer. Follow the on-screen instructions to select your language, time zone, and keyboard layout.

4. Follow the on-screen instructions: The Ubuntu installer will guide you through the installation process, which may take some time to complete.

5. Reboot the system: You’ll be prompted to reboot your system once the installation is complete. After rebooting, your Mac Mini should boot into Ubuntu.

Optional Steps

Add the second hard drive.

First, SSH to your Ubuntu; you can determine its IP address with the following command on your Ubuntu:

ip r
default via 10.0.1.1 dev enp4s0f0 proto dhcp src 10.0.1.75 metric 100
10.0.1.0/24 dev enp4s0f0 proto kernel scope link src 10.0.1.75 metric 100
10.0.1.1 dev enp4s0f0 proto dhcp scope link src 10.0.1.75 metric 100

Now you can SSH to your Ubuntu remotely:

ssh <user_name>@10.0.1.75

Check your current volume group name:

sudo -s
vgs
VG #PV #LV #SN Attr VSize VFree
ubuntu-vg 1 1 0 wz--n- <462.71g <362.71g

Look under the first column, “VG”: if the Ubuntu installer created it, it would be something like “-vg”.

Get rid of all metadata. Note you are wiping the entire disk.

wipefs --all --backup /dev/sdb
/dev/sdb: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/sdb: 8 bytes were erased at offset 0x7470c05e00 (gpt): 45 46 49 20 50 41 52 54
/dev/sdb: 2 bytes were erased at offset 0x000001fe (PMBR): 55 aa
/dev/sdb: calling ioctl to re-read partition table: Success

Label your second drive as a physical volume, and add it to the volume group:

pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.
vgextend ubuntu-vg /dev/sdb
Volume group "ubuntu-vg" successfully extended

Check if pvs shows both physical volumes

pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 ubuntu-vg lvm2 a-- <462.71g <362.71g
/dev/sdb ubuntu-vg lvm2 a-- <465.76g <465.76g

Create a new logical volume and mount it under /data.

lvcreate --size 300G --stripes 2 --stripesize 4096 --name data ubuntu-vg
Logical volume "data" created.
mkfs.ext4 -m 0 /dev/ubuntu-vg/data
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 78643200 4k blocks and 19660800 inodes
Filesystem UUID: cd2f1059-a3d9-4eb2-9fde-0d2d9cb5af98
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616

Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done

mkdir /data

Append the following line in the /etc/fstab file

cat /etc/fstab
...
/dev/ubuntu-vg/data /data ext4 noatime 0 2

And mount /data

mount /data
df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 770M 1.5M 768M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 98G 7.1G 86G 8% /
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
/dev/sda2 2.0G 131M 1.7G 8% /boot
/dev/sda1 1.1G 6.1M 1.1G 1% /boot/efi
tmpfs 770M 4.0K 770M 1% /run/user/1000
/dev/mapper/ubuntu--vg-data 295G 28K 295G 1% /data

Check your work to see which physical volume(s) each logical volume is using:

lvs -a -o name,lv_size,devices
LV LSize Devices
data 300.00g /dev/sda3(25600),/dev/sdb(0)
ubuntu-lv 100.00g /dev/sda3(0)

Conclusion

Please don’t through away your old Mac Mini server. As you can see, it is not tricky to convert it into Linux Server (Ubuntu in our case). It has decent hardware, takes up small space, consumes less electric power, and is quiet.

--

--