CentOS 7 Server Install

Infrastructure Tutorials

Download CentOS 7 Server Install tutorial.

In this tutorial, I will be demonstrating a CentOS 7 install using VirtualBox 6.1.2 on a Windows 7 Pro SP1 host machine. Please note that I will be using a CentOS 7 minimal ISO image to perform a server install of CentOS 7. This means no GUI will be available post install.

I have another tutorial demonstrating the installation of the MATE desktop environment, accessible here.

Refer to the prerequisites listed below to access the download locations of the resources needed to complete this tutorial.



Prerequisites

  • VirtualBox 6.1.2 & VirtualBox 6.1.2 Extension Pack
  • CentOS 7 minimal ISO image can be downloaded here
  • Active Internet Connection

For instructions on how to install VirtualBox and extension pack, see my VirtualBox Install tutorial here.

Steps to complete tutorial:
  1. Install VirtualBox 6.1.2
  2. Download CentOS 7
  3. Create virtual machine
    1. Name and OS
    2. Memory Size
    3. Create Hard Disk
    4. Attach CentOS 7 ISO Image to VM
  4. Install CentOS 7
  5. Take Snapshot


Install VirtualBox 6.1.2

If you already have VirtualBox 6.1.2 installed, go to the next step. Otherwise, please see one of my other tutorials,
VirtualBox Install, accessible here, where I demonstrate the installation of VirtualBox 6.1.2, as well as, the same version extension pack.

Download CentOS 7

Click the following link to download CentOS 7 minimal ISO image. It will be downloaded to your local Downloads directory.

I have moved my downloads to a location where they can be easily accessible. Note, I have downloaded three versions: DVD, Minimal and NetInstall. Their sizes differ because they contain different contents. Below, I’ve listed the main differences:

  • DVD – full install including GUI desktop environment
  • Minimal – usually for server installations that require manual configurations
  • NetInstall – boot DVD for installing from a network server


Create virtual machine

Now that we have our CentOS 7 minimal ISO image, we will create a virtual machine to be used for the CentOS 7 install.

Please note that if you have just installed VirtualBox 6.1.2, you will only see Tools on the left-hand side of the VirtualBox Manager interface. I have already created a number of VMs (virtual machines) and grouped them for organizational purposes.

On the VirtualBox Manager interface, click the New button to start the creation of a new virtual machine.



Name and OS

The Create Virtual Machine screen appears.

  • Give your VM a name (I named my VM: centos7-VM)
  • Choose where you want the machine created on your host system
  • Please note, you can change the destination folder (Machine Folder:), if the default does not work for you.
    This will be where the virtual machine files are stored on your host system.
  • Ensure Type is set to Linux and Version is set to Red Hat (64 bit), click Next



Memory Size

The next screen asks for the amount of memory (RAM) you wish to allocate to this machine.
Since we are performing a minimal server install, 1024MB (1GB) of RAM is sufficient. Click Next



Create Hard Disk

Now we must create a virtual hard disk where the CentOS 7 operating system will be installed.
Note the recommended size (8 GB) of a virtual hard disk for CentOS 7. Click Create



Now, you will have to choose the type of virtual hard disk. Select VDI and click Next

VDI: Oracle VirtualBox container format for guest hard disks
VHD: Microsoft container format
VMDK: VMWare container format



We can now choose whether the virtual hard disk takes up the size we allocate as needed (Dynamically allocated) or immediately (Fixed). To save space on my host system, I will be choosing Dynamically allocated and clicking Next



Here we can set the virtual hard disk size. Note it’s name and storage location.
Again, since we’re performing a minimal install, 8.00GB is enough. Click Create



As you can see below, the centos7-VM virtual machine was successfully created.
Again, please note that, as I mentioned earlier, our VirtualBox Manager interfaces (left side listing VMs) will not be identical because I already have a number of grouped virtual machines.



After creating my virtual machine I was brought to the VirtualBox Manager interface's Snapshots view. If you are already in the Details view, you can just read on to see how to switch views.

To switch to Details view, click the list icon next to the virtual machine name, and select Details.

