<commit_before><?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="centos-image">
    <title>Example: CentOS image</title>
    <para>This example shows you how to install a CentOS image and focuses mainly on CentOS 6.4.
        Because the CentOS installation process might differ across versions, the installation steps
        might differ if you use a different version of CentOS.</para>
    <procedure>
        <title>Download a CentOS install ISO</title>
        <step>
            <para>Navigate to the <link
                    xlink:href="http://www.centos.org/modules/tinycontent/index.php?id=30">CentOS
                    mirrors</link> page.</para>
        </step>
        <step>
            <para>Click one of the <literal>HTTP</literal> links in the right-hand column next to
                one of the mirrors.</para>
        </step>
        <step>
            <para>Click the folder link of the CentOS version that you want to use. For example,
                    <literal>6.4/</literal>.</para>
        </step>
        <step>
            <para>Click the <literal>isos/</literal> folder link.</para>
        </step>
        <step>
            <para>Click the <literal>x86_64/</literal> folder link for 64-bit images.</para>
        </step>
        <step>
            <para>Click the netinstall ISO image that you want to download. For example,
                    <filename>CentOS-6.4-x86_64-netinstall.iso</filename> is a good choice because
                it is a smaller image that downloads missing packages from the Internet during
                installation.</para>
        </step>
    </procedure>
    <simplesect>
        <title>Start the installation process</title>
        <para>Start the installation process using either <command>virt-manager</command> or
                <command>virt-install</command> as described in the previous section. If you use
                <command>virt-install</command>, do not forget to connect your VNC client to the
            virtual machine.</para>
        <para>Assume that the name of your virtual machine image is <literal>centos-6.4</literal>;
            you need this name when you use <command>virsh</command> commands to manipulate the
            state of the image.</para>
        <para>If you use <command>virt-manager</command>, the commands should look something like
            this:</para>
        <screen><prompt>#</prompt> <userinput>qemu-img create -f qcow2 /tmp/centos-6.4.qcow2 10G</userinput>
<prompt>#</prompt> <userinput>virt-install --virt-type kvm --name centos-6.4 --ram 1024 \
--cdrom=/data/isos/CentOS-6.4-x86_64-netinstall.iso \
--disk /tmp/centos-6.4.qcow2,format=qcow2 \
--network network=default \
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--os-type=linux --os-variant=rhel6</userinput></screen>
    </simplesect>
    <simplesect>
        <title>Step through the installation</title>
        <para>At the initial Installer boot menu, choose the <guilabel>Install or upgrade an
                existing system</guilabel> option. Step through the installation prompts. Accept the
            defaults.</para>
        <mediaobject>
            <imageobject role="fo">
                <imagedata fileref="figures/centos-install.png" format="PNG" scale="60"/>
            </imageobject>
            <imageobject role="html">
                <imagedata fileref="figures/centos-install.png" format="PNG"/>
            </imageobject>
        </mediaobject>
    </simplesect>
    <simplesect>
        <title>Configure TCP/IP</title>
        <para>The default TCP/IP settings are fine. In particular, ensure that Enable IPv4 support
            is enabled with DHCP, which is the default.</para>
        <mediaobject>
            <imageobject>
                <imagedata fileref="figures/centos-tcpip.png" format="PNG" contentwidth="6in"/>
            </imageobject>
        </mediaobject>
    </simplesect>
    <simplesect>
        <title>Point the installer to a CentOS web server</title>
        <para>Choose URL as the installation method.</para>
        <mediaobject>
            <imageobject>
                <imagedata fileref="figures/install-method.png" format="PNG" contentwidth="6in"/>
            </imageobject>
        </mediaobject>
        <para>Depending on the version of CentOS, the net installer requires that the user specify
            either a URL or the web site and a CentOS directory that corresponds to one of the
            CentOS mirrors. If the installer asks for a single URL, a valid URL might be
                <literal>http://mirror.umd/centos/6/os/x86_64</literal>.</para>
        <note>
            <para>Consider using other mirrors as an alternative to
                    <literal>mirror.umd.edu</literal>.</para>
        </note>
        <mediaobject>
            <imageobject>
                <imagedata fileref="figures/url-setup.png" format="PNG" contentwidth="6in"/>
            </imageobject>
        </mediaobject>
        <para>If the installer asks for web site name and CentOS directory separately, you might
            enter:</para>
        <itemizedlist>
            <listitem>
                <para>Web site name: <literal>mirror.umd.edu</literal></para>
            </listitem>
            <listitem>
                <para>CentOS directory: <literal>centos/6/os/x86_64</literal></para>
            </listitem>
        </itemizedlist>
        <para>See <link xlink:href="http://www.centos.org/modules/tinycontent/index.php?id=30"
                >CentOS mirror page</link> to get a full list of mirrors, click on the "HTTP" link
            of a mirror to retrieve the web site name of a mirror.</para>
    </simplesect>
    <simplesect>
        <title>Storage devices</title>
        <para>If prompted about which type of devices your installation uses, choose <guilabel>Basic
                Storage Devices</guilabel>.</para>
    </simplesect>
    <simplesect>
        <title>Hostname</title>
        <para>The installer may ask you to choose a host name. The default
                (<literal>localhost.localdomain</literal>) is fine. You install the <systemitem
                class="service">cloud-init</systemitem> package later, which sets the host name on
            boot when a new instance is provisioned using this image.</para>
    </simplesect>
    <simplesect>
        <title>Partition the disks</title>
        <para>There are different options for partitioning the disks. The default installation uses
            LVM partitions, and creates three partitions (<filename>/boot</filename>,
                <filename>/</filename>, swap), which works fine. Alternatively, you might want to
            create a single ext4 partition that is mounted to "<literal>/</literal>", which also
            works fine.</para>
        <para>If unsure, use the default partition scheme for the installer because no scheme is
            better than another.</para>
    </simplesect>
    <simplesect>
        <title>Step through the installation</title>
        <para>Step through the installation, using the default options. The simplest thing to do is
            to choose the "Basic Server" install (may be called "Server" install on older versions
            of CentOS), which installs an SSH server.</para>
    </simplesect>
    <simplesect>
        <title>Detach the CD-ROM and reboot</title>
        <para>After the install completes, the <guilabel>Congratulations, your CentOS installation
                is complete</guilabel> screen appears.</para>
        <mediaobject>
            <imageobject>
                <imagedata fileref="figures/centos-complete.png" format="PNG" contentwidth="6in"/>
            </imageobject>
        </mediaobject>
        <para>To eject a disk by using the <command>virsh</command> command, libvirt requires that
            you attach an empty disk at the same target that the CDROM was previously attached,
            which should be <literal>hdc</literal>. You can confirm the appropriate target using the
                <command>dom dumpxml <replaceable>vm-image</replaceable></command> command.</para>
        <screen><prompt>#</prompt> <userinput>virsh dumpxml centos-6.4</userinput>
