Wednesday, November 13, 2024

How to Install CentOS on macOS with M1, M2, or M3 Chip Using UTM

If you have a Mac with an M1, M2, or M3 chip, you may encounter an issue when trying to use VirtualBox. This is because VirtualBox does not support macOS on these newer Apple Silicon processors. Instead, you might see an error message while attempting to install VirtualBox on your macOS. For those who want to run Linux on macOS, UTM is a powerful alternative. It’s a virtualization tool designed specifically for macOS, making it easy to run Linux virtual machines. In this guide, we’ll walk through installing CentOS on macOS using UTM, step-by-step.

Step 1: Download CentOS

First, download the CentOS ISO file, which you can find on the official CentOS download page here. It’s best to use the latest version; for instance, CentOS Stream 9 is a solid choice for stability and compatibility.

Step 2: Download and Install UTM

You can download UTM from its official site here. UTM is free and straightforward to install, offering a friendly interface for macOS users.

Step 3: Set Up the Virtual Machine in UTM

  1. Open UTM, and select “Create a New Virtual Machine.”
  2. Choose the “Virtualize” option, as this setup uses a virtualized environment.
  3. Select “Linux” as the OS type.
  4. Click “Browse” to locate the CentOS ISO file you downloaded, then select it.
  5. Click “Continue” through the next few setup screens.
  6. When prompted, click “Save” to finalize your setup.
  7. Finally, click “Run” to launch your new virtual machine.

Step 4: Begin Installing CentOS

  1. In the UTM window, select “Install CentOS Stream 9.”
  2. Choose your preferred language, such as “English.”
  3. You’ll be redirected to the installation setup screen. Here, focus on filling out “Root Password” and “Installation Destination.”
  4. Click on “Root Password” to create a password for your root user. Make sure to check “Allow root SSH login with password,” then click “Done.”
  5. Next, select “Installation Destination,” ensure that your local standard disk is selected, and click “Done.”
  6. Once all setup steps are complete, click “Begin Installation.”

Step 5: Reboot After Installation

After installation finishes, you’ll see the option to reboot the system. However, upon reboot, you may be directed back to the installation screen. Don’t worry! Just close the UTM window and power off the VM. Then, clear the installation data, restart the virtual machine, and log in.

Once you log in, you’ll see the CentOS desktop, ready for final setup:

  1. Follow the setup prompts, clicking “Start Setup.”
  2. Skip any unnecessary steps until reaching profile creation.
  3. Enter your profile information, then set your password.
  4. Finish the setup, and CentOS is ready for use!

Testing SSH from macOS to CentOS

Now that CentOS is installed, you may want to set up SSH for easier access.

  1. Open CentOS and ensure all packages are updated by running:


    sudo yum update -y
  2. Confirm that openssh-server is installed:


    rpm -q openssh-server

    If it’s not installed, add it with:


    sudo yum install -y openssh-server
  3. Check the VM’s IP address by running:


    ifconfig

    Look for the “inet” entry to find the private IP (e.g., 192.168.64.8).

  4. Go back to your macOS terminal, and connect via SSH:


    ssh [your_username]@192.168.64.8

    This command should open an SSH session, connecting your macOS terminal to your CentOS VM.

Summary

While UTM is one option for running Linux on macOS, other methods include using cloud services like AWS or Google Cloud. UTM, however, provides an easy, offline way to virtualize Linux on your local machine. Hopefully, this guide simplifies the process and helps you get your Linux VM up and running efficiently!

0 comments:

Post a Comment