Open main menu

CDOT Wiki β

Changes

OPS235 Lab 2 - CentOS7 - SSD

28 bytes added, 19:56, 13 June 2016
no edit summary
:: '''Boot media:''' LIVE CD Image
:: '''Installation source:''' Downloaded Centos7 LIVE CD image (http://belmont.senecac.on.ca/centos/7/isos/x86_64/CentOS-7-x86_64-LiveGNOME-1511.iso)
:: '''VM Image Pathname:''' /var/lib/libvirt/images/centos1.imgqcow2
:: '''Memory:''' 2GB
:: '''Disk space:''' 10GB
# '''Step 3 of 5:''' Set the memory to '''2048 MB''' and the number of CPUs to '''1'''
[[Image:vm-path.png|thumb|right|300px|It is extremely important to '''correctly specify the VM image file path-name'''. Double-check the spelling of the path-name before proceeding!]]
<ol><li value="7">'''Step 4 of 5:''' This next step creates a disk file that will be used to simulate the virtual machine's disk drive. Select a size of '''10 GB'''. Click on<br> '''Select managed or other existing storage''' and type the VM image file pathame:<br> '''/var/lib/libvirt/images/centos1.imgqcow2''' (make certain that the pathname is correct) and then click '''Forward''' to proceed.</li><li>'''Step 5 of 5:''' Enter the virtual machine name: '''centos1'''. Review the VM information, and click '''Finish'''.<br><br></li><li>'''The virtual machine will now start''' - start timing your installation and making notes for '''centos1''' virtual machine in the installation comparison chart in lab2 logbook. The virtual machine is running from the live disc at this point, and no software has been installed on the ''hard drive'' of the virtual machine. The point of a live disk is to allow you to test the distribution to see whether you like it without installing to the hard-drive first.</li><li>Double-click '''Install to Hard Drive'''. The installation program, similar to the one used when installing CentOS in Lab 1, will appear. You basically perform the same installation operations for this VM including for '''Date & Time''', '''Network & Hostname''', and '''Installation Destination'''. Make certain to use the '''hostname''': '''<u>centos1</u>''' as opposed to ''c7host'') for this installation. (with a few slight differences).</li><li>For '''Installation Destination''', select the destination option: '''I will configure partitioning''' and then click '''Done'''. Make certain that the '''Partition Scheme''' is set to '''LVM''' and then click on the link: '''Click to Create Automatically'''. '''Done'''. Check to make certain that the root partition has file system type: '''ext4'''.</li><li>Accept the changes and then click '''Begin Installation'''.<ol type="a"><li>You will be required to make selections very similar to what you did in lab1.</li><li>While the system is installing, take a few minutes to record your observations (including slight differences with centos1 install as opposed to c7host install).</li><li>When the installation process is complete, note the time required to install this system and record in the installation comparison chart of your lab2 logbook.<br><br></li></ol></li><li>Power-off your Centos7 LIVE system.</li><li>You should notice that the Centos7 boot menu appears. Either press '''ENTER''' to start or wait for it to start automatically.</li><li>Finish the final steps in the setup process (like you did in lab1).</li><li>#You may want to turn off the screen-saver (like you did in Lab1): [http://zenit.senecac.on.ca/wiki/index.php/OPS235_Lab_1_-_CentOS7#Customizing_Your_Account How to Turn-off Screen Saver (lab1)]</li></ol>
{| width="40%" align="right" cellpadding="10"
|- valign="top"
:: '''Boot media:''' Network installation
:: '''Installation source URL:''' http://belmont.senecac.on.ca/centos/7/os/x86_64/
:: '''VM Image Pathname:''' /var/lib/libvirt/images/centos2.imgqcow2
:: '''Memory:''' 2048MB
:: '''Disk space:''' 20GB
:: '''Installation source URL:''' http://belmont.senecac.on.ca/centos/7/os/x86_64/
:: '''Kickstart File URL:''' http://matrix.senecac.on.ca/~andrew.smith/ops235/centos7-kickstart-v01.cfg
:: '''VM Image Pathname:''' /var/lib/libvirt/images/centos3.imgqcow2
:: '''Memory:''' 2048MB
:: '''Disk space:''' 15GB
# Shut down all of the virtual machines.
# Change to the directory <b><code>/var/lib/libvirt/images/</code></b>. Note the size of the files in this directory. What do these files contain?
# Make a compressed backup of the '''centos3.imgqcow2''' file to your home directory with this command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">gzip < centos3.img qcow2 > ~YourUserId/centos3.imgqcow2.backup.gz</span></code></b><br />(Note: Make certain to use the redirection signs "<" and ">" properly in the command!)
# Compare the size of the compressed and original files (hint: use '''ls -lh'''). If file is very large (like 15GB), you didn't compress it and you need to remove that file and perform the previous step until you get it right!
# Start the '''''centos3''''' VM.
# Wreck <u>only</u> your centos3 system! Try this command inside the centos3 virtual machine:<b><code><span style="color:#3366CC;font-size:1.2em;">rm -rf /*</span></code></b> (ignore error messages).
# Shut down the centos3 VM. If you tried to start the centos3 VM, it would not boot since all system files have been removed!
# Restore the original image from the backup in your home directory by typing this command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">gunzip < ~YourUserId/centos3.imgqcow2.backup.gz > centos3.imgqcow2'''</span></code></b>
# Restart the VM. Is it working normally?
# Create compressed backups of your other virtual machines (ie. '''centos1''' and '''centos2''').
# Examine the file <b><code><span style="color:#3366CC;font-size:1.2em;">centos3.xml</span></code></b>. What does it contain? What format is it in?<br><br>
# We will now learn how to download a compressed image file and xml configuration file and add it as a VM to the virtual manager menu.
# Issue the following commands:<ul><li><b><code><span style="color:#3366CC;font-size:1.2em;">wget http://cs.senecac.on.ca/~murray.saul/ops235/practical1.imgqcow2.gz</span></code></b></li><li><b><code><span style="color:#3366CC;font-size:1.2em;">wget https://scs.senecac.on.ca/~murray.saul/ops235/practical1.xml</span></code></b><br><br></li></ul>
<ol><li value="17">Copy these files to the '''/var/lib/libvirt/images''' directory and decompress the image</li><li>Make certain your present working directory is: '''/var/lib/libvirt/images'''</li><li>Issue the command: <b><code><span style="color:#3366CC;font-size:1.2em;">virsh define practical1.xml</span></code></b></li><li>What happened in the virtual manager window? To remove a VM entry in the Virtual Manager window, simply issue the command: '''virsh undefine vm_name''' (without the '''.xml''' file extension)</li><li> Launch the VM to see if it boots-up</li><li>Can you log into this VM? Perhaps your instructor will give you a clue in week #7... >;p<br><br></li></ol>
{| width="40%" align="right" cellpadding="10"
&nbsp;do<br>
&nbsp;&nbsp;echo "Backing up VM #$num"<br>
&nbsp;&nbsp;gzip < /var/lib/libvirt/images/centos$num.img qcow2 > /root/centos$num.imgqcow2.backup.gz<br>
<br>&nbsp;&nbsp;echo "VM #$num BACKUP DONE"<br>
&nbsp;done<br><br>
&nbsp;done<br>
&nbsp;echo "Backing up VM #$numanswer"<br>
&nbsp;gzip < /var/lib/libvirt/images/centos$numanswer.img qcow2 > /root/centos$numanswer.imgqcow2.backup.gz<br><br>
&nbsp;echo "VM #$numanswer BACKUP DONE":<br>
else<br>
13,420
edits