Our first virtual machine installation is an interactive GUI installation. This installation isn't too much different than the installation on the physical hosts. There are some configuration settings concerning the network that can improve the user experience.
- [Instructor] To install CentOS 7 in a guest VM interactively, we'll use virt-manager. Virt-manager will bring up a graphical interface. Go to Applications, System Tools, and scroll down to Virtual Machine Manager. Enter your password and hit Enter. If all is well, you should see the Virtual Machine Manager GUI. To create a new VM, click on the icon on the left side of the toolbar. You may get a warning message here, saying that VT is not enabled. If so, you'll want to double-check your BIOS to make sure it's turned on.
It may also be that the KVM module didn't get loaded. To fix this, follow the previous video again to ensure you installed all packages, enabled libvirtd and reboot it. However, if you don't get any error messages that should look like this, then you can close this dialog box. To install CentOS 7 in the guest VM, we'll need to download the CentOS 7 ISO image onto our host. Open FireFox and browse to centos.org/download and click on DVD ISO and then click on a mirror.
Now, click Save File and click on OK. And lastly, click on Save. You can see the progress by clicking the download button on the toolbar. Once the download is done, you can close FireFox. To create a new VM, go back to Virtual Machine Manager and click the left-most button again. This time, select Local Install Media and click on Forward. Now, click on the use ISO image and click on Browse. Now, click on Browse Local and choose your CD image that you just downloaded and click on Open.
Now, click Forward and you should see the settings for memory and CPU cores. I'm going to set my memory to 2,048 megabytes and my CPU cores to two. The dialog shows how much memory and CPU cores I have available. On your machine, you may want to choose different settings. I recommend a minimum of 1,000 megabytes of RAM and one CPU core. Now, click on Forward. The next pane is where we create a disk image. The default is nine gigabytes. We'll go with that, so click on Forward again. Now, we can name the VM if we wish. It's best to choose descriptive names for our VMs.
In our case, the default will work fine. We can also choose our network if we want. Click on Network Selection. The default is NAT or network address translation. NAT is fine for most VMs that need access to the network. However, if we want a VM that we can log into remotely from another guest, we'd want to change this to one of the MacVTap devices. The MacVTap devices act as a network bridge to your physical network devices. I have two MacVTap devices, enp0s25 and wlp3s0.
Chances are, you will have different choices. But just know that any device starting with enp is an ethernet-wired connection and any device starting with wlp is a wireless device. I'm going to choose host device enp0s25 MacVTap. So my VM will be on the same network as my other guests. It will then ask me to specify the network source mode. The default is bridge, which will work fine. Note that you cannot access the guest VMs from the host using MacVTap as we have it configured. This is a design feature of the MacVTap device.
The way around this is to create a new network later that both the host and guest reside on. This will allow the host and guest to communicate. Note that some wireless network adaptors do not support this type of bridge. I'll click on Finish. When the install starts, press the up-arrow key to highlight the Install CentOS 7 line. If we don't choose this, the installer will automatically test our installation media after the timer runs out. Choosing turns the timer off. Put your VM into full-screen mode by clicking the switch to full-screen view button in the toolbar.
Now, hit Enter to start the install. Once the install starts and we have a graphical interface, we can go out of full-screen mode by hovering our mouse over the top center of the screen and two buttons will show up. Click the left one to leave full-screen mode. Now, let's choose the install language. It's set to English, so I'll just click on Continue. In the next screen, we can choose the set our date and time, keyboard, and language. The defaults are fine for me.
Let's click Installation Destination. Here, we choose where to install the OS. The only disk available is called VirtIO Block Device. Ensure this is checked and then click on Done. Now, click Software Selection. The default is Minimal Install. There's nothing wrong with this, but it doesn't give us a lot of software to start with. Let's choose Server With GUI. Server With GUI gives us a nice base OS with a graphical interface. Now, click Done again. Now, let's click Network & Host Name.
Click the slider on the right to turn on the network by default. Change the host name at the bottom to centos7.vmguests and click Apply. When that's done, click on Done. Now, click on Begin Installation. While it's installing, set a root password by clicking on Root Password. It will warn you if the password is not strong enough with a message at the bottom.
Then click on Done. Next, we'll create a user by clicking on User Creation. Enter your name. I'm entering Grant McWilliams. I like having a short username though, so I'm going to change my username to just Grant. Now, click on Make This User Administrator. This is very important for later. Set the password for your user and then click on Done.
Now, wait for the install to finish. Using movie magic, I'm going to speed up this part of the video. Pause this video until your installation catches up. When it's done, click on Reboot. When your VM reboots, it will take you out of full-screen mode. Click on the full-screen view button again. When it reboots, it will bring up the initial setup window. Click on License Information and then click on I Accept The License Agreement and click on Done. Now, click on Finish Configuration.
Now, you should be presented with the login manager. Click on your username and enter your password. Once logged in, the welcome window will come up where we can configure our language and keyboard. Click Next twice to take the defaults set by the installer. The GUI also lets us configure social media. We'll skip this. Now, click on Start Using CentOS Linux. The last window that pops up is some tutorial videos on using the GNOME Desktop for you to peruse.
We can close this window now. To shut down our new VM, we can go to the system menu in our top right-hand corner of our screen and choose the shut down button or we can go out of full-screen mode by hovering over the top center and choosing the leave full-screen button. Once we're out of full-screen mode, we can select the Virtual Machine menu and select Shut Down and then Shut Down again. This is the nice way of shutting down the VM. If it has crashed and is unresponsive, we can force it down with the forced off menu item. This is similar to pulling the power cord on a running physical machine.
I wouldn't use this unless I had no other choice. Now, we can close the CentOS 7 VM window. We should see our new CentOS 7 VM listed in the Virtual Machine Manager pane.
- Virtualization on Enterprise Linux
- Managing virtual machines
- Installing Linux in a guest VM
- Configuring interface bonding
- Configuring interface teaming
- Configuring IPv6 addresses
- Creating static routes