What Do I Need?
- A Dedicated or VPS Linux Server
- CentOS
What is a Virtual Machine?
A virtual machine or VM is a virtual environment that works as a virtual computer system with its own processor, memory, network interface, and storage created on a physical hardware system, located off or on-premises. Software called Hypervisor separates the machine’s resources from the hardware so they can be actioned by the VM.
- Download CentOS ISO
Visit https://www.centos.org/download/ to download the latest version of CentOS.Only download from verifiable mirrors.
- Create a Virtual Machine
- Open ‘Hyper-V Manager’.
- Next, click ‘New’ and select ‘Virtual Machine’ from the dropdown list.
- Click ‘Next’.
- Specify Name and Location: Give your virtual machine a name and click ‘Next’.
- Specify Generation: For most use cases I would recommend sticking with the recommended ‘Generation 1’ selection and click ‘Next’. ‘Generation 1’ offers the greatest range of backward and forward compatibility across the board.
- Assign Memory: For most use cases I’d recommend sticking with the default selection unless you know for a fact that you’re going to be needing to use more memory resources. ‘Dynamic Memory’ selection will ensure that if your virtual machine needs more resources it’ll get them.
- Configure Networking: Select the shared internet connection that you want the virtual machine to use and click ‘Next’.
- Connect Virtual Disk Drive: I’d suggest not interfering with the default selections unless you have a specific use case that requires it. Click ‘Next’.
- Installation Options: Select ‘Install an operating system from a bootable CD/DVD-ROM’, then pick the option for ‘Image File’ and navigate to where you’ve stored the previously downloaded ISO of CentOS and click ‘Next’.
- Completing the New Virtual Machine Wizard: Check your defaults and click ‘Finish’.
- Finish Operating System Installation
- Double-click your newly built virtual machine from the ‘Hyper-V Manager’.
- Select ‘Install CentOS Linux 8’.
- From this point on, you’re just following the standard CentOS installation process.
Next Steps
There are a number of things to be done post-installation. If you already know about Linux, this isn’t really a problem. Otherwise, it’s time to follow along blindly. Editing large text files is a huge part of the Linux world. Many purists prefer ‘vi’, bordering on mania or zealotry; however, personally, I prefer ‘nano’. It’s infinitely easier.
sudo yum install -y nano
Then, I’d recommend enabling ‘Dynamic Memory In-Guest’. You can start by creating a ‘rules’ file. The location is important but the name isn’t. I’ll use the same one as the Microsoft instructions:
sudo nano /etc/udev/rules.d/100-balloon.rules
You’ll be prompted for your password. You’ll now be looking at an empty file in your newly installed ‘nano’ editor. Add the following command:
SUBSYSTEM==”memory”, ACTION==”add”, ATTR{state}=”online”
Now press ‘ctrl+x’ to exit, press ‘y’ to confirm, and ‘enter’ to confirm the filename. Reboot your server. At the next reboot, Dynamic Memory will be functional. Next, I’d recommend installing the ‘Extra Hyper-V Tools’. To install them:
sudo yum install -y hyperv-daemons
Change the ‘Disk I/O Scheduler’ so that it helps to optimize the disk write and read inputs and outputs. Hyper-V wants to optimize I/O too; two optimizers are infinitely worse than none and confusing as hell for the system. We should disable the default version in CentOS. Use the following commands:
su root echo noop > /sys/block/sda/queue/scheduler exit
Conclusion
There are a variety of reasons why you’d want a CentOS virtual machine. Hyper-V is a brilliant tool for virtualization and definitely the platform of choice for this and other use cases.
- Looking for the best windows hosting? Click this link and check all our recommendations.