Installing XCP-ng is a relatively straight-forward process. Just download the ISO from the Official Website, mount it onto a USB, then load and install it onto your host server. The steps on XCP-ng are very easy to follow.
The main issue of XCP-ng arises with actually setting up Virtual Machines. That's what we'll focus all of our attention on.
After installing XCP-ng, you'll be given the IP of the server which you'll use to remote into it with the Port number 22 (default). We do want to change this default port as a very basic security measure. It doesn't make it more secure by definition but it does reduce the amount of pajeet-ware detections where they spam IP addresses with Port 22 until they get a hit.
1vi /etc/ssh/sshd_config
Just add Port 2222, or something similar (assuming that's the custom port number you want to use), or uncomment the current Port line and put your custom port.
This seems specific to XCP-ng but we also need to add our port in the iptables as well before we restart SSH.
xxxxxxxxxx
11iptables -I INPUT -p tcp --dport 2222 -j ACCEPT
And we just need to save the changes we just made to iptables:
xxxxxxxxxx
11service iptables save
Finally we can restart SSH as usual:
xxxxxxxxxx
11systemctl restart sshd
Unlike XenOrchestra, we can't just upload our ISO to it and use that uploaded ISO to mount to our VM. We have to create storage areas that store our ISO files from which we'll pull them from. What we'll do here is create a folder in which to store our ISO files and then link it to XCP-ng.
xxxxxxxxxx
11mkdir /var/opt/iso
xxxxxxxxxx
11xe sr-create name-label="Local ISO" type=iso device-config:location=/var/opt/iso device-config:legacy_mode=true content-type=iso
Once that's created, we can put our ISO files into this folder and mount ISOs to new VMs. I did have an issue before when using that script above and that was because I accidentally forgot the 'o' at the end of "iso" in that command. If you want to be sure you have everything setup correctly, you can use the command below to look at your storage scopes:
xxxxxxxxxx
11sudo xe sr-list
You should see the type and content-type as ISO for our Local ISO scope.
In order to actually transfer files to this machine, we can use an easy-to-use graphical tool such as WinSCP to transfer the ISO files into that "/var/opt/iso" folder.
When you start WinSCP you use the same IP, user root, and password that you used for SSH when working in WinSCP.
If you have any internal HDDs you want to mount and use, you'll have to add those here, too. First we'll list our disks to see what "sdX" we're going to use. For instance, is it "sda" or "sdb" or "sdd" or maybe it's something else entirely.
xxxxxxxxxx
11lsblk
Now just put that "sd?" into the code below. Keep in mind the name Local HDD which you can rename to anything you want. That will be important later.
xxxxxxxxxx
11xe sr-create type=lvm content-type=user device-config:device=/dev/sdX name-label="Local HDD"
Remember that sdX refers to the actual drive itself and NOT a partition. If your drive has any partitions, make sure to use a tool like fdisk to delete them all.
This is the user we'll create for working within XCP-ng Center and for future SSH connections. I left this for last to not have to deal with any SUDO stuff. Plus, it would've been confusing if I said to create the user and then I had the user log in as root on WinSCP anyway.
xxxxxxxxxx
11useradd nguser
xxxxxxxxxx
11passwd nguser
xxxxxxxxxx
11usermod -aG wheel nguser
xxxxxxxxxx
11su - nguser
The command above just switched us to user after it was created and added to the SUDO group. The bottom command checks to make sure we properly switched to our user. Since we're using the username nguser, the output for the command below should be exactly that.
xxxxxxxxxx
11whoami
Lastly, we want to make sure our user has root privileges. The output for the command below should be root.
xxxxxxxxxx
11sudo whoami
Once it's installed, log into the server using the IP Address and the user credentials we just created previously. From here, you should see the XCP-ng server along with the storage scopes we created.
https://files.catbox.moe/jyjbop.mp4
The video above is me setting up a Windows Server Virtual Machine with the instructions provided here. I received an error at the end about HVM because I was running XCP-ng within a Virtual Machine.
Keep in mind our Local HDD and Local ISO directories we created since this is important when creating a new VM.