<computeroutput>&lt;domain type='kvm'>
  &lt;name>centos-6.4&lt;/name>
...
    &lt;disk type='block' device='cdrom'>
      &lt;driver name='qemu' type='raw'/>
      &lt;target dev='hdc' bus='ide'/>
      &lt;readonly/>
      &lt;address type='drive' controller='0' bus='1' target='0' unit='0'/>
    &lt;/disk>
...
&lt;/domain>
</computeroutput></screen>
        <para>Run the following commands from the host to eject the disk and reboot using virsh, as
            root. If you are using virt-manager, the commands below will work, but you can also use
            the GUI to detach and reboot it by manually stopping and starting.</para>
        <screen><prompt>#</prompt> <userinput>virsh attach-disk --type cdrom --mode readonly centos-6.4 "" hdc</userinput>
<prompt>#</prompt> <userinput>virsh destroy centos-6.4</userinput>
<prompt>#</prompt> <userinput>virsh start centos-6.4</userinput></screen>
        <note>
            <para>In theory, you can use the <command>virsh reboot centos-6.4</command> command
                instead of destroy and start commands. However, in our testing we were unable to
                reboot successfully using the <command>virsh reboot</command> command.</para>
        </note>
    </simplesect>
    <simplesect>
        <title>Log in to newly created image</title>
        <para>When you boot for the first time after installation, you might be prompted about
            authentication tools. Select <guilabel>Exit</guilabel>. Then, log in as root.</para>
    </simplesect>
    <simplesect>
        <title>Configure to fetch metadata</title>
        <para>An instance must interact with the metadata service to perform several tasks on start
            up. For example, the instance must get the ssh public key and run the user data script.
            To ensure that the instance performs these tasks, use one of these methods:</para>
        <itemizedlist>
            <listitem>
                <para>Install a <systemitem class="service">cloud-init</systemitem> RPM, which is a
                    port of the Ubuntu <link xlink:href="https://launchpad.net/cloud-init"
                        >cloud-init</link> package. This is the recommended approach.</para>
            </listitem>
            <listitem>
                <para>Modify <filename>/etc/rc.local</filename> to fetch desired information from
                    the metadata service, as described in the next section.</para>
            </listitem>
        </itemizedlist>
    </simplesect>
    <simplesect><commit_msg>Install acpid in the CentOS guest image<commit_after><?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook" xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" xml:id="centos-image">
    <title>Example: CentOS image</title>
    <para>This example shows you how to install a CentOS image and focuses mainly on CentOS 6.4.
        Because the CentOS installation process might differ across versions, the installation steps
        might differ if you use a different version of CentOS.</para>
    <procedure>
        <title>Download a CentOS install ISO</title>
        <step>
            <para>Navigate to the <link
                    xlink:href="http://www.centos.org/modules/tinycontent/index.php?id=30">CentOS
                    mirrors</link> page.</para>
        </step>
        <step>
            <para>Click one of the <literal>HTTP</literal> links in the right-hand column next to
                one of the mirrors.</para>
        </step>
        <step>
            <para>Click the folder link of the CentOS version that you want to use. For example,
                    <literal>6.4/</literal>.</para>
        </step>
        <step>
            <para>Click the <literal>isos/</literal> folder link.</para>
        </step>
        <step>
            <para>Click the <literal>x86_64/</literal> folder link for 64-bit images.</para>
        </step>
        <step>
            <para>Click the netinstall ISO image that you want to download. For example,
                    <filename>CentOS-6.4-x86_64-netinstall.iso</filename> is a good choice because
                it is a smaller image that downloads missing packages from the Internet during
                installation.</para>
        </step>
    </procedure>
    <simplesect>
        <title>Start the installation process</title>
        <para>Start the installation process using either <command>virt-manager</command> or
                <command>virt-install</command> as described in the previous section. If you use
                <command>virt-install</command>, do not forget to connect your VNC client to the
            virtual machine.</para>
        <para>Assume that the name of your virtual machine image is <literal>centos-6.4</literal>;
            you need this name when you use <command>virsh</command> commands to manipulate the
            state of the image.</para>
        <para>If you use <command>virt-manager</command>, the commands should look something like
            this:</para>
        <screen><prompt>#</prompt> <userinput>qemu-img create -f qcow2 /tmp/centos-6.4.qcow2 10G</userinput>
