I totally forgot I was going to do this. This is part 2 of my server build. Part 1 can be found here. So far we have the hardware, and have installed XenServer, which is a host OS that runs VMs. We installed the Management Console on a separate computer, and will be doing everything from here on out via the Management Console.
Today, I’ll show you how to setup some basic XenServer stuff and install a guest OS. Open the Management Console and log into your XenServer. The first thing you’ll need to do is add a storage repository. I guess you could install via a CD, but I haven’t done that. I just download the ISO, put he ISOs on a NAS (Network Attached Storage) and pull from that. You could also burn the ISO to a CD or flash drive. For a CD, use ImgBurn. For a flash drive, there are tons of options, but uNetBootin is the most common.
Note: For this project I’m using Linux and open sourced based software exclusively. Open Source means that anyone can edit the files, but more importantly to me, it means that it’s free. Usually. So let’s grab some ISOs. The first one we should get is the Ubuntu Server LTS. Ubuntu Server is Ubuntu but focusing on server stuff. It doesn’t come with a pretty desktop. It’s all CLI (Command Line Interface). We’re not going to work with that right now, but if you’re going to set up a lot of VMs that kind of run in the background, you’ll probably want to use Ubuntu Server for that. LTS means Long Term Support. All flavors of Ubuntu (Mate, Lubuntu, Xubuntu, etc) come out with new versions every two months. Those are supported for 18 months. The LTS is supported for 3 years. On a totally unrelated note, the newest LTS (16.04) comes out today, so I get some upgrading to do when I get home. While you can always update to newer versions, LTS is considered the “stable” build. Personally, I haven’t had any issues with using the regular builds.
I’m a big fan of Ubuntu Mate. So I downloaded the most recent version of that. Your computer’s CPU will be either x86 (32 bit) or x64 (64 bit). Mine is x64, so I downloaded that version. If you have a 64 bit processor, you can run either 32 or 64 bit guests, but if your computer is only 32 bit, it can only run 32 bit guests.
My NAS is a GoFlex Home box with 2tb of storage. I have a directory on it for the Linux ISOs. We need to get the server to look in that directory for the installation files. Back in the Management Console, click Server>New SR. Follow the prompts. In my case, I’m using a CIFS (Windows) share. This doesn’t mean you can only put Windows files there. It just means that the software that “shares” the files is readable by Windows. Enter the IP address of the NAS, not the Server. In my case, I had to add the directory. When done, you should see the CIFS library under “xenserver” on the far left. If you click on the Storage tab, you should see your shiny ISOs. One note, is that xenserver doesn’t read subdirectories, so you can’t have “Linux/Mint/mint32.iso” or whatever. All of your ISOs have to be in one directory.
Next, let’s install it. This information works just the same as if you’re installing the OS directly on a computer. You pop the disk in, click yes a bunch of times, answer a few questions, and reboot. The only difference is we are doing it in a virtual environment. Click the “New VM” button. It will give you a bunch of templates for different OSes you can install. If the one you want isn’t listed, fret not, as there is an “Other” option. Click next, give it a name, click next. When it asks you where the installation media is, you should see a dropdown including your ISO. Click that, then next twice. Now we are at the CPU and RAM screen. Give it whatever you want. My default is usually two cores and two cpus. I start with 2048 gigs of RAM, but will use a more in certain situations. Since we are just doing a test here, 2048 will work. Click next. On the Hard Drive screen, you can add more hard drive space. It defaults to 8 or 10 or something. That’s enough to install the system, but not much else. Click Add and give it 100 gigs. For Networking, just leave it alone. Click next twice, and in a few seconds, you’ll see your new VM listed on the left. Click on that, then click on the Console tab.
This is like your virtual screen into the VM. This is as if you had a monitor plugged into it. Your keyboard and mouse can control this virtual computer. Your screen resolution will probably be shit, and it might be a little slow. Go through the usual prompts and install the OS. As far as I know, every OS on the planet will restart when it’s done, and the installation image is automatically virtually ejected.
When it reboots, you should be able to control the OS just like any other computer. First, though, click on the Snapshots tab, and take a snapshot. If you screw anything up, you can revert to this moment in time. Well, the VM can, anyway.
To fix the screen resolution, we’ll need to install the XenTools. Right above the console screen, there’s a dropdown of all the images you have. Way at the bottom is xstools.iso. Click that. That “loads” the ISO as a CD into the virtual machine. Some OSes will automatically read it. Some will not, and you’ll have to restart it. Give it a few seconds. If it still doesn’t mount, restart.
Once it is mounted, open the terminal. (CTRL+ALT+T). If you’re not familiar with CLI, then this is the perfect opportunity to learn. First, we need a place to put them.
- sudo mkdir /tmp/xstools
Next we need to copy the XSTools files to that tmp location. Note that the “mnt/cdrom” might be different on your computer. It might be in /media or /dev. Also, we only need the Linux files.
- sudo cp /mnt/cdrom/Linux /tmp/xstools
Next, let’s change the directory to the new location.
- cd /tmp/xstools
Finally, we install the XS Tools. (Version 1)
- sudo ./install.sh
Or, you can install it this way. (Version 2)
- sudo dpkg -i (file name of the correct *.deb)
When done restart the VM.
- sudo shutdown -r now
If you don’t want to use the CLI, you can open the CD directory, and find the deb package for your computer (32 or 64 bit) and double click. The XS Tools ISO has installation files for Windows and most versions of Linux, so you’ll have to adapt these instructions to whichever guest you’ve installed. I use Debian based distros mostly, so I use the deb files.
When it comes back up, you should see that it is optimized on it’s General tab.
Now you can use the guest OS as any other computer. Run updates, browse the internet, change the wallpaper. Just about anything. Essentially, it is a separate computer running inside another computer. It would also be wise to take another Snapshot.
In the next episode, we’ll get into the fun stuff and setup a domain level ad blocker, and you can read me slowly descend into madness.