The Details view will provide you with a listing of all the configurable components of the VM.



Attach CentOS 7 ISO Image to VM

Now we will configure the VM’s optical drive with the CentOS 7 minimal ISO image we downloaded earlier.
On the VirtualBox Manager interface, ensure your newly created VM is selected and click the Settings button.



In the VM Settings dialog box, on the left, select Storage. You’ll notice that the virtual optical drive is Empty.
Ensure the Empty optical drive is selected. Then, on the right, ensure IDE Primary Master is selected. Then, click the optical drive icon and click Choose a disk file to select the Centos 7 minimal ISO image that was downloaded as a prerequisite for this tutorial.
Please note that if you do not set the VM’s optical drive to IDE Primary Master, and you leave the default of
IDE Secondary Master, when you start the VM you will be prompted to attach a disk file to begin the installation.



Browse to where you’ve downloaded the CentOS 7 minimal ISO image, and click Open



By attaching the CentOS 7 minimal ISO image to the virtual machine’s optical drive, our installation media is set and we are now ready to start our new VM (virtual machine) and begin the installation of CentOS 7.



Install CentOS 7

On the VirtualBox Manager Interface, ensure your new VM is selected and click Start



Friendly Reminder:
During installation, if at any time you need to exit the guest (virtual machine) interface and return to the host machine interface, hit your Host key (for Windows 7, it’s the right Ctrl key). Check the bottom right-hand corner of the virtual machine's interface (see image below)



Even if you’ve set your VM’s optical drive to IDE Primary Master, you might still be prompted with the Select start-up disk screen on start-up. If you are, just click Cancel to continue.



Next, navigate up to Install Cent0S 7 and, on your physical keyboard, hit the Enter key to begin the installation.



Select your desired language and click Continue



On the Installation Summary page, we need to configure a few settings before we can begin the installation.




Localization:
  • timezone, keyboard and language
Software:
  • Installation source and software selection
System:
  • Installation destination (includes partitioning)
  • Network & Host name
  • KDump & Security Policy

Please note that before we begin making the required pre-installation configuration changes, I will be referring to the items listed on the Installation Summary page (see items above OR image below). Also, if the correct item value is already set, you do not need to change it.

According to my Installation Summary page, only two items need to be configured. Under the System section, they are Installation Destination and Network & Host Name.

If your Installation Summary page is the same as mine, please skip to the System section.

If your Installation Summary page is different than mine, links to each section are available here:
Localization, Software and System




To be thorough, we will go through each configuration screen for every item that is listed on the Installation Summary page. That way you will become familiar with a CentOS 7 installation.

Localization

To set your timezone, from the Installation Summary page, click Date & Time.



Make your change, if needed, and click Done.



To set your keyboard, from the Installation Summary page, click Keyboard.



Make your change, if needed, and click Done.



To set your language, or to add language support, from the Installation Summary page, click Language Support



If needed, set your language and add support for other languages and click Done.



Software

Next, from the Installation Summary page, under Software, click Installation Source.



If needed, make your changes and click Done.
In my case, the Installation Source was auto-detected as local media (CentOS 7 ISO image attached to VM).



Since we are using a CentOS 7 minimal ISO image, the Software Selection is set to Minimal Install.
But, again, to be thorough, from the Installation Summary page, under Software, click Software Selection



Only the packages for a CentOS 7 Minimal Install are included in the minimal ISO image we are using.
To continue, click Done.



System

Please note that the following CentOS 7 pre-installation configuration is required.
From the Installation Summary page, under System, click Installation Destination.



Ensure the virtual hard disk we added while creating the virtual machine has been detected and that
Automatically configure partitioning is selected. When finished, click Done.



For this tutorial, we will not be manually creating our partitions. This will be done automatically for us.
The /boot, / (root) and swap partitions will be created. The / (root) and swap partitions will reside in separate
LVM logical volumes using the xfs file system, while, the /boot partition will also use the xfs file system
but will be on a standard partition.


Please note that the following CentOS 7 pre-installation configuration is required.
From the Installation Summary page, under System, click Network & Host Name