<prompt>#</prompt> <userinput>virt-install --virt-type kvm --name centos-6.4 --ram 1024 \
--cdrom=/data/isos/CentOS-6.4-x86_64-netinstall.iso \
--disk /tmp/centos-6.4.qcow2,format=qcow2 \
--network network=default \
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--os-type=linux --os-variant=rhel6</userinput></screen>
    </simplesect>
    <simplesect>
        <title>Step through the installation</title>
        <para>At the initial Installer boot menu, choose the <guilabel>Install or upgrade an
                existing system</guilabel> option. Step through the installation prompts. Accept the
            defaults.</para>
        <mediaobject>
            <imageobject role="fo">
                <imagedata fileref="figures/centos-install.png" format="PNG" scale="60"/>
            </imageobject>
            <imageobject role="html">
                <imagedata fileref="figures/centos-install.png" format="PNG"/>
            </imageobject>
        </mediaobject>
    </simplesect>
    <simplesect>
        <title>Configure TCP/IP</title>
        <para>The default TCP/IP settings are fine. In particular, ensure that Enable IPv4 support
            is enabled with DHCP, which is the default.</para>
        <mediaobject>
            <imageobject>
                <imagedata fileref="figures/centos-tcpip.png" format="PNG" contentwidth="6in"/>
            </imageobject>
        </mediaobject>
    </simplesect>
    <simplesect>
        <title>Point the installer to a CentOS web server</title>
        <para>Choose URL as the installation method.</para>
        <mediaobject>
            <imageobject>
                <imagedata fileref="figures/install-method.png" format="PNG" contentwidth="6in"/>
            </imageobject>
        </mediaobject>
        <para>Depending on the version of CentOS, the net installer requires that the user specify
            either a URL or the web site and a CentOS directory that corresponds to one of the
            CentOS mirrors. If the installer asks for a single URL, a valid URL might be
                <literal>http://mirror.umd/centos/6/os/x86_64</literal>.</para>
        <note>
            <para>Consider using other mirrors as an alternative to
                    <literal>mirror.umd.edu</literal>.</para>
        </note>
        <mediaobject>
            <imageobject>
                <imagedata fileref="figures/url-setup.png" format="PNG" contentwidth="6in"/>
            </imageobject>
        </mediaobject>
        <para>If the installer asks for web site name and CentOS directory separately, you might
            enter:</para>
        <itemizedlist>
            <listitem>
                <para>Web site name: <literal>mirror.umd.edu</literal></para>
            </listitem>
            <listitem>
                <para>CentOS directory: <literal>centos/6/os/x86_64</literal></para>
            </listitem>
        </itemizedlist>
        <para>See <link xlink:href="http://www.centos.org/modules/tinycontent/index.php?id=30"
                >CentOS mirror page</link> to get a full list of mirrors, click on the "HTTP" link
            of a mirror to retrieve the web site name of a mirror.</para>
    </simplesect>
    <simplesect>
        <title>Storage devices</title>
        <para>If prompted about which type of devices your installation uses, choose <guilabel>Basic
                Storage Devices</guilabel>.</para>
    </simplesect>
    <simplesect>
        <title>Hostname</title>
        <para>The installer may ask you to choose a host name. The default
                (<literal>localhost.localdomain</literal>) is fine. You install the <systemitem
                class="service">cloud-init</systemitem> package later, which sets the host name on
            boot when a new instance is provisioned using this image.</para>
    </simplesect>
    <simplesect>
        <title>Partition the disks</title>
        <para>There are different options for partitioning the disks. The default installation uses
            LVM partitions, and creates three partitions (<filename>/boot</filename>,
                <filename>/</filename>, swap), which works fine. Alternatively, you might want to
            create a single ext4 partition that is mounted to "<literal>/</literal>", which also
            works fine.</para>
        <para>If unsure, use the default partition scheme for the installer because no scheme is
            better than another.</para>
    </simplesect>
    <simplesect>
        <title>Step through the installation</title>
        <para>Step through the installation, using the default options. The simplest thing to do is
            to choose the "Basic Server" install (may be called "Server" install on older versions
            of CentOS), which installs an SSH server.</para>
    </simplesect>
    <simplesect>
        <title>Detach the CD-ROM and reboot</title>
        <para>After the install completes, the <guilabel>Congratulations, your CentOS installation
                is complete</guilabel> screen appears.</para>
        <mediaobject>
            <imageobject>
                <imagedata fileref="figures/centos-complete.png" format="PNG" contentwidth="6in"/>
            </imageobject>
        </mediaobject>
        <para>To eject a disk by using the <command>virsh</command> command, libvirt requires that
            you attach an empty disk at the same target that the CDROM was previously attached,
            which should be <literal>hdc</literal>. You can confirm the appropriate target using the
                <command>dom dumpxml <replaceable>vm-image</replaceable></command> command.</para>
        <screen><prompt>#</prompt> <userinput>virsh dumpxml centos-6.4</userinput>
