What Do I Need?
- [tool]A Dedicated or VPS Linux Server[/tool]
- [tool]CentOS[/tool]
What is a Virtual Machine?
[openingText]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.[/openingText]
- [stepName]Download CentOS ISO[/stepName][step]
Visit https://www.centos.org/download/ to download the latest version of CentOS.Only download from verifiable mirrors.[/step]
- [stepName]Create a Virtual Machine[/stepName][step]
- [howToDirection]Open ‘Hyper-V Manager’.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]Next, click ‘New’ and select ‘Virtual Machine’ from the dropdown list.[/howToDirection]
- [howToDirection]Click ‘Next’.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]Specify Name and Location: Give your virtual machine a name and click ‘Next’.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]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.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]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.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]Configure Networking: Select the shared internet connection that you want the virtual machine to use and click ‘Next’.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]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’.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]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’.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]Completing the New Virtual Machine Wizard: Check your defaults and click ‘Finish’.[/howToDirection][/step]
- [howToDirection]Open ‘Hyper-V Manager’.[stepImage]
- [stepName]Finish Operating System Installation[/stepName][step]
- [howToDirection]Double-click your newly built virtual machine from the ‘Hyper-V Manager’.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]Select ‘Install CentOS Linux 8’.[stepImage]
[/stepImage][/howToDirection]
- [howToDirection]From this point on, you’re just following the standard CentOS installation process.[/howToDirection][/step]
- [howToDirection]Double-click your newly built virtual machine from the ‘Hyper-V Manager’.[stepImage]
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.
