How to Install FreeBSD Alongside Linux (e.g., Ubuntu) on FreeBSD Operating System
Categories:
4 minute read
Installing FreeBSD alongside Linux, such as Ubuntu, in a dual-boot setup can be an excellent way to enjoy the benefits of both operating systems on a single machine. While FreeBSD offers powerful features like the ZFS file system and jails for virtualization, Linux distributions like Ubuntu provide extensive software repositories and community support. This guide will walk you through the step-by-step process of setting up a dual-boot system with FreeBSD and Ubuntu.
Prerequisites
Before beginning the installation process, make sure you have the following:
- A computer with a FreeBSD installation (or plan to install it)
- Ubuntu ISO downloaded from the official website
- A bootable USB drive (at least 8GB)
- A partitioning tool (like GParted or FreeBSD’s built-in utilities)
- A backup of important data (to prevent data loss in case of errors)
- Access to the FreeBSD bootloader
Step 1: Prepare Your FreeBSD System
Check Disk Space
Before installing Ubuntu alongside FreeBSD, you need to check if there is enough space available for the new OS. You can check this using:
gpart show
Look for available unallocated space or consider resizing existing partitions.
Resize FreeBSD Partition (If Needed)
If your FreeBSD installation takes up the entire disk, you’ll need to shrink it to make space for Ubuntu. You can do this with the following command:
gpart resize -i <partition_number> -s <new_size> ada0
Replace <partition_number>
with the correct partition number and <new_size>
with the desired size.
After resizing, create a new partition for Ubuntu using:
gpart add -t linux-data -s <size>G ada0
Step 2: Create a Bootable USB Drive
To install Ubuntu, create a bootable USB using dd
on FreeBSD:
dd if=/path/to/ubuntu.iso of=/dev/da0 bs=4M status=progress
Replace /dev/da0
with the correct USB device name.
Alternatively, you can use a tool like rufus
on Windows or balenaEtcher
on macOS.
Step 3: Boot Into Ubuntu Installer
- Insert the bootable USB into your machine.
- Restart your system and enter the BIOS/UEFI settings (usually by pressing
F2
,F12
, orDEL
). - Change the boot order to prioritize the USB drive.
- Save changes and restart to boot into the Ubuntu installer.
Step 4: Install Ubuntu Alongside FreeBSD
Choose “Try Ubuntu” or “Install Ubuntu”
- If you want to test Ubuntu before installing, choose “Try Ubuntu.”
- Otherwise, proceed with “Install Ubuntu.”
Select “Something Else” in Installation Type
- The installer will show available partitions.
- Locate the Linux partition you created earlier.
- Select it and format it as
ext4
. - Choose a mount point (
/
).
Set Up Swap (Optional)
- If you want a swap partition, create a small partition (equal to RAM size) and format it as
swap
.
- If you want a swap partition, create a small partition (equal to RAM size) and format it as
Install the Bootloader
- Important: Ubuntu uses GRUB by default, but you should avoid installing it over the FreeBSD bootloader.
- Instead, install GRUB on the Ubuntu partition (e.g.,
/dev/sdaX
).
Complete the Installation
- Follow the on-screen instructions to finish the Ubuntu installation.
- Restart when prompted.
Step 5: Configure the FreeBSD Bootloader
By default, FreeBSD uses boot0
or beastie
bootloader, which does not recognize Ubuntu. You will need to manually configure the bootloader to detect Linux.
Add Ubuntu to FreeBSD Bootloader
- Edit the FreeBSD boot configuration file:
vi /boot/loader.conf
- Add the following lines to detect Ubuntu:
beastie_disable="YES"
loader_logo="beastie"
- Modify
/boot/boot0.cfg
or usegpart
to set boot options:
gpart set -a active -i <ubuntu_partition_number> ada0
- Reboot and test the setup:
shutdown -r now
When you restart, you should see both FreeBSD and Ubuntu as boot options.
Step 6: Configure GRUB (If Needed)
If you want GRUB to handle booting FreeBSD instead of the FreeBSD bootloader, follow these steps:
- Boot into Ubuntu and open a terminal.
- Update GRUB to detect FreeBSD:
sudo update-grub
- Restart your system and ensure that FreeBSD appears in the GRUB menu.
Conclusion
Setting up a dual-boot system with FreeBSD and Ubuntu allows you to take advantage of both operating systems’ strengths. By carefully partitioning your disk, installing Ubuntu without overwriting the FreeBSD bootloader, and configuring boot options properly, you can switch between the two systems seamlessly. Whether you prefer the robust stability of FreeBSD or the vast software ecosystem of Ubuntu, this setup offers the best of both worlds.
By following these steps, you now have a fully functional dual-boot system. Enjoy your FreeBSD and Linux experience!
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.