<computeroutput>&lt;domain type='kvm'>
  &lt;name>centos-6.4&lt;/name>
...
    &lt;disk type='block' device='cdrom'>
      &lt;driver name='qemu' type='raw'/>
      &lt;target dev='hdc' bus='ide'/>
      &lt;readonly/>
      &lt;address type='drive' controller='0' bus='1' target='0' unit='0'/>
    &lt;/disk>
...
&lt;/domain>
</computeroutput></screen>
        <para>Run the following commands from the host to eject the disk and reboot using virsh, as
            root. If you are using virt-manager, the commands below will work, but you can also use
            the GUI to detach and reboot it by manually stopping and starting.</para>
        <screen><prompt>#</prompt> <userinput>virsh attach-disk --type cdrom --mode readonly centos-6.4 "" hdc</userinput>
<prompt>#</prompt> <userinput>virsh destroy centos-6.4</userinput>
<prompt>#</prompt> <userinput>virsh start centos-6.4</userinput></screen>
    </simplesect>
    <simplesect>
        <title>Log in to newly created image</title>
        <para>When you boot for the first time after installation, you might be prompted about
            authentication tools. Select <guilabel>Exit</guilabel>. Then, log in as root.</para>
    </simplesect>
    <simplesect>
        <title>Install the ACPI service</title>
        <para>To enable the hypervisor to reboot or shutdown an instance, you
            must install and run the <systemitem
                class="service">acpid</systemitem> service on the guest
            system.</para>
        <para>Run the following commands inside the CentOS guest to install the
            ACPI service and configure it to start when the system
            boots:</para>
        <screen><prompt>#</prompt> <userinput>yum install acpid</userinput>
<prompt>#</prompt> <userinput>chkconfig acpid on</userinput></screen>
    </simplesect>
    <simplesect>
        <title>Configure to fetch metadata</title>
        <para>An instance must interact with the metadata service to perform several tasks on start
            up. For example, the instance must get the ssh public key and run the user data script.
            To ensure that the instance performs these tasks, use one of these methods:</para>
        <itemizedlist>
            <listitem>
                <para>Install a <systemitem class="service">cloud-init</systemitem> RPM, which is a
                    port of the Ubuntu <link xlink:href="https://launchpad.net/cloud-init"
                        >cloud-init</link> package. This is the recommended approach.</para>
            </listitem>
            <listitem>
                <para>Modify <filename>/etc/rc.local</filename> to fetch desired information from
                    the metadata service, as described in the next section.</para>
            </listitem>
        </itemizedlist>
    </simplesect>
    <simplesect>
{'fraction_non_alphanumeric': 0.10866612333604998, 'fraction_numerical': 0.00878384496966404, 'mean_word_length': 2.3854996934396078, 'pattern_counts': {'":': 0, '<': 565, '<?xml version=': 2, '>': 585, 'https://': 2, 'lorem ipsum': 0, 'www.': 8, 'xml': 14}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2261458', 'n_tokens_mistral': 6207, 'n_tokens_neox': 5923, 'n_words': 1949}