In our process of setting up a database cluster, we are going to need multiple machines each with a database instance installed. As a reminder, these instances are called nodes. To save time and resources, we are going to be using virtual machines for each one of our nodes.
To do this we are going to need to install VirtualBox.
Once we have VirtualBox installed, we need to download the operating system. Now, if you are learning this material to apply it to a production environment, you will want to make sure a particular clustering software is available on the right operating system. For example, the Oracle Galera cluster is currently not offered on odd versions of Ubuntu;it is only offered oneven versions.
Installing the Operating System
Now we are actually going to make three virtual machines, but you don’t have to go through this entire process all three times. Once you have one completely set up, you can do a full clone and skip the installation process (you will need to remember to reinitialize their MAC address, which I will show you how to do).
To install our first virtual machine, we are going to need on operating system.
You can download an operating system in a file, and this file will be of the type .iso. An ISO is an operating system image.
The operating system that I’m going to use is called Ubuntu.
Creating a Virtual Machine
Once we have Ubuntu downloaded, we can begin building our virtual machines.
Go to VirtualBox and click New.
Now give the virtual machine a name. Because we will be cloning this virtual machine, it is best to give it a general name. Also, select the operating system. In our case, we’re using Ubuntu which is a type of Linux. Then click Continue.
Now choose the amount of memory you want to allocate. I set mine at 4096 MB. Click Continue.
Select Create a virtual hard disk now, and then click Continue.
We’ll want to select Dynamically allocated for our virtual hard disk file. By doing this the virtual hard disk will only take up as much space as it needs, and, thus, save you space on your laptop. Once again, click Continue.
Now we will need to determine the max size of the virtual machine disc. I’ve had trouble with this part before, so let me clarify. This is not the size you will start out with. This is the max size that the virtual disk will cap out at. So, it is important that you give it a large size; I recommend giving it 50 GB, at least.
Now click Create.
You should now be able to find it in the left side menu.
Setting Up Ubuntu
Now click Start in VirtualBox.
Now it will ask you to give the Ubuntu ISO that you downloaded. So, click the little folder icon and then find the .iso file.
Once you find it, click it, press Open, and then press Start.
Now it will begin setting up the virtual machine.
Once this is done loading, there will be seven pages to go through for installation.
As you go through these pages, it will ask you whether you want to try or install Ubuntu. We want to install, so click Install Ubuntu.
Also, make sure you select Download updates while installing Ubuntu.
Make sure you select Erase disk and install Ubuntu. Don’t worry, this specifically refers to the virtual disk you just created. It does not have access to the actual hard drive on your computer and won’t affect any of the data on it.
The rest of the installation process is pretty straightforward, so I’ll let you do that on your own.
At the end of the installation process you will be asked to name your virtual machine, make a user name, and create a password. Fill this out and click Continue.
Once this is done, click Restart Now.
When you get to the screen that says “Please remove the installation medium,” press ENTER on your keyboard.
The Ubuntu desktop is now set up!!!
In the next blog, we will finish setting up Ubuntu, clone this machine, and set up the networking in VirtualBox.