Jump to content

How to Create a CentOS-7 Virtual Machine with Hyper-V

mesin virtual CentOS-7 status berjalan
5
(5)

For those of you who have a computer with the Windows-10 or Windows-11 operating system, You can maximize computing resources that are only available to Windows-10 or Windows-11 users with an Enterprise license, Pro, or Education.

What a great resource Windows has 10/11 Enterprise, Pro, or Education is the ability to create virtual machines using Hyper-V.

By following this comprehensive guide, You will be able to create your own CentOS-7 virtual machines with Hyper-V for a variety of uses.

What is Hyper-V?

Hyper-V is a hardware virtualization product created byMicrosoft which functions to create and run versions of computer software, which is called a virtual computer. You can read more tentang Hyper-V

Each virtual machine acts like a complete computer. With Hyper-V you can run operating systems and programs, and can run more than one virtual machine on the same hardware at the same time.

With Hyper-V, You can create and run several other operating systems at once on your computer. Besides being able to create a Windows-7 virtual machine, You can also create virtual machines CentOS-7 with Hyper-V.

What is CentOS-7?

CentOS 7 is the major version of Centos Linux and is supported until May 2027. By installing CentOS 7, You can install and run Apache web server with it. CentOS 7 often used in servers and hosting, this is because CentOS 7 safer and more stable.

Preparation

Several requirements must be met to create a CentOS-7 virtual machine with Hyper-V:

  • Windows 10/11 Enterprise, Pro, or Education
  • 64-bit processor withSecond Level Address Translation (SLAT).
  • CPU support for VM Monitor Mode Extension (VT-c on Intel CPUs).
  • Minimum memory 4GB
  • Minimum 40GB free storage space
  • Activate Hyper-V.  You can read the guide how to enable Hyper-V.
  • File ISO Image (.iso) operating system CentOS-7. In this guide using CentOS-7-x86_64-Minimal-2009.iso

Creating a CentOS-7 Virtual Machine with Hyper-V

The best step to create a CentOS-7 virtual machine on Hyper-V is to use Virtual Machine Wizard.

Steps 1: Using the Virtual Machine Wizard.

To useVirtual Machine Wizard, do the following steps:

  • Open Hyper-V Manager, if you can't find it on Start Menu try to find it via the search feature, click the search icon then type Hyper-V
  • On Hyper-V Manager, in section Action, click New -> Virtual Machine, window New Virtual Machine Wizard will open.
Hyper-V Manager
Hyper-V Manager
  • The initial appearance of the Virtual Machine Wizard. You need to make some settings so that the CentOS-7 virtual machine can run properly. Therefore click Next
Virtual Machine Wizard
Virtual Machine Wizard

Steps 2: Specifies the Name and Location of the Virtual Machine.

In this section the system asks you to specify the name and location of the virtual machine.

menentukan nama dan lokasi mesin virtual

Fill in the required sections as follows:

  • On the fieldName, type a name for the virtual machine, example: CentOS-7
  • For virtual machine location, By default the virtual machine will be created in location C:\ProgramDataMicrosoftWindowsHyper-V. You can choose to determine the location of the virtual machine yourself.
  • If you want to choose a different location, selectStore the virtual machine in a different locatioan, then select the location via the buttonBrowse..
  • After determining the location of the virtual machine, clickNextto continue

In this tutorial, I chose to store the virtual machine in a different location

Steps 3: Selecting a Virtual Machine Generation

The CentOS-7 virtual machine to be created is generation 1, therefore chooseGeneration 1 then clickNextto continue

memilih Generasi Mesin virtual
Select the virtual machine generation

Steps 4: Determining the Virtual Machine Memory Size

Just like a normal computer machine, Virtual machines also need memory to work. Therefore you need to determine how much memory you allocate to the virtual machine.

Notes: The virtual machine's memory size will increase the computer's physical memory usage when you run the virtual machine.

At this stage, do the following:

  • On the fieldStartup memory, Enter the desired number of MB, for CentOS-7 the minimum is 1GB or 1024MB, You can choose larger if your computer's memory capacity is sufficient.
  • ChooseUse Dynamic Memory. You can learn more about Hyper-V Dynamic Memory
  • Then clickNext to continue
menentukan ukuran Memori mesin virtual
Determines the memory size

Steps 5: Configuring Virtual Machine Networking

You can ignore this part and move on to the next stage. This step was selected because you have not yet created onevirtual switch. Configuring a virtual machine network is discussed separately in sectionConnecting Virtual Machines to the Network in this guide.

ClickNextto continue.

Konfigurasi Jaringan mesin virtual
Network configuration

Steps 6: Connecting a Virtual Hard Disk

Just like a normal computer machine, Virtual machines require storage space, namely a virtual hard disk, to install the operating system. Therefore you need to connect the virtual hard disk with the virtual machine.

In this guide, assume that you don't have a virtual hard disk yet, then you need to create it. At this stage, do the following:

  1. ChooseCreate a virtual hard disk.
  2. On the fieldName, type a name for the virtual hard disk.
  3. OnLocation, The system will create a virtual hard disk in the same location as the virtual machine location. You can choose another location if necessary.
  4. On the fieldSize, fill in the required measurements, minimum is 30GB
  5. Then clickNext to continue
