openstack-manuals/doc/image-guide/section_fedora-example.xml
Andreas Jaeger 3ca32b8434 s/Image Service/Image service/g
Change capitalization as discussed on openstack-docs mailing list.

Change-Id: I2ad81bffbd59bdd8b908664bb0a1ee16da1bf7ae
2015-04-15 15:16:59 +02:00

170 lines
9.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section [
<!ENTITY % openstack SYSTEM "../common/entities/openstack.ent">
%openstack;
]>
<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="section_fedora-example">
<title>Example: Fedora image</title>
<para>Download a <link xlink:href="http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/iso/Fedora-20-x86_64-DVD.iso">Fedora</link>
ISO image. This procedure lets you create a Fedora 20 image.</para>
<procedure>
<step><para>Start the installation using <command>virt-install</command> as shown below:</para>
<screen><prompt>#</prompt> <userinput>qemu-img create -f qcow2 fedora-20.qcow2 8G</userinput>
<prompt>#</prompt> <userinput>virt-install --connect=qemu:///system --network=bridge:virbr0 \
--extra-args="console=tty0 console=ttyS0,115200 serial rd_NO_PLYMOUTH" \
--name=fedora-20 --disk path=/var/lib/libvirt/images/fedora-20.qcow2,format=qcow2,size=10,cache=none \
--ram 2048 --vcpus=2 --check-cpu --accelerate --os-type linux --os-variant fedora19 \
--hvm --location=http://dl.fedoraproject.org/pub/fedora/linux/releases/20/Fedora/x86_64/os/ \
--nographics</userinput></screen>
<para>This will launch a VM and start the installation process.</para>
<screen><computeroutput>Starting install...
Retrieving file .treeinfo... | 2.2 kB 00:00:00 !!!
Retrieving file vmlinuz... | 9.8 MB 00:00:05 !!!
Retrieving file initrd.img... | 66 MB 00:00:37 !!!
Allocating 'fedora-20.qcow2' | 10 GB 00:00:00
Creating domain... | 0 B 00:00:00
Connected to domain fedora-20
Escape character is ^]
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
...
...
...
[ OK ] Reached target Local File Systems (Pre).
Starting installer, one moment...
anaconda 20.25.15-1 for Fedora 20 started.
================================================================================
===============================================================================</computeroutput></screen>
</step>
<step><para>Choose the VNC or text mode to set the installation options.</para>
<screen><computeroutput>Text mode provides a limited set of installation
options. It does not offer custom partitioning for full control over the
disk layout. Would you like to use VNC mode instead?
1) Start VNC
2) Use text mode
Please make your choice from above ['q' to quit | 'c' to continue |
'r' to refresh]:</computeroutput></screen></step>
<step><para>Set the timezone, network configuration, installation
source, and the root password. Optionally,
you can choose to create a user.</para></step>
<step><para>Set up the installation destination as shown below:</para>
<screen><computeroutput>================================================================================
Probing storage...
Installation Destination
[x] 1) Virtio Block Device: 10.24 GB (vda)
1 disk selected; 10.24 GB capacity; 10.24 GB free ...
Please make your choice from above ['q' to quit | 'c' to continue |
'r' to refresh]: c
================================================================================
================================================================================
Autopartitioning Options
[ ] 1) Replace Existing Linux system(s)
[x] 2) Use All Space
[ ] 3) Use Free Space
Installation requires partitioning of your hard drive. Select what space to use
for the install target.
Please make your choice from above ['q' to quit | 'c' to continue |
'r' to refresh]: 2
================================================================================
================================================================================
Autopartitioning Options
[ ] 1) Replace Existing Linux system(s)
[x] 2) Use All Space
[ ] 3) Use Free Space
Installation requires partitioning of your hard drive. Select what space to use
for the install target.
Please make your choice from above ['q' to quit | 'c' to continue |
'r' to refresh]: c
================================================================================
================================================================================
Partition Scheme Options
[ ] 1) Standard Partition
[x] 2) LVM
[ ] 3) BTRFS
Select a partition scheme configuration.
Please make your choice from above ['q' to quit | 'c' to continue |
'r' to refresh]: c
Generating updated storage configuration
Checking storage configuration...
================================================================================</computeroutput></screen></step>
<step><para>Run the following commands from the host to eject the disk and
reboot using virsh, as root.</para>
<screen><prompt>#</prompt> <userinput>virsh attach-disk --type cdrom --mode readonly <replaceable>fedora-20</replaceable> "" hdc</userinput>
<prompt>#</prompt> <userinput>virsh destroy fedora-20</userinput>
<prompt>#</prompt> <userinput>virsh start fedora-20</userinput></screen>
<para>You can also use the GUI to detach and reboot it by manually
stopping and starting.</para></step>
<step><para>Log in as root user when you boot for the first time after
installation.</para></step>
<step><para>Install and run the <literal>acpid</literal> service on the guest
system to enable the virtual machine to reboot or shutdown an instance.</para>
<para>Run the following commands inside the Fedora 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></step>
<step><para>Install <literal>cloud-init</literal> package inside the Fedora
guest by adding the EPEL repo:</para>
<para>The <literal>cloud-init</literal> package automatically fetches
the public key from the metadata server and places the key in an account.</para>
<screen><prompt>#</prompt> <userinput>yum install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm</userinput>
<prompt>#</prompt> <userinput>yum install cloud-init</userinput></screen>
<para>You can change the name of the account used by <literal>cloud-init</literal>
by editing the <filename>/etc/cloud/cloud.cfg</filename> file and
adding a line with a different user. For example, to configure
<literal>cloud-init</literal> to put the key in an account named
admin, add this line to the configuration file:</para>
<screen><computeroutput>user: admin</computeroutput></screen></step>
<step><para>Disable the default <literal>zeroconf</literal> route for the
instance to access the metadata service:</para>
<screen><prompt>#</prompt> <userinput>echo "NOZEROCONF=yes" >> /etc/sysconfig/network</userinput></screen></step>
<step><para>For the <command>nova console-log</command> command to work
properly on Fedora 20, you might need to add the following lines to
the <filename>/boot/grub/menu.lst</filename> file:</para>
<programlisting language='ini'>serial --unit=0 --speed=115200
terminal --timeout=10 console serial
# Edit the kernel line to add the console entries
kernel ... console=tty0 console=ttyS0,115200n8</programlisting></step>
<step><para>Shut down the instance from inside the instance as a root user:</para>
<screen><prompt>#</prompt> <userinput>/sbin/shutdown -h now</userinput></screen></step>
<step><para>Clean up and remove MAC address details.</para>
<para>The operating system records the MAC address of the virtual
Ethernet card in locations such as <filename>/etc/sysconfig/network-scripts/ifcfg-eth0</filename>
and <filename>/etc/udev/rules.d/70-persistent-net.rules</filename>
during the instance process. However, each time the image boots up,
the virtual Ethernet card will have a different MAC address, so this
information must be deleted from the configuration file.</para>
<para>Use the <literal>virt-sysprep</literal> utility. This performs
various cleanup tasks such as removing the MAC address references.
It will clean up a virtual machine image in place:</para>
<screen><prompt>#</prompt> <userinput>virt-sysprep -d fedora-20</userinput></screen></step>
<step><para>Undefine the domain since you no longer need to have this
virtual machine image managed by libvirt:</para>
<screen><prompt>#</prompt> <userinput>virsh undefine fedora-20</userinput></screen></step>
</procedure>
<para>The underlying image file that you created with qemu-img create is
ready to be uploaded to the Image service.</para>
</section>