We will have to configure our IP address information and hostname. First, ensure the network adapter is selected and enable it by changing the toggle switch, on the right, from OFF to ON. This will ensure that our VM receives an IP address, subnet mask and default gateway from VirtualBox’s DHCP service (usually 10.0.2.15 /24).
Second, enter the host name. To keep it simple, I entered centos7-VM and clicked Apply. Finally, click Done.



For this tutorial, we will leave KDump enabled. To be thorough, let’s open the configuration screen.
From the Installation Summary page, under System, click KDump

KDump captures information during a kernel crash and the information can be used to determine the cause.



When you are done, click Done



We will not be setting a Security Policy. Again, to be thorough, let’s open the configuration screen.
From the Installation Summary page, under System, click Security Policy

When no security policy is set, the sshd and firewalld services are active, and running. Remote access using ssh is allowed through the firewall.



When you are done, click Done



We are now ready to begin the installation of CentOS 7. Click Begin Installation



The installation has begun. We will need to set the root user’s password, as well as, create a non-root user.



First, to set the root user’s password, click Root Password



Enter the root user’s password and click Done. Notice the warning message at the bottom of the screen.
This is because I used a weak password. To bypass this warning, all we have to do is click Done, twice.



Now, to create a non-root user, click User Creation.



Enter the non-root user’s details. Next, check the box to Make this user an administrator and click Done.
Again, notice the warning message at the bottom of the screen. This is because I used a weak password.
To bypass this warning, all we have to do is click Done, twice.



Since we are installing a minimal version of CentOS 7, the installation process will not take very long (15-20min)



Once the installation has completed, click Reboot



CentOS 7 is starting and we are seeing the kernel being used during the boot process.



Our CentOS 7 VM has rebooted successfully and we see the login screen.



At the login screen, enter the username, and password, of the non-root user you created during the installation.



We have logged in successfully. Now, we will shutdown the virtual machine.
To do this, the non-root user (in my case, liam) must have sudo (“superuser do”) privileges. Since we set this non-root user
to be an administrator, this non-root user has sudo privileges and can execute the following command:
sudo shutdown -h now



We are prompted for the non-root user’s password to confirm that we want to execute this command.
What we are doing is executing a command with the privileges of the root user.

Again, this is the reason we set our non-root user to be an administrator, so that the user has sudo privileges
and can execute commands normally only executable by the root user.

To reiterate, the command, sudo (“superuser do”), is allowing your logged in user, who is a non-root user,
to execute the command, shutdown, which can only be executed with the privileges of the root user.

Finally, after executing the command, the VM (virtual machine) will shutdown and we can return to the VirtualBox Manager interface.



We have successfully installed a minimal version of CentOS 7 (release 8) in a VirtualBox 6.1.2 virtual machine.


Take Snapshot

To be on the safe side. After I have successfully completed a task, such as installing or updating a virtual machine, I like taking a snapshot to preserve the VM’s state. That way I ensure, in the future, if the VM stops responding, or behaving as it should, I can always revert back to that snapshot. For further information on VirtualBox Snapshots, refer to the docs, here.

In the VirtualBox Manager interface, we are currently in Details view. To switch to Snapshots view, click the list icon next to the virtual machine name, and select Snapshots.



To take a snapshot, on the VirtualBox Manager Interface, ensure your VM is selected and click Take



Enter a name for the snapshot, as well as, a short description,
then, click OK

I've taken a snapshot POST-CentOS7-MINIMAL-INSTALL
to ensure that I have a starting point to revert back to,
if needed.


We have successfully taken a snapshot and ensure that we can always revert back to a working virtual machine with a minimal version of CentOS 7 (release 8) installed.

Hopefully, you’ve enjoyed completing this tutorial and found it helpful.

After completing this tutorial, if you decide that you would like, or need, a desktop environment, you should consider
the MATE Desktop. It uses minimal system resources.

I have another tutorial that demonstrates the installation of the MATE Desktop on a CentOS 7 minimal install VM.
It can be accessed here.

Or, you can access all of my tutorials here.

Finally, if need be, you can download this tutorial CentOS 7 Server Install.