membuat hard disk virtual
Create a virtual hard disk

Steps 7: Determining Installation Options

In this section you are asked to select a source for installing the virtual machine operating system. As prepared at the beginning, You will use an ISO Image file (CentOS-7.iso) as the installation source

At this stage, do the following steps:

  1. Choose Install an operating system from a bootable CD/DVD-ROM
  2. Choose Image file(.iso), then select the location where your CentOS-7.iso file is located via the button Browse
  3. Click Next to continue
menentukan pilihan instalasi
Determine installation options

Steps 8: Completing Virtual Machine Creation

The settings for creating the CentOS-7 virtual machine have been completed, then clickFinish to finish creating the virtual machine. The Hyper-V system will create a virtual machine according to the settings you have made.

menyelesaikan pembuatan mesin virtual
Vertual Machine Creation

At this point the process of creating a CentOS-7 virtual machine has been completed, the next step is to connect the virtual machine to the network.

Connecting Virtual Machines to the Network

By connecting the virtual machine to the network, You can utilize the resources provided by the network as well as by the machine itself. Therefore, this section is very important so it needs to be created as a separate section.

The steps required to connect a virtual machine to a network are to create new virtual switch use Virtual Switch Manager, then change the network settings on the virtual machine.

Steps 1: Using Virtual Switch Manager

To use Virtual Switch Manager, back toHyper-V Manager, then on sectionAction, selectVirtual Switch Manager

Membuka pengelola jaringan virtual
Opens virtual network manager

Steps 2: Creating a New Virtual Switch

To create a new virtual switch, in the Virtual Switch Manager display, follow these steps:

  1. In part Virtual Switches, click New virtual network switch
  2. In part Create virtual switch, click External
  3. Then click the button Create Virtual Switch
Membuat Virtual Switch
Creating Virtual Switches
  1. On the field Name, type a name for the virtual switch, example: V_LAN
  2. On Connection type, select External network, select an available network device, then click Allow management operating system to share this network adapter
  3. Click OK
Menentukan properti Virtual Switch
Define Virtual Switch properties
  1. In the confirmation dialog boxApply Network Change clickYes
Konfirmasi perubahan jaringan
Confirm network changes

Steps 3: Changing Network Settings on a Virtual Machine

After creating a new virtual switch, the next step is to change the network settings on the virtual machine.

To change settings on a virtual machine, onHyper-V Manager, right click on the CentOS-7 virtual machine name, then selectSettings, then the virtual machine settings window will appear

Membuka Pengaturan Mesin Virtual
Opening Virtual Machine Settings

In the virtual machine settings, do the following:

  1. In partHardware, selectNetwork
  2. In part Network Adapter, on the selection optionVirtual switch, select the name of the virtual switch that you created previously
  3. ClickOK

Notes: The way to change settings for each virtual machine in Hyper-V Manager is the same. In the picture attached below, the virtual machine I chose is Windows-7.

Pengaturan Jaringan pada Mesin Virtual
Network Settings on a Virtual Machine

The network setup of the CentOS-7 virtual machine has been completed. The next step is to run the virtual machine.

Running a Virtual Machine

To run, view and access the CentOS-7 virtual machine that you have created, do the following:

  1. Return to Hyper-V Manager, right click on the virtual machine name, then click Connect, then the system will display a window or screen connecting to the virtual machine.
menhubungkan mesin virtual CentOS-7
Connecting with a Virtual Machine
  1. On the CentOS-7 virtual machine screen display, You can see the current status of the CentOS-7 virtual machineOff. ClickStart to run a virtual machine
menjalankan mesin virtual CentOS-7 di layar
Button running the CentOS-7 virtual machine on the screen
  1. When you run a virtual machine, You can start and complete the process immediately installing the CentOS-7 operating system.
mesin virtual CentOS-7 sedang berjalan untuk proses instalasi
The CentOS-7 virtual machine is running for the installation process

After the installation is complete, The virtual machine will run like a normal computer

komputer CentOS-7 berjalan di mesin virtual
CentOS-7 computer running in a virtual machine

Closing

Creation of a CentOS-7 virtual machine using Hyper-V on Windows 10 have been completed. Now you can use the Centos-7 virtual machine as a virtual web server by installing the Apache web server.

In addition to creating a CentOS-7 virtual machine using Hyper-V, You can too create a CentOS-7 virtual machine with VirtualBox.

One of the advantages of Hyper-V compared to VirtualBox is that the virtual machine continues to run even if you close the connecting screen. The virtual machine will also automatically run when you restart the physical computer, as long as you don't shut down the virtual machine.

Hope it is useful.

How useful is this article?

Click on a star to rate it!

Average rating 5 / 5. Total votes: 5

No sound so far! Be the first to rate this article.

We apologize that this article was not useful for you!

Let us improve this article!

Let us know how we can improve this article?