Connecting to Linux
The course is part of this learning path
In this course, you will learn how to install a Linux system and connect to it, whether that be on Mac or Windows. You'll also learn how to install Linux from scratch. This course is part of the Linux Administration Bootcamp learning path, designed to get you up and running with Linux.
- Understand what a Linux distribution is, what the most common Linux distributions are, and how to choose the right one for you
- Learn how to install VirtualBox on Windows and Mac
- Learn how to install Linux using an image for VirtualBox
- Understand common issues that may arise with VirtualBox and how to deal with them
- Learn how to install CentOS from scratch
- Learn how to connect to a Linux system
- Anyone with little to no knowledge of Linux who wants to learn more about the operating system
- Professionals who want to learn about Linux to enhance their career prospects
This is a beginner-level course so there are no prerequisites, but an interest in Linux and programming knowledge in general would be beneficial.
The external resources for this course can be found here:
In this lesson, you'll learn how to install CentOS from scratch or how to install CentOS manually. Now this comes in handy if you wanna customize your installation or if you're working on physical hardware. Now, if you already have a Linux distribution installed and ready to go for this course feel free to skip this lesson. For example, perhaps you installed CentOS using a VDI or Virtual Disc Image in virtual box. And so you already have a working system to use this course with. So again, you can skip this lesson.
At this point you should have virtual box installed on your operating system. The next thing you're going to do is download CentOS from CentOS.org. Now what we need to do is find the download link. So here it says, Get CentOS Now, go ahead and click on that. Now, by the way, that may look completely different when you're accessing the CentOS website of course, websites can get updated all the time.
So just find the download section for CentOS gonna scroll down a little bit here. You'll notice that you have two options here. The CentOS Linux DVD ISO is a perfect for our needs. It's based on the latest stable Red Hat enterprise release. This means it's been well-tested so you shouldn't be in for any bad surprises. The CentOS Stream DVD ISO on the other hand is a rolling release. Consider it a development release or a work in progress release.
With that said, let's stick to the most stable version and click on CentOS Linux DVD ISO. Here you'll be presented with a list of mirrors and you can simply choose any one of these. They all point to the exact same file. So I'll click on the very first one here and it starts to download. Now, this is a very large file so it will take some time to download.
Once you have the ISO downloaded you're ready to create a virtual machine. So go ahead and start the virtual box application. Create a new virtual machine for your CentOS operating system installation by clicking on New, you can see that it asks you for a few bits of information, the name, the machine folder the type and the version.
Now I'm going to name the virtual machine CentOSdesktop. As I type that in virtual box automatically selected Linux as the type and Red Hat as the version. If it didn't, you could simply use the drop down boxes and make the appropriate selections. So you would go here first and click Linux and then select Red Hat 64 bit. Now, if you do not have a Red Hat 64 bit option that most likely means that your hardware acceleration features for your computer are not enabled. This means you need to enable the hardware acceleration and or virtualization settings in your computer's bios reboot your computer and enter the bios and make sure that you have VTX or AMDV-enabled in your physical computer's bios.
Now, if you have an Intel processor, you might see VTX and if you have an AMD processor, well, you might see AMDV. Also, if you see any settings for virtualization technology or virtualization extensions go ahead and enable those as well. Now, this process varies from manufacturer to manufacturer. So you might have to look up the documentation for your specific computer. Again, you only need to perform the steps of going into the bios and enabling those virtualization settings. If you do not see a Red Hat 64 bit option here in the version section of this screen. Also you can just leave the machine folder set to the default.
Now that you have a name, type and version set for your virtual machine, you can continue. So go ahead and click Next. The minimum amount of RAM recommended is 1,024 megabytes or one gigabyte. Now I have plenty of RAM to use on my system. So I'm going to dedicate about half of my resources to this virtual machine. So I'll use 8,192 megabytes, which is eight gigabytes. Once you set your memory size, click Next.
Now we need to create a virtual hard drive. Make sure that Create a Virtual Hard Disk Now is selected and then click the Create button. The default of VDI is fine for the hard disk type especially if you're not going to be using this disc image with other virtualization software. So just go ahead and click Next. You have two choices here. One is dynamically allocated and the other is fixed size. If your primary concern is about preserving disc space or using as little disc space as possible choose dynamically allocated. However, if you're looking for better performance use fixed size. If you're not sure which one to choose just go ahead and use the default of dynamically allocated. Now click Next to continue.
Here is where you can set the size of your hard disk. I'm going to specify 100 gigabytes for my hard drive size, although 10 gigabytes or so is sufficient to install CentOS too. Now I wouldn't recommend anything less than 20 gigabytes but again, I like having some additional space, so I'm going with this larger size of 100 gigabyte. So now we can click Create to create the virtual machine.
Next you need to install CentOS. So we'll just power on the machine by clicking on the Start button at the top. Immediately virtual box asks you for a virtual optical disc file. Of course, you're going to use the CentOS ISO file that you downloaded earlier. So click on the folder icon and this opens the Virtual Media Manager window, click on Add and navigate to where you downloaded the ISO file. This will probably be in your downloads folder. I already had my downloads folder here selected and as you can see, I have my ISO file. So just click on that and click Open.
Now, click Choose. And the last one step here is to click Start to boot your virtual machine. You'll notice that you have three options. The test this media and install CentOS Linux eight is highlighted. It's kinda hard to tell what's highlighted but that is what is highlighted. What this will do is make sure that the image that you're using isn't corrupted. Now, I recommend going with the default here. So go ahead and just press Enter to start the installation.
You'll see the system start to boot and perform a check on the media. If for some reason the ISO got corrupted during the download, this will alert you to that fact. To interact with the VM click inside of it. This allows the virtual machine to take control over the mouse and keyboard. So anything that you type or any mouse movements you make are going to the virtual machine at this point.
To give control of the mouse and keyboard back to the host system you need to press the Host key, which is a special key reserved for virtual box actions. The default host key on a Mac is the Left Command key. While the default host key on Windows is the Right Control key. Even if it's something different you can always tell what the Host key is by looking in the bottom right of your VM Window. I'm on Windows so you can see the words right, C-T-R-L, which stands for the Right Control key. And that is displayed in the bottom right of the VM window.
Also, if this is the first time you've done this, a virtual box will give you some information about this. More or less it's telling you the exact same thing that I just told you. So I'm gonna go ahead and click on Capture to let the virtual machine takeover my mouse and keyboard. So now we're inside a virtual machine. And the first thing we need to do is select the language as you can hopefully tell I speak English. So I'm gonna use the default of English. Once you've selected your language, click Continue.
There are many selections you can make here on this installation summary screen. Most of them are optional. However, anything with an alert symbol next to it requires your attention. Let's start by clicking on the installation destination since it has an alert icon next to it. The only thing you have to do on this screen is to simply click Done. CentOS is forcing you to make sure that you are installing it to the right disks. This virtual machine only has access to one virtual disk and it's already selected.
So now I'm just gonna go ahead and click Done. And by the way, if it wasn't selected you can go ahead and click it and you'll see a check mark indicating that it is selected. So again, I'm gonna click Done. Now you can see that the alert icon has disappeared. We want to enable networking for our CentOS installation.
So next click on Network and Host Name. If you see the word disconnected next to the interface name go ahead and click the On-Off switch. The network interface status should go from disconnected to connected. Now click on Done. The final thing we need to do on this screen is to change the software selection. So click on Software Selection, on the left-hand side, click on Workstation.
Now on the right hand side, click on Development Tools. If you don't select Development Tools you won't be able to install something later called a VirtualBox Guest Additions, and we'll be talking about those guests additions in a little bit. So just make sure that there is a check mark next to development tools. Those are the only changes we need to do on this screen. So let's go ahead and click Done to return to the installation summary screen.
If you want to make any other adjustments at this time, go ahead and do so. The only additional items you should change are the ones on the left under localization. We've already configured the software and system section. So we're gonna leave those alone at this point.
So let's say you might want to set the date and time. So you would click here and then choose your date and time either through the manual system or perhaps just clicking on where you're at in the world. So I'm gonna use mine as America's New York now click Done. So at this point, you're ready to start the installation. So click Begin Installation.
Now it's time to set the password on the root account. We'll be talking about the root account later in this course but for now just click on Root Password and choose a password and very important, be sure to remember that password. And if you can't think of a password then I'll suggest one for you. It's Adminuser. So I'm gonna enter that here, Adminuser and I'll re-enter it here.
As you can see, there's a little message at the bottom of this screen. And if a CentOS considers the password that you've chosen to be weak, it's going to require you to press Done twice to confirm that password. And so this particular password is weak. This is a virtual machine that no one but me will have access to. So I'm not really concerned about a strong password here. So go ahead and click Done once if you have a strong password or twice, if you have a weak password.
Now we have the option of creating a user and we want to go ahead and do that. So click on User Creation Here is where you'll enter your information for your personal account on this system. So here I'm gonna enter my name. Of course you, would enter your name. Next to make sure to click, Make this User Administrator. Now that will make it easier for you to do things on the system such as install software or other types of administrative tasks that we'll be covering later in this course.
So now we need to supply a password. So I'll go ahead and enter my password here. And again, if CentOS thinks you're using a weak password, you will have to click Done twice. From here you'll have to wait for CentOS to complete the installation process. Now that the main portion of the installation is done, we need to go ahead and reboot the system to finish up the installation. So go ahead and click on reboot now.
If CentOS was not able to detach the ISO from the virtual optical drive we'll have to do it manually. So if you see the CentOS installation screen again like we do here, don't worry. Go to the Devices Menu. Now we need to hit the Host key to get control of the mouse and keyboard. So I'm gonna hit Right Control since I'm on Windows. Again, just look in the right hand corner and you'll see the host key that you need to hit.
So from here, what we want to do is go to the Devices Menu and then the Optical Drive Sub-Menu. And you can see a check mark here next to the file that is actually connected. But what we wanna do is remove the disc from the virtual drive. So we'll go ahead and click on that. Now, as you can see in the background I've spent enough time here where the installation is starting over again, but don't worry it's not writing anything to your virtual disks, it's just starting up.
So again, no need to be concerned. So virtual box thinks that CentOS is still using the ISO. So it asks you if you want to force Unmount it and we don't want to install CentOS again. So performing the Force Unmount is exactly what we wanna do. So we'll go ahead and click Force Unmount. Now go to the Machine Menu and click Reset Machine and Reset. From here click on Reset. What this does is powers the virtual machine off and back on again.
Now we're presented with a normal installed CentOS boot screen. Here CentOS is asking us to accept the license information. So I'm gonna click inside the virtual machine to capture the mouse and keyboard. Then I'm gonna click License Information and then click I accept the agreement. Now go ahead and click Done. And finally click on Finish Configuration.
Now that the system is booted up, I'm gonna go ahead and log in as myself by clicking on My Name and next I'm going to enter the password that I chose during the installation process for my account. Now this might be different than the root password. Again, this is for your personal account. Now, of course, you are going to be clicking on your name and using your password. So this will look just a little different than what you're seeing here on the screen. I can either hit Enter or click Sign in.
Right after you log in, you'll be asked to confirm your language. English is my language and it's already selected. So I'm gonna click on Next. Here is the keyboard. And again, the default works for me. So I'm going to click on Next again. If you don't want location services enabled click the On Off switch. Personally, I'm fine with location services being enabled. So I'm going to accept the default here and click on Next again.
At this point, you can connect your online accounts. I'm going to personally skip this process. Now you can also skip it and always do this later if you decide you want to. So go ahead and click on Skip. Finally, click on Start using CentOS Linux. So what you see here is actually a tutorial for the desktop which is called Known. Of course these are optional to watch, but the tutorials are short and worth watching.
Once you're done with the tutorials, click on the X on the top right of the window to close the screen. So our job will be completely done right here if we were running Linux directly on physical hardware, such as a desktop, a laptop or a server. However since we're using a virtual machine, we can optionally perform one more step that will help Linux understand the virtual hardware that it's working with. That step is to install a piece of software called VirtualBox Guest Additions. The main benefit of installing VirtualBox Guest Additions is that the Linux desktop will conform to the shape of the virtual machine window.
So for example, now, if I change my window size I'll just drag it over here. We'll see that the Linux desktop doesn't expand or conform or stretch out to fit the window. Now, if you're happy with how CentOS looks now you can go ahead and stop here. You can also adjust the Display Settings by going to the View Menu. Then the Virtual Screen 1 Sub Menu, there you can select a scale to make the display appear larger or smaller. So let's scale it a little bit to 125 here, all right? And let's go back and scale it back down.
Now, if that scaling feature is good enough for you then again, there's no need to install the guest additions. If you're still with me and want to attempt the installation then just know that I'm about to ask you to do some complicated things that we obviously haven't covered in this course yet. So if you start to feel uncomfortable or unsure, just stop and continue with the next lesson in this course. You can always install the guest additions later, once you start feeling comfortable working on the command line.
So if you're still with me, go ahead and click on Activities in the top left of your screen. Next click on the terminal icon that's near the bottom of your screen. Now type S-U-D-O Sudo DNF install -y Elfutils E-L-F-U-T-I-L-S- lib elf which is L-I-B-E-L-F- devel, which is D-E-V-E-L. Now it's very important that you enter the command exactly as shown, make sure every letter is in lowercase. Make sure that you spell everything correctly, make sure that the hyphens are exactly where they're supposed to be. Make sure the spaces are exactly where they're supposed to be, because if you make any typing mistakes at all the command will not work.
So go slow and check your typing. When you're sure the command looks the same on your terminal as it does on mine. Go ahead and press Enter. When you're prompted for a password enter the password for your account. What this command does is installs a package that is required by VirtualBox Guest Additions. It's a dependency. If you see Complete at the end of this installation process then the installation of that package was successful as you see here on the screen.
If you see a message such as unable to find a match then there is a typing mistake in your command. So let me demonstrate what that looks like. So I'm just gonna hit the Up Arrow key and let's say I accidentally added an extra L to the end of my command. Now I'm gonna hit Enter and I get an error back that states that it was not able to find a match. So if you see that, then try the command again but correct any typing mistakes. Also, if you happen to install it twice, so let me fix my typing installation, you will actually get the same complete as your status back as well. So that's fine too.
Now that the dependency is installed it's time to insert the Guest Addition CD Image. To do that first press the Host key which is the left command on a Mac and right control on Windows, that lets your host system take back control of the mouse and keyboard. Now go to the Devices Menu and click Insert Guests Additions, click here insert Guest Addition CD image.
Now you'll see a pop-up that asks you if you would like to run the software that is on this image. And we do, so click inside the virtual machine to give back control of the mouse and keyboard. Actually, I'm gonna hit Do not show this message again because I understand how this works. So I click on Capture and then I'm going to click on Run.
Now again, you're asked for your password. So go ahead and enter it here. Again this is the password for your account not to the root account password just in case if they're different. So go ahead and click Authenticate. Now the guest additions start installing. The guest additions software requires that the development tools are installed.
So if you remember earlier, when we selected the software for the installation, we added the development tools by clicking on it and making sure that there was a checkbox next to the development tools name. So if you're having problems installing guest additions you need to make sure that development tools were installed during the installation.
Once the installation is completed you'll get a message telling you to press Return or Enter to close the window. So go ahead and press Enter. And now what we want to do is reboot the virtual machine to show you what happens when the guest additions are successfully installed. So click on the far right corner and the arrow here and click on the Power button and click on Restart. So I'm just gonna log in.
So now what should happen is if I res-size the virtual machine window the Linux desktop should re-size appropriately. So let me go ahead and just drag it over here. Let it go. And now the CentOS desktop expands to fill the entire window.
Okay, well that ends this lesson and wraps up the manual installation of CentOS.
Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.