You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
17 KiB

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Learning Website</title>
<link href="/styles/styles.css" rel="stylesheet" type="text/css">
<link href="/linux/styles/styles.css" rel="stylesheet" type="text/css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="banner">
<h1 class="courselink">Linux Overview and Installation</h1>
<h2 class="lecturer">LinkedIn Learning : Grant McWilliams : April 2021</h2>
<h2 class="episodetitle">Installating CentOS</h2>
</div>
<article>
<h2 class="sectiontitle">Creating a CentOS VM</h2>
<p>Since I am reasonably experienced with creating a new VM with Virtual Box, I will just provide a very simple step-by-step description of the process.</p>
<p>
&emsp;&emsp;1. Select New from the Machine menu.
&emsp;&emsp;2. Enter the name as CentOS 7 (note that type and version are automatically updated to reflect this choice of OS). The version of Virtual Box in the video does not have an option (at this stage anyway) to select a folder for your VM but in my case, this is already set to the folder I normally use for Virtual Box VMs so I can ignore it.
&emsp;&emsp;3. Click Next and select the amount of RAM required. The default is 1GB and the recommendation is to increase this to 1.5GB but I have 16GB available on the host machine and I don’t plan to run multiple VMs concurrently so I will select 4GB.
&emsp;&emsp;4. Click Create to create the virtual hard drive and click next, the default Hard disk file type (VDI) is fine so we can click Next again.
<strong></strong>5. The next option is Storage on physical hard disk and has two options, Fixed size which allocates space on the physical hard drive to the virtual hard drive up front and the default, Dynamically allocated which only allocates the space as it is needed and so your virtual drive will use less space. The default option is also fine here.
&emsp;&emsp;6. Click Next and select the amount of space required for the virtual drive. The default is 8GB and this is also the recommended option but I prefer to use at least 20GB so I will enter that and click Create which completes both the hard drive creation process and the VM creation process.</p>
<p>Before we do anything with the VM, we want to make sure it is optimized so to do this, we will ensure the machine is selected in the VirtualBox manager and click the Settings icon and then:</p>
<p>
&emsp;&emsp;1. Click System tab in the left-hand pane and select the Motherboard tab.
&emsp;&emsp;&emsp;&emsp;a. Under Extended Features, ensure that Enable I/O APIC is selected. For RedHat based distros such as CentOS, this enables the VM to run faster.
&emsp;&emsp;2. Click the Processor tab.
&emsp;&emsp;&emsp;&emsp;a. Here, we can increase the number of processors up to eight (if you have them available). In my case, I have 4 available so any selection greater than 4 is invalid. I will select two.
&emsp;&emsp;&emsp;&emsp;b. Ensure that Enable PAE/NX is selected. This is more important if you have a 32 bit system because it allows a 32 bit OS to address more than 4GB of memory but there are also some performance feature which will make the VM run a little bit faster.
&emsp;&emsp;3. Click the Accelerator tab.
&emsp;&emsp;&emsp;&emsp;a. Under Hardware Virtualization, ensure that both Enable VT-x/AMD-V and Enable Nested Paging are selected, both of which can improve virtualisation performance.
&emsp;&emsp;&emsp;&emsp;b. It might also be possible to select a different hypervisor. If this is left as default, VirtualBox will try to select the best option and this is fine but note that Hyper-V is the best option for Windows and KVM is the best option for Linux so you will want to ensure that if you have one of these selected, it is selected for the right operating system.
&emsp;&emsp;4. Click Display in the left-hand pane and select the Screen tab.
&emsp;&emsp;&emsp;&emsp;a. We want to increase the video memory and I will select 128MB here.
&emsp;&emsp;&emsp;&emsp;b. Select Enable 3D Acceleration. Most modern Linux desktops require 3D acceleration to run but under Linux VMs, 2D and 3D acceleration at the same time is not supported and you will see an error message if you try to select both so make sure Enable 2D Acceleration is not selected.
&emsp;&emsp;5. Click Storage in the left-hand pane.
&emsp;&emsp;&emsp;&emsp;a. Select the SATA hard disk controller. Later, we will add additional disk drives and we will do that here by clicking the plus sign on the SATA controller.
&emsp;&emsp;6. Click Network in the left-hand pane.
&emsp;&emsp;&emsp;&emsp;a. We aren’t going to make any changes but note that the default option is for Network Adapter 1 to be attached to the NAT. This allows the VM to access the Internet but does not allow remote logins. If we want to enable remote logins, we would need to change this to Bridged Adapter.</p>
<p>That completes our customisation and we can move on to installation of the guest operating system.</p>
<h2 class="sectiontitle">Install CentOS Linux from DVD ISO</h2>
<p>We can download CentOS with the download link in appendix A. Before we proceed with the installation, however, we want to clone our machine so that if we want to set up additional machines such as a web server later, we have a machine already customised that we can install the server software on. I have also renamed the existing machine as CentOS Base System for easy identification.</p>
<p>To start the process, we simply select the machine in the VirtualBox manager and then from the Machine menu, select Clone.</p>
<p>The options here are different to those in the video where the only option is to enable Reinitialize the MAC address of all network cards which you would select to ensure that each machine you clone has its own MAC address. This is shown below.</p>
<img src="images/figure2.png" alt="the Clone Virtual Machine wizard from the course video">
<p>This is the same wizard from my own install of VirtualBox.</p>
<img src="images/figure3.png" alt="the Clone Virtual Machine wizard from my own install of Virtual Box">
<p>Note that in figure 3, the MAC Address Policy shown is not the default but I have selected it because it meets the same goal of ensuring a unique MAC address and I have left the Path as the default option since the course video does not cover this (note that this option is not shown in the first Clone Virtual Machine image shown above) and this applies to the additional options as well.</p>
<p>If we click Next, we will see that there are two options, Full Clone and Linked Clone. Full Clone ensures that we have an independent VM that can be backed up and saved independently from the original VM so we will ensure this is selected and click Clone to complete the process.</p>
<p>We can now select the VM (CentOS Full DVD) and click Start and we will be prompted for the startup disk and we can click the folder icon to navigate to the location of the ISO file we downloaded and we can click this and select Open and then Start.</p>
<p>Note that Right Click is shown in the bottom left and this is our host key. We want to switch to full screen which we do with Host Key + F. Then we select Install CentOS 7 and press enter.</p>
<p>The first thing we are asked to do is confirm the language and the default is English (United States) so I will switch this to English (United Kingdom) and click Continue. A dialog box pops up as shown here.</p>
<img src="images/figure4.png" alt="a dialog box relating to mouse capture by the VM">
<p>This allows the mouse pointer to be set to the VM and gives a more natural experience so I will select Capture and the next thing that appears os the Installation Summary. </p>
<p>To start with, we can set Date &amp; Time to our locale which is UK and then click on Software Selection which defaults to minimal install which actually installs just a command line interface. We will instead select Server with GUI which is still a pretty basic install. We could also install a desktop such as Gnome or KDE but bear in mind that anything you can install here can be installed later as and when it is needed. </p>
<p>Next, we will click on Installation Destination and we could select Automatically configure partitioning, particularly if we only want one partition on the VM but in this case I will select I will configure partitioning so that we can see the process.</p>
<p>We will click on Done and then click on and we can see that there are no partitions so we can click on Click here to create them automatically. This generates the partitions shown in below. </p>
<img src="images/figure5.png" alt="the partitions created by the installer">
<p>We can see that there are 3 partitions. The boot partition is where the kernel and boot files will be installed and there is a swap partition which will be used for virtual memory. The rest of the operating system is installed on the larger partition and any additional software we install will normally go in this partition as well. We can look at the partitions here and make some edits if required but everything looks fine so I will click done. This brings up a list of the changes which wil be made by the partitioning software so we can examine this is if we want and we can click Accetp Changes. Note that the Begin Installation button had not previously been enabled but it is now so we can click it to start the process.</p>
<p>We now have the opportunity to set up a password for the root user and create a new user and I will do both.</p>
<p>It is quite important to ensure that for this user, the option, Make this user an administrator is selected because this user will act as the administrator for the rest of the course and if this option is not selected when the user is created, it can be quite difficult to fix this later.</p>
<p>We can now continue with the installation and we will be asked to reboot the machine. Once the reboot has been done, we must then accept the license agreement so we select 1 followed by enter and then 2 followed by enter and then ‘c’ to continue and ‘c’ to continue again.</p>
<p>Next, we will see the login screen for the user we created and we can enter the password and click login. We will be asked to confirm the language and keyboard settings so I just need to make sure these are correct and we can click Next when we are happy with these settings and this will bring up the Ready to Go window so we can click Start Using CentOS Linux and we can just close the Getting Started window.</p>
<p>Actually, the process was slightly different for me in that the licence agreement was presented graphically and I just needed to click the box to indicate acceptance of the agreement and when I logged in, there were a couple of additional options relating to location which I switched off and the option to connect to an online account such as Google which I skipped and I didn’t see the Ready to Go window. </p>
<p>Presumably these are simply changes due to the fact that I have a slightly later version of CentOS but when that’s finished I have a fully working CentOS Linux VM and I can see the same basic desktop as in the course video. </p>
<h2 class="sectiontitle">Install CentOS Linux from a Network</h2>
<p>Installing CentOS from a DVD in this way is, of course, only one of the ways to install it (or any operating system). Another way is to install over a network which we will do now. To do this, we will need to download another version of CentOS so from the download page (see appendix A) we will notice that there is a link to ISOs available via Torrent and we will click this link. </p>
<p>Next, we need to select a mirror and download the net install iso. In VirtualBox, we will clone our base machine and call it CentOS 7 Net Install and as before, we will select Generate new MAC addresses for all network adapters and select full clone. </p>
<p>As before, when we start up the machine, we are asked for a startup disk and we can navigate to the folder with the download in and select the net install iso. The installation process is the same as before until we get to the Installation Summary. We can set date &amp; time in the same way as the previous install but the installation source will be different but before we can set this for a net install, we will have to set up networking. </p>
<p>To do this, we scroll down and select Network &amp; Host Name and we just need to turn the network on and click Done. We will then select Installation Source and ensure On the network and http:// are selected and we will then type in the url as mirror.centos.org/centos/7/os/x86_64/ and click Done. If we are able to successfully connect to the mirror site we should see a confirmation to this effect under Installation Source after a few moments. </p>
<p>Again, we will select Server with GUI under Software Selection and we will then Installation Destination and follow the same method of selecting I will configure partitioning and again this is just so that we can see the partitions that are being created. </p>
<p>We can then click Begin Installation and when prompted, we will again create a password for root and a new user with administrator privileges. </p>
<p>The procedure for accepting the licence agreement is the same as for the previous installation. </p>
<h2 class="sectiontitle">Virtual Machine Snapshots</h2>
<p>A snapshot is a copy of the state of the machine including any installed applications at any given time. Typically, this might be used to store the state of the machine before carrying out some updates to either the OS or the installed applications or installing new applications. If something goes wrong, you can simply roll-back to the previous state by restoring the snapshot.</p>
<p>To create a snapshot by pressing the host key + t and entering a name and, if you like, a description. Now, if you minimize the VM (or at least exit full screen) you will normally see the dialog box shown here.</p>
<img src="images/figure6.png" alt="the dialog box typically seen when closing the VM">
<p>In this case, there is no snapshot to be restored. The image below shows the same dialog box (actually from a different VM) and in this case there is a snapshot.</p>
<img src="images/figure7.png" alt="the dialog box seen when closing the VM and there is a snapshot available">
<p>Note that the option to Restore current snapshot ‘…’ may be initially disabled because it can only be selected if you have selected the option to Power off the machine.</p>
<p>When you save the state of the machine, you are also saving the state of the desktop and this includes any running applications. You may also notice that if you close the machine and restore the snapshot, this can happen very quickly since the VM hasn’t actually rebooted the OS, it has simply restored the state.</p>
<p>For anything more complex with snapshots, we would use the VM manager. This is slightly different on my version of VB. On the video, when a VM is selected in the left-hand pane, the toolbar to the right shows options you can click for Details or Snapshots and shows the number of available snapshots in brackets. On my VB Manager, this is not present but there is a drop down menu next to the VM in the left-hand pane (see figure 8) and from here, we can select from Details, Snapshots or Logs.</p>
<img src="images/figure8.png" alt="the drop down menu which can be accessed for any VM in the left-hand pane in the VirtualBox manager">
<p>Note that the option for Snapshots will appear in this menu regardless of whether one is available or not and if you select Snapshots you will see all available states of the machine (that is, the machine itself and any additional snapshots). From here, you can also create new snapshots, delete snapshots and so on.</p>
<p>It is also possible to restore a snapshot from here but this option will be disabled if the machine is currently running. Assuming it is not, we can select any snapshot and click restore. This will bring up the dialog box shown here.</p>
<img src="images/figure9.png" alt="the dialog box seen when restoring a snapshot from the VirtualBox manager">
<p>As you can see in, there is an option to create a new snapshot with the machines current state before restoring but if we just want to roll back we can uncheck this and click Restore.</p>
</article>
<div class="btngroup">
<button class="button" onclick="window.location.href='before.html';">
Before Installing
</button>
<button class="button" onclick="window.location.href='postinstallation.html';">
Postinstallation
</button>
<button class="button" onclick="window.location.href='appendixa.html';">
Appendix A
</button>
<button class="button" onclick="window.location.href='linuxoverview.html'">
Course Contents
</button>
<button class="button" onclick="window.location.href='/linux/linux.html'">
Linux Page
</button>
<button class="button" onclick="window.location.href='/index.html'">
Home
</button>
</div>
</body>
</html>