Continuing to set up your lab environment, configure networking, hostname, and name resolution for both rhhost1 and rhhost2 virtual machines. Additionally, install the acpid service and enable it. When complete, create snapshots to provide a future base to roll back to.
- [Instructor] To configure your VM settings, click on rhhost1 in the VirtualBox Manager window and click on start. Go to full screen mode by pressing the host key plus f. The host key is listed in the bottom right-hand corner of the window. In my case it's the right control key. Full screen mode will make navigating the desktop much easier. Once your VM has booted log in when prompted. On the desktop click on the top right-hand menu. Click on wired and then click on wired settings.
Click the slider gadget to turn the network on and note the IP address, in my case it's 192.168.1.86. Then click the settings gear in the bottom right-hand corner. Click on identity in the left-hand pane and then click on connect automatically. Now click on apply. You can close the window now. Let's also set the host name for our new VM. Click on applications, favorites, and terminal. I'm gonna make mine full screen and then run the hostnamectl command. Type in sudo hostnamectl set-hostname rhhost1.localnet.com and hit enter.
Type in your password when prompted. For better shutdown support let's also run the ACPID service. First we need to install it. Type in sudo yum install -y acpid and hit enter. Once it's installed type in clear and then let's enable it. Type in sudo systemctl enable acpid and hit enter. We'll also wanna start it. So bring your line back and change enable to start. It should read sudo systemctl start acpid and hit enter.
Now press your host key plus f to go out of full screen mode. And press your host key again to release your mouse pointer. And we'll flip back over to the VirtualBox Manager window and we'll start up rhhost2 so we can configure it. Click on start. Press your host key plus f again to go into full screen mode. Log in when prompted and then on the desktop go to the top right-hand menu. Click on wired and click on wired settings. Click the slider gadget to turn the networking on.
And note your IP address. Mine is 192.168.1.87. Now click on the gear icon in the bottom right-hand corner and then in the left-hand pane click on identity and click the connect automatically checkbox. Click apply and then close the window. We will also set the hosting for a new VM. Click on applications. Click on favorites. Click on terminal. I'll make mine full screen and I'll run the hostnamectl command. Type in sudo hostnamectl set-hostname rhhost2.localnet.com and hit enter.
Type in your password when prompted. For better shutdown support we'll also run the ACPID service which we need to install. Type in sudo space yum install -y acpid and hit enter. Now type in clear and we'll enable the service. Type in sudo systemctl enable acpid and hit enter. Now let's bring the line back and we'll start the service by changing enable to start. The line should read sudo systemctl start acpid.
Now let's also add local name resolution to our etc host file. We'll need both the IP address of rhhost1 and rhhost2. Type in sudo vi /etc/hosts and hit enter. We're going to go into insert mode by pressing the i key and then we'll go to the end of the file and add a line. Now type in the IP address of rhhost1. In my case it's 192.168.1.86 rhhost1.localnet.com rhhost1.
Now hit enter and type in the IP address of rhhost2. In my case it's 192.168.1.87, so you'll wanna type in your IP address, of your rhhost2 here, rhhost2.localnet.com rhhost2. Save and exit by pressing escape:x! and hitting enter. Now let's test connectivity by pinging rhhost1 by name. Type in ping rhhost1 and hit enter. After it sends a couple of ping packets press control c to cancel.
If it successfully pings rhhost1 you can continue with this course. If not, go over the steps in this video until you get it to work. Do not proceed on until the step works; otherwise, the rest of the course cannot be completed. Now let's copy this file to rhhost1 so we have local name resolution on both machines. Type in clear then type in sudo scp /etc/hosts rhhost1:/etc/hosts and hit enter.
Type in yes and then type in rhhost1's root password. Once this is done close the terminal window and create a snapshot by pressing your host key plus the letter t. Name the snapshot Network Configured and click on OK. Now you can shut down rhhost2 by going out of full screen mode by pressing your host key and the letter f. Now click the close gadget and make sure restore current snapshot is selected. Now go back to your rhhost1 VM and create a snapshot by pressing your host key plus the letter t.
Name the snapshot network configured and click on OK. Power the VM down by pressing the close gadget. Select power off the machine and make sure restore current snapshot Network Configured is selected and click on OK. We now have two VMs named rhhost1 and rhhost2 with host names configured as well as network settings. Both VMs have local name resolution configured so they can reach each other by name.
Note: This course also helps you study to pass the Red Hat Certified Engineer (RHCE) exam—the benchmark certification for Red Hat Enterprise Linux.
- Installing DNS clients
- Using host, nslookup, and dig
- Name resolution
- DNS roles
- Configuring DNS
- Apache web server features
- Apache commands and access control
- Configure Apache and virtual hosts
- Securing virtual hosts with SSL and TLS
- Running CGI scripts in Apache
- Configuring NGINX server blocks