102.6 Linux as a virtualization guest

Description

102.6 Linux as a virtualization guest
Rolando Martinez
Mind Map by Rolando Martinez, updated more than 1 year ago
Rolando Martinez
Created by Rolando Martinez over 3 years ago
6
0

Resource summary

102.6 Linux as a virtualization guest
  1. Introduction
    1. 1.-Virtual machine 2.- Linux container 3.- Application container 4.- Guest drivers 5.- SSH host keys 6.- D-Bus machine id
      1. Conceptos
      2. to use Linux as a means of hosting other operating systems,
        1. versatility
          1. hability
            1. great strengths of Linux
              1. isolated and secure environment
                1. the concepts of virtualization and container technologie
              2. Virtualization Overview
                1. Virtualization
                  1. Hypervisor
                    1. sotfware platform that allows to run processes that contain a fully emulated computer system.
                      1. is responsible for managing the physical hardware’s resources that can be used by individual virtual machines.
                        1. guest
                      2. Virtual Machine
                        1. A virtual machine has many aspects of a physical computer emulated in software
                          1. System Bios
                            1. Hard Drive Disk Controllers
                            2. often use hard disk images
                              1. stored as individual files,
                              2. will have access to the host machine’s RAM and CPU through the hypervisor software.
                          2. Commonly used hypervisors for Linux include:
                            1. Xen
                              1. Type-1 hypervisor
                                1. not rely on an underlying operating system to function.
                                  1. bare-metal hypervisor since the computer can boot directly into the hypervisor.
                              2. KVM
                                1. both Type-1 and Type-2
                                  1. although it needs a generic Linux operating system to work,
                                    1. it is able to perform as a hypervisor perfectly well by integrating with a running Linux installation
                                    2. use the libvirt daemon and associated software utilities to be created and managed.
                                    3. VirtualBox
                                      1. t is a Type-2 hypervisor.
                                        1. VirtualBox requires an underlying operating system to run
                                    4. migration,
                                      1. Some hypervisors allow for the dynamic relocation of a virtual machine
                                        1. Implemets
                                          1. system shutdown
                                            1. system Runs
                                            2. The process of moving a virtual machine from one hypervisor installation to another
                                          2. Types of Virtual Machines
                                            1. Fully Virtualized
                                              1. no additional software drivers are installed within the guest to translate the instructions to either simulated or real hardware
                                                1. All instructions is expected to run
                                                  1. is unaware that it is a running virtual machine instance
                                                    1. to take place on x86 based hardware the Intel VT-x or AMD-V CPU extensions
                                                      1. Configured Bios
                                                    2. Paravirtualized
                                                      1. is aware that it is a running virtual machine instance.
                                                        1. make use of a modified kernel and special drivers (known as guest drivers
                                                          1. will help the guest operating system utilize software and hardware resources of the hypervisor
                                                          2. The performance of a paravirtualized guest is often better than that of the fully virtualized
                                                          3. Hybrid
                                                            1. Paravirtualization and full virtualization can be combined
                                                              1. to allow unmodified operating systems to receive near native I/O performance by using paravirtualized drivers on fully virtualized operating systems.
                                                                1. The paravirtualized drivers contain
                                                                  1. Storage Drivers
                                                                    1. Network Drivers
                                                                      1. with enhanced disk
                                                                        1. network I/O performance.
                                                                  2. Virtualization platforms often provide packaged guest drivers for virtualized operating systems.
                                                                    1. . The KVM utilizes drivers from the Virtio project
                                                                      1. Oracle VM VirtualBox uses Guest Extensions available
                                                                      2. libvirt Virtual Machine
                                                                        1. uses the KVM hypervisor.
                                                                          1. consists of a group of files, primarily an XML file that defines the virtual machine
                                                                            1. hardware configuration, network connectivity, display capabilities, and more
                                                                              1. $ ls /etc/libvirt/qemu networks (d) rhel8.0.xml (f)
                                                                                1. networks
                                                                                  1. default.xml
                                                                                    1. <network> <name>default</name> <uuid>55ab064f</uuid> <forward mode='nat'/> <bridge name='virbr0' stp='on' delay='0'/> <mac address='52:54:00:b8:e0:15'/> <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> <range start='192.168.122.2' end='192.168.122.254'/> </dhcp> </ip> </network>
                                                                                    2. Defined The Network
                                                                                    3. rhel8.0.xml
                                                                                      1. virtual machine definition file
                                                                                        1. <domain type='kvm'> <name>rhel8.0</name> <memory unit='KiB'>4194304</memory> <vcpu placement='static'>2</vcpu> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/rhel8'/> <target dev='vda' bus='virtio'/><interface type='network'> <mac address='52:54:00:50:a7:18'/> <source network='default'/> <model type='virtio'/></interface><input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <graphics type='spice' autoport='yes'>
                                                                                    4. an associated hard disk image file that contains the installation of the operating system and its software
                                                                                      1. /var/lib/libvirt/images/rhel8.
                                                                                        1. This virtual machine’s hard disk image
                                                                                          1. sudo ls -lh /var/lib/libvirt/images/rhel8
                                                                                            1. 5.5G Oct 25 15:57 /var/lib/libvirt/images/rhel8
                                                                                            2. $ lsblk
                                                                                              1. COW
                                                                                                1. The disk image size only increases as new data is written to the disk.
                                                                                                2. RAW
                                                                                                  1. A raw or full disk type is a file that has all of its space pre-allocated.
                                                                                          2. 102.6 Linux as a virtualization guest
                                                                                            1. Working with Virtual Machine Templates
                                                                                              1. virtual machines are typically just files running on a hypervisor,
                                                                                                1. it is easy to create templates that can be customized for particular deployment scenarios.
                                                                                                  1. the new guest would get renamed, a new MAC address generated for its network interface, and other modification
                                                                                                  2. The D-Bus Machine ID
                                                                                                    1. machine identification number generated at install time
                                                                                                      1. if a virtual machine is cloned to be used as a template for other virtual machine installations,
                                                                                                        1. a new D-Bus machine ID would need to be created to ensure that system resources from the hypervisor get directed to the appropriate guest system.
                                                                                                        2. dbus-uuidgen --ensure
                                                                                                          1. can be used to validate that a D-Bus machine ID exists for the running system:
                                                                                                          2. To view the current D-Bus machine ID, run the following:
                                                                                                            1. $ dbus-uuidgen --get 17f2e0698e844e31b12ccd3f9aa4d94a
                                                                                                            2. Located
                                                                                                              1. /var/lib/dbus/machine-id and is symbolically linked to /etc/machine-id
                                                                                                              2. two virtual machines do have the same D-Bus machine ID, follow the procedure below to generate a new one:
                                                                                                                1. $ sudo rm -f /etc/machine-id
                                                                                                                  1. $ sudo dbus-uuidgen --ensure=/etc/machine-id
                                                                                                              3. Deploying Virtual Machines to the Cloud
                                                                                                                1. 1.- There are a multitude of IaaS (infrastructure as a service) providers available that run hypervisor systems and that can deploy virtual guest images for an organization.
                                                                                                                  1. 1.- all of these providers have tools in place that allows an administrator to build, deploy and configure custom virtual machines based on a variety of Linux distributions.
                                                                                                                    1. 2.- Many of these companies also have systems in place that allow for the deployment and migrations of virtual machines built from within a customer’s organization.
                                                                                                                    2. 2.- Deployment
                                                                                                                      1. 1.- Computing Instances
                                                                                                                        1. 1.-Many cloud providers will charge usage rates based on “computing instances”
                                                                                                                          1. 2.- Careful planning of how much processing time applications
                                                                                                                            1. 3.- refer to the number of virtual machines that are provisioned in a cloud environment.
                                                                                                                            2. 2.- Block Storage
                                                                                                                              1. 1.- Cloud providers also have various levels of block storage
                                                                                                                                1. 2.- Some offerings are simply meant to be web-based network storage for files,
                                                                                                                                  1. 4.- offerings relate to external storage for a cloud provisioned virtual machine to use for hosting files.
                                                                                                                                    1. 3.- The cost for such offerings will vary based on the amount of storage used, and the speed of the storage
                                                                                                                                    2. 3.- Networking
                                                                                                                                      1. 1.-web-based utilities that can be utilized for the design and implementation of different network routes, subnetting, and firewall configurations.
                                                                                                                                        1. 2.- Some will even provide DNS solutions so that publicly accessible FQDN (fully qualified domain names) can be assigned to your internet facing systems.
                                                                                                                                          1. 3.- There are even “hybrid” solutions available that can connect an existing, on-premise network infrastructure to a cloud-based infrastructure through the means of a VPN (
                                                                                                                                      2. Securely Accessing Guests in the Cloud
                                                                                                                                        1. The most prevalent method in use for accessing a remote virtual guest on a cloud platform is through the use of OpenSSH software.
                                                                                                                                          1. Administrator
                                                                                                                                            1. ssh-keygen
                                                                                                                                              1. and follow the prompts to create a public and private SSH key pair
                                                                                                                                                1. Private Key
                                                                                                                                                  1. (stored in ~/.ssh/) System Local
                                                                                                                                                    1. permissions 0600
                                                                                                                                                  2. Public Key
                                                                                                                                                    1. copied to the remote cloud system
                                                                                                                                                      1. permissions 0644
                                                                                                                                                      2. $ ssh-copy-id -i <public_key> user@cloud_server
                                                                                                                                                        1. this will copy the public SSH key from the key pair just generated to the remote cloud server.
                                                                                                                                                          1. The public key will be recorded in the ~/.ssh/authorized_keys file of the cloud server
                                                                                                                                                  3. Some cloud providers will automatically generate a key pair when a new Linux system is provisioned.
                                                                                                                                                    1. The administrator will then need to download the public key for the new system from the cloud provider and store it on their local system
                                                                                                                                                  4. Preconfiguring Cloud Systems
                                                                                                                                                    1. the cloud-init utility.
                                                                                                                                                      1. A useful tool that simplifies the deployments of cloud-based virtual machine
                                                                                                                                                        1. with the associated configuration files and pre-defined virtual machine image,
                                                                                                                                                          1. Utilizing YAML (YAML Ain’t Markup Language) plain-text files an administrator can pre-configure network settings, software package selections,
                                                                                                                                                            1. cloud-init will read in the settings from YAML configurations files and apply them. This process only needs to apply to a system’s initial setup, and makes deploying a fleet of new systems on a cloud provider’s platform easy.
                                                                                                                                                              1. #cloud-config timezone: Africa/Dar_es_Salaam hostname: test-system # Update the system when it first boots up apt_update: true apt_upgrade: true # Install the Nginx web server packages: - nginx
                                                                                                                                                            2. Containers
                                                                                                                                                              1. 1.- Container technology is similar in some aspects to a virtual machine, where you get an isolated environment to easily deploy an application.
                                                                                                                                                                1. 6.- a container uses just enough software to run an application. In this way, there is far less overhead.
                                                                                                                                                                  1. 2.- Containers allow for greater flexibility over that of a virtual machine.
                                                                                                                                                                    1. 3.- An application container can be migrated from one host to another, just as a virtual machine can be migrated from one hypervisor to another
                                                                                                                                                                      1. 5.- Containers also make it easy to deploy new versions of applications in tandem with an existing version
                                                                                                                                                                        1. 4.- Containers make use of the control groups (better known as cgroups) mechanism within the Linux kernel
                                                                                                                                                                          1. cgroups
                                                                                                                                                                            1. 1.- is a way to partition system resources
                                                                                                                                                                              1. such as memory, processor time as well as disk and network bandwidth for an individual application.
                                                                                                                                                                              2. 2.- An administrator can use cgroups directly to set system resource limits on an application,
                                                                                                                                                                                1. 3.- or a group of applications that could exist within a single cgroup.
                                                                                                                                                                            2. Pregutas y Respeustas
                                                                                                                                                                              1. 1.- What CPU extensions are necessary on an x86 based hardware platform that will run fully virtualized guests?
                                                                                                                                                                                1. VT-x for Intel CPUs or AMD-V for AMD CPUs
                                                                                                                                                                                2. 2.- A mission-critical server installation that will require the fastest performance will likely use what type of virtualization?
                                                                                                                                                                                  1. paravirtualizado
                                                                                                                                                                                  2. 3.- Two virtual machines that have been cloned from the same template and that utilize D-Bus are performing erratically. They both have separate hostnames and network configuration settings. What command would be used to determine if each of the virtual machines have different D-Bus Machine IDs?
                                                                                                                                                                                    1. dbus-uuidgen --get
                                                                                                                                                                                    2. Pregntas Exploratorias
                                                                                                                                                                                      1. 1.- Run the following command to see if your system already has CPU extensions enabled to run a virtual machine (your results may vary depending on your CPU): grep --color -E "vmx|svm" /proc/cpuinfo
                                                                                                                                                                                        1. vmx highlighted (for Intel VT-x enabled CPU’s) or svm highlighted (for AMD SVM enabled CPU’s).
                                                                                                                                                                                        2. 2.- If your processor supports virtualizations, seek out your distribution’s documentation for running a KVM hypervisor.
                                                                                                                                                                                          1. Ubuntu — https://help.ubuntu.com/lts/serverguide/libvirt.html Fedora — https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/ Arch Linux — https://wiki.archlinux.org/index.php/KVM
                                                                                                                                                                                          2. 3.- If you are using a graphical desktop environment, it is recommended to also install the virt-manager application which is a graphical front-end that can be used on a KVM installation. This will aid in virtual machine installations and management.3
                                                                                                                                                                                            1. $ sudo apt install virt-manager
                                                                                                                                                                                            2. 4.- Download a Linux distribution ISO image of your choice, and following your distribution’s documentation create a new virtual machine using this ISO.
                                                                                                                                                                                              1. This task is easily handled by the virt-manager package. However a virtual machine can be created from the command-line using the virt-install command. Try both methods to get an understanding of how virtual machines are deployed.
                                                                                                                                                                                        Show full summary Hide full summary

                                                                                                                                                                                        Similar

                                                                                                                                                                                        Acids and Bases
                                                                                                                                                                                        silviaod119
                                                                                                                                                                                        Chemistry 3 Extracting Metals Core GCSE
                                                                                                                                                                                        Chloe Roberts
                                                                                                                                                                                        Edexcel History A Gcse ~ USA 1919-1941
                                                                                                                                                                                        Kieran Elson
                                                                                                                                                                                        Of Mice and Men
                                                                                                                                                                                        becky_e
                                                                                                                                                                                        C2.1 Structure and Bonding
                                                                                                                                                                                        elzzie
                                                                                                                                                                                        Fractions
                                                                                                                                                                                        Kayleigh Elkins
                                                                                                                                                                                        PE - GCSE Glossary
                                                                                                                                                                                        rjapmann
                                                                                                                                                                                        Think Python
                                                                                                                                                                                        tsilvo2001
                                                                                                                                                                                        AQA GCSE Chemistry - C1
                                                                                                                                                                                        Izzy T
                                                                                                                                                                                        1PR101 2.test - Část 3.
                                                                                                                                                                                        Nikola Truong