This CentOS 8 tutorial will show you how to install CentOS 8 on VirtualBox. To begin you will see how to create a Virtual machine on VirtualBox. Gotcha, this is CentOS 6.3 and yeah for some reason its not picking up the change in the virtual MAC address as configured in Virtualbox. Not a showstopper as its easy enough to fix, but when I have some time I'll poke around some CentOS boards and see if I can figure out why it acts this way, based on some of the things I read Ubuntu doesn't.
Most of my clients use CentOS on the production server. So, I usually end up installing VirtualBox or VMWare Fusion on my work machine and a CentOS guest instance to simulate the production server.
I generally prefer bridged networking if there are no restrictions, so my virtual machine is assigned its own DHCP generated IP address.
Blog: Quick demo on installing Centos 7 on Mac using Oracle Virtual Box manager. Installing VirtualBox Guest Additions on CentOS. Now that we have a running CentOS 8 on a VirtualBox, we now installed the VirtualBox Guest Additions on Centos 8 to properly integrate the virtual machine to the host machine including copy/paste functionality, synchronizing the date/time from the host machine to virtual machine, mouse and keyboard integration and so on.
But in some cases, if the MAC address of my host machine has to be registered and that's a hassle, the best thing to do is to set up NAT network. This way, the guest vm can access the Internet using the IP address assigned to the host. Internally, the guest will have its own private network, and won't be accessible by the host.
In order to make the guest accessible from the host, we'll need to enable a second network adapter Host-Only network adapter.To do that, follow these steps:
- Shutdown the CentOS guest vm.
- Go to VirtualBox → Preferences → select Network tab and create a Host-Only Network adapter.
- Click on (spacebar) or on 'Edit host-only network' icon on the right side. Select the tab DHCP Server. You should see something like this:You can either set up your static IP or leave it at DHCP like I did.
- Go back to the main VirtualBox app and click on Settings. Select Network tab. Your first network adapter should be NAT. Click on Adapter 2 and change the adapter type to Host-only Adapter. Assign it to 'vboxnet0' which we just created.
- Start the CentOS guest vm. When it boots up, start the terminal and run ifconfig as root:
Our guest has been assigned an IP address of 192.168.56.101 which can be used from the host. Let's try to access the guest from the host by ssh-ing into it using Mac OS's Terminal.- Open the Mac Terminal and type this:
- It should connect and ask you for the username/password so you can login.
If you have a web server running on the guest and can't access it, even though you're able to ssh into the guest, you will need to open ports 80 (and poossibly 443).
CentOS: Unable to access webserver, but able to connect via SSH
PROBLEM: After enabling NAT and Host-Only network, I'm able to access the guest CentOS vm via SSH (port 22) but not via browser.
To enable the webserver to be accessible by the host OS, run as root:
You should then enable port 80, port 433 and other ports that you'll be needing from within the host. Then, click on Apply and Reload.
Mac In Virtualbox
Navigate to http://191.168.56.101. It will show up.
First written in January 2013
Created on 29 January 2013