layout |
---|
default |
Although a number of useable appliances are available in the AppMarket to allow easily creating VMs from the UI, sometimes you may need a specific distribution or a different version that you can find on the AppMarket. In that case, you can resort to installing the operating system from scratch, as you would install it on your own laptop.
The following instructions explain how to make a VM installing the operating system from scratch, and we will be using CentOS 7 as an example.
NOTE: The VM that you will be making following this guide will be using contextualization. Make sure you have your public ssh-key configured either in your user profile or in the template, before you create your VM. That way you will be able to log into your VM with your private key.
The steps you require to create a VM from scratch are:
- Prepare the installation
- Run the installation
- Configure contextualization
- Prepare the VM for production
We will be developing these topics in the following subsections
In this section we will be setting up the environment within your project (or Group) space in the HPC Cloud. It involves:
- Creating an
image
that will be empty in the beginning, which will work as an empty hard drive where you will install CentOS - Creating an
image
with the CentOS installation media, by fetching the distribution ISO - Creating a
template
where you bring all these components together, which you can use to start a VM from
Analogously to your laptop, your VM needs a hard drive where the operating system can be installed and where it will live. We will create one here.
- On the UI: Go to the Images tab (under Virtual Resources), and click on the green [+] button (on the top-left corner of the screen) to start creating a new
image
. A form will pop up. - On the UI: On the form that popped up:
- type in a meaningful Name (e.g.: centos_drive, we will use this name later)
- type in a meaningful Description (optional)
- choose Type DATABLOCK
- leave Datastore with 104: local_images_ssd
- check the Persistent checkbox
- on the Image location: group, choose radio button Empty datablock
- and give it a Size that is meaningful to you (e.g.: in our test we used 10GB)
- On the UI: Click the green button Create on the form, to submit it. A new
image
will show on the Images list, and it will keep in status LOCKED while it is being created. When it is created it will come to status READY.
- On the UI: On the Images tab (under Virtual Resources), click on the green [+] button (on the top-left corner of the screen) to start creating a new
image
. A form will pop up. - On the UI: On the form that popped up:
- click on the gray Reset button at the bottom of it
- type in a meaningful Name (e.g.: centos_iso, we will use this name later)
- type in a meaningful Description (optional)
- choose Type CDROM
- leave Datastore with 104: local_images_ssd
- leave the Persistent checkbox unchecked
- on the Image location: group, choose radio button Provide a path; then, underneath, paste the URL of the ISO in the Path text box (e.g.: in our case, we used this one: http://ftp.nluug.nl/ftp/pub/os/Linux/distr/CentOS/7/isos/x86_64/CentOS-7-x86_64-DVD-1503-01.iso)
- On the UI: Click the green button Create on the form, to submit it. A new
image
will show on the Images list, and it will keep in status LOCKED while it is being created. When it is created it will come to status READY.
Now that we have all components ready in the UI, we are ready to bring them together. On the HPC Cloud, we do that on a template
.
- On the UI: On the Templates tab (under Virtual Resources), click on the green [+] button (on the top-left corner of the screen) to start creating a new
template
. The page will change into the Create Template screen. - On the UI: On the Create Template screen, on the General tab:
- type in a meaningful Name (e.g.: centos_setup, we will use this name later)
- type in a meaningful Description (optional)
- choose a Logo that you like
- type in (or drag the slider) 8GB of Memory
- type in (or drag the slider) 1 CPU
- On the UI: On the same Create Template screen, on the Storage tab:
- for the Disk 0 (on the left column of the screen), choose the centos_drive
image
(from the table on the right of the screen) that you created as the firstimage
of this guide - click on the + Add another disk button (that will make a new Disk 1), and then choose the centos_iso
image
you created as a secondimage
of this guide
- On the UI: On the same Create Template screen, on the Network tab:
- for the Interface 0 (on the left column of the screen), choose the internet
network
(from the table on the right of the screen) - click on the + Add another nic button (that will make a new Interface 1), and then choose your internal
network
(it will be the only othernetwork
that you can see on the right that is not called internet)
- On the UI: On the same Create Template screen, on the OS Booting tab (note! use the following boot order, otherwise, changes are not saved due to a bug in opennebula):
- for the 1st Boot field, choose HD
- for the 2nd Boot field, choose CDROM
- On the UI: On the same Create Template screen, on the Input/Output tab:
- click on the VNC radio button
- on the Inputs group, choose Tablet on the first dropdown menu, then USB on the second dropdown menu and finally click on the Add button. A new entry will appear below those dropdowns with what you just selected.
- On the UI: On the same Create Template screen, on the Context tab:
- click on Files on the left column of the screen
- make sure you check the check box for the
file
one-context_4.14.1.rpm
- On the UI: We are ready defining the
template
, so click on the green Create button at the top of the screen. A newtemplate
will show on the Templates list.
We will now create a VM and run the CentOS installation on it.
- On the UI: Go to the Virtual Machines tab (under Virtual Resources). Click on the green [+] button (on the top-left corner of the screen) to start creating a new VM. A form will pop up.
- On the UI: On the form that popped up:
- type in a meaningful Name (e.g.: centos_first)
- choose the template you defined before (i.e.: centos_setup)
- On the UI: We are ready defining the VM, so click on the green Create button at the bottom of the form. A new VM will show on the Virtual Machines list. It will go through several states (e.g.: PENDING, PROLOG...) until it reaches the RUNNING state.
- On the UI: You can then start operating within your VM. Click on the screen-like button that you can see to the right of your VM on the list. It will pop-up the VNC console, so you should be able to see the welcome screen of your CentOS installation.
Now you need to install CentOS, by following the steps you would normally follow (note, however, that at this point you have no network connection unless you define it manually).
Once your freshly installed CentOS starts, we will configure your VM so that it auto-configures itself on start up (e.g.: at this point, you can see that there is no active network connection, so you cannot even browse the web). OpenNebula deliver their own .rpm to allow contextualization, and you are able to read that .rpm from the CONTEXT CD-ROM because you added that file to the template in the previous section.
- On the VM: Open a file explorer, and browse the CONTEXT CD-ROM. You should be able to see at least 2 files on that CD-ROM. One of them should be the one we manually added to the Context tab of the
template
some steps ago, called: one-context-4.14.1.rpm. - On the VM: Open a terminal and mount the CONTEXT CD-ROM:
mount -t iso9660 -L CONTEXT -o ro /mnt
- On the VM: On the same terminal, install the .rpm file:
yum install /mnt/*.rpm
- On the VM: You can reboot your CentOS now. When it boots up, you should be able to browse the Internet now. You can also test SSH-ing into your VM with your private key.
- On the UI: You can now shut your VM down. We will remove all the installation media and prepare your VM for production.
NOTE:
Alternatively, you can use cloud-init as a contextualization configurer. CentOS has support for it via the standard yum repos, so you can install it via
yum install cloud-init
. Our tests indicate that network works, but there does not seem to be a default user configured to use public/private keys to SSH to the VM.A possible way to do it: you can first use the one-context-XXX.rpm package, reboot to let the network be contextualised, then install cloud-init and after that uninstall the one-context-XXX.rpm package.
Once you have installed and configured your CentOS, you do not need the installation media or file
s around any more. We will make a new template
to use only the disk that we need.
- On the UI: First change the image where you installed the OS from
datablock
toOS
. From theimages
tab, click on the centos_drive row and then switch Type:OS
. - On the UI: Begin creating a new
template
the usual way. - On the UI: On the Create Template screen, on the General tab:
- type in a meaningful Name (e.g.: my_research_run)
- give it as much memory and as many CPU's as you need
- On the UI: On the same Create Template screen, on the Storage tab:
- for the Disk 0 (on the left column of the screen), choose the centos_drive
image
(from the table on the right of the screen) that you created as the firstimage
of this guide, and where you have installed CentOS
- On the UI: On the same Create Template screen, on the Network tab:
- for the Interface 0 (on the left column of the screen), choose the internet
network
(from the table on the right of the screen) - click on the + Add another nic button (that will make a new Interface 1), and then choose your internal
network
(it will be the only othernetwork
that you can see on the right that is not called internet)
- On the UI: On the same Create Template screen, on the Input/Output tab:
- click on the VNC radio button
- on the Inputs group, choose Tablet on the first dropdown menu, then USB on the second dropdown menu and finally click on the Add button. A new entry will appear below those dropdowns with what you just selected.
- On the UI: On the same Create Template screen, on the OS Booting tab, you want to set some Features (click on Features on the left column):
- set in ACPI: yes
- set in Localtime: no
- On the UI: We are ready defining the
template
, so click on the green Create button at the top of the screen. A newtemplate
will show on the Templates list.
From now on, you will use this template
to run your VM.