[image-guide] Update fedora, centos and other pages
Update for latest Fedora and CentOS images. Other updates throughout the guide. Change-Id: I9cfdf6b75bd3e47a354b3d4095209f7f3c0aaf48 Closes-bug: 1443815
This commit is contained in:
parent
91b8c93ace
commit
d19860c302
@ -19,7 +19,7 @@ Download a CentOS install ISO
|
||||
#. Click the ``isos/`` folder link.
|
||||
#. Click the ``x86_64/`` folder link for 64-bit images.
|
||||
#. Click the netinstall ISO image that you want to download.
|
||||
For example, ``CentOS-7-x86_64-NetInstall-1511.iso`` is a good
|
||||
For example, ``CentOS-7-x86_64-NetInstall-1611.iso`` is a good
|
||||
choice because it is a smaller image that downloads missing
|
||||
packages from the Internet during installation.
|
||||
|
||||
@ -27,7 +27,7 @@ Start the installation process
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Start the installation process using either the :command:`virt-manager`
|
||||
or the :command:`virt-install` command as described in the previous section.
|
||||
or the :command:`virt-install` command as described previously.
|
||||
If you use the :command:`virt-install` command, do not forget to connect your
|
||||
VNC client to the virtual machine.
|
||||
|
||||
@ -48,15 +48,16 @@ something like this:
|
||||
--disk /tmp/centos.qcow2,format=qcow2 \
|
||||
--network network=default \
|
||||
--graphics vnc,listen=0.0.0.0 --noautoconsole \
|
||||
--os-type=linux --os-variant=rhel7 \
|
||||
--location=/data/isos/CentOS-7-x86_64-NetInstall-1511.iso
|
||||
--os-type=linux --os-variant=centos7.0 \
|
||||
--location=/data/isos/CentOS-7-x86_64-NetInstall-1611.iso
|
||||
|
||||
Step through the installation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
At the initial Installer boot menu, choose the
|
||||
:guilabel:`Install CentOS 7` option.
|
||||
Step through the installation prompts. Accept the defaults.
|
||||
:guilabel:`Install CentOS 7` option. After the installation program starts,
|
||||
choose your preferred language and click :guilabel:`Continue` to get to the
|
||||
installation summary. Accept the defaults.
|
||||
|
||||
.. figure:: figures/centos-install.png
|
||||
:width: 100%
|
||||
@ -72,6 +73,15 @@ default.
|
||||
.. figure:: figures/centos-tcpip.png
|
||||
:width: 100%
|
||||
|
||||
Hostname
|
||||
--------
|
||||
|
||||
The installer allows you to choose a host name.
|
||||
The default (``localhost.localdomain``) is fine.
|
||||
You install the ``cloud-init`` package later,
|
||||
which sets the host name on boot when a new instance
|
||||
is provisioned using this image.
|
||||
|
||||
Point the installer to a CentOS web server
|
||||
------------------------------------------
|
||||
|
||||
@ -104,15 +114,6 @@ Storage devices
|
||||
If prompted about which type of devices your installation uses,
|
||||
choose :guilabel:`Virtio Block Device`.
|
||||
|
||||
Hostname
|
||||
--------
|
||||
|
||||
The installer may ask you to choose a host name.
|
||||
The default (``localhost.localdomain``) is fine.
|
||||
You install the ``cloud-init`` package later,
|
||||
which sets the host name on boot when a new instance
|
||||
is provisioned using this image.
|
||||
|
||||
Partition the disks
|
||||
-------------------
|
||||
|
||||
@ -135,19 +136,22 @@ Step through the installation, using the default options.
|
||||
The simplest thing to do is to choose the ``Minimal Install``
|
||||
install, which installs an SSH server.
|
||||
|
||||
Set the root password
|
||||
---------------------
|
||||
|
||||
During the installation, remember to set the root password when prompted.
|
||||
|
||||
Detach the CD-ROM and reboot
|
||||
----------------------------
|
||||
|
||||
When the installation has completed, the
|
||||
:guilabel:`Congratulations, your CentOS installation is complete`
|
||||
screen appears.
|
||||
Wait until the installation is complete.
|
||||
|
||||
.. figure:: figures/centos-complete.png
|
||||
:width: 100%
|
||||
|
||||
To eject a disk by using the :command:`virsh` command,
|
||||
libvirt requires that you attach an empty disk at the same target
|
||||
that the CDROM was previously attached, which should be ``hdc``.
|
||||
that the CD-ROM was previously attached, which may be ``hda``.
|
||||
You can confirm the appropriate target using the
|
||||
:command:`virsh dumpxml vm-image` command.
|
||||
|
||||
@ -159,7 +163,7 @@ You can confirm the appropriate target using the
|
||||
...
|
||||
<disk type='block' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<target dev='hdc' bus='ide'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<readonly/>
|
||||
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
|
||||
</disk>
|
||||
@ -173,24 +177,18 @@ and reboot it by manually stopping and starting.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# virsh attach-disk --type cdrom --mode readonly centos "" hdc
|
||||
# virsh attach-disk --type cdrom --mode readonly centos "" hda
|
||||
# virsh reboot centos
|
||||
|
||||
Log in to newly created image
|
||||
-----------------------------
|
||||
|
||||
When you boot for the first time after installation,
|
||||
you might be prompted about authentication tools.
|
||||
Select :guilabel:`Exit`. Then, log in as root.
|
||||
|
||||
Install the ACPI service
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To enable the hypervisor to reboot or shutdown an instance,
|
||||
you must install and run the ``acpid`` service on the guest system.
|
||||
|
||||
Run the following commands inside the CentOS guest to install the
|
||||
ACPI service and configure it to start when the system boots:
|
||||
Log in as root to the CentOS guest and run the following commands
|
||||
to install the ACPI service and configure it to start when the
|
||||
system boots:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
@ -216,40 +214,39 @@ Use cloud-init to fetch the public key
|
||||
|
||||
The ``cloud-init`` package automatically fetches the public key
|
||||
from the metadata server and places the key in an account.
|
||||
You can install ``cloud-init`` inside the CentOS guest by
|
||||
adding the EPEL repo:
|
||||
Install ``cloud-init`` inside the CentOS guest by
|
||||
running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# yum install epel-release.noarch
|
||||
# yum install cloud-init
|
||||
|
||||
The account varies by distribution. On Ubuntu-based virtual machines,
|
||||
the account is called ``ubuntu``. On Fedora-based virtual machines,
|
||||
the account is called ``ec2-user``.
|
||||
The account varies by distribution. On CentOS-based virtual machines,
|
||||
the account is called ``centos``.
|
||||
|
||||
You can change the name of the account used by ``cloud-init``
|
||||
by editing the ``/etc/cloud/cloud.cfg`` file and adding a line
|
||||
with a different user. For example, to configure ``cloud-init``
|
||||
to put the key in an account named ``admin``, add this line
|
||||
to the configuration file:
|
||||
to put the key in an account named ``admin``, use the following
|
||||
syntax in the configuration file:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
user: admin
|
||||
users:
|
||||
- name: admin
|
||||
(...)
|
||||
|
||||
Install cloud-utils-growpart to allow partitions to resize
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
In order for the root partition to properly resize one must
|
||||
install cloud-utils-growpart which contains the proper tools
|
||||
In order for the root partition to properly resize, install the
|
||||
``cloud-utils-growpart`` package, which contains the proper tools
|
||||
to allow the disk to resize using cloud-init.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# yum install cloud-utils-growpart
|
||||
|
||||
|
||||
Write a script to fetch the public key (if no cloud-init)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
@ -319,16 +316,18 @@ Configure console
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
For the :command:`nova console-log` command to work properly
|
||||
on CentOS 7.``x``, you might need to do the following steps:
|
||||
on CentOS 7, you might need to do the following steps:
|
||||
|
||||
#. Edit the ``/etc/default/grub`` file and configure the
|
||||
``GRUB_CMDLINE_LINUX`` option. Delete the ``rhgb quiet``
|
||||
and add the ``console=tty0 console=ttyS0,115200n8`` to the option:
|
||||
and add ``console=tty0 console=ttyS0,115200n8`` to the option.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
GRUB_CMDLINE_LINUX="crashkernel=auto console=tty0 console=ttyS0,115200n8"
|
||||
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap console=tty0 console=ttyS0,115200n8"
|
||||
|
||||
#. Run the following command to save the changes:
|
||||
|
||||
@ -349,20 +348,19 @@ on CentOS 7.``x``, you might need to do the following steps:
|
||||
Shut down the instance
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
From inside the instance, as root:
|
||||
From inside the instance, run as root:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# /sbin/shutdown -h now
|
||||
# poweroff
|
||||
|
||||
Clean up (remove MAC address details)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The operating system records the MAC address of the virtual Ethernet
|
||||
card in locations such as ``/etc/sysconfig/network-scripts/ifcfg-eth0``
|
||||
and ``/etc/udev/rules.d/70-persistent-net.rules`` 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
|
||||
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.
|
||||
|
||||
There is a utility called :command:`virt-sysprep`, that performs
|
||||
|
@ -43,19 +43,10 @@ Oz
|
||||
that automates the process of creating a virtual machine image file.
|
||||
Oz is a Python app that interacts with KVM to step through the process
|
||||
of installing a virtual machine.
|
||||
|
||||
It uses a predefined set of kickstart (Red Hat-based systems) and
|
||||
preseed files (Debian-based systems) for operating systems that it
|
||||
supports, and it can also be used to create Microsoft Windows images.
|
||||
On Fedora, install Oz with yum:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# yum install oz
|
||||
|
||||
.. note::
|
||||
|
||||
As of this writing, there are no Oz packages for Ubuntu, so you will
|
||||
need to either install from the source or build your own .deb file.
|
||||
|
||||
A full treatment of Oz is beyond the scope of this document,
|
||||
but we will provide an example. You can find additional examples of
|
||||
@ -63,7 +54,7 @@ Oz template files on GitHub at `rcbops/oz-image-build/tree/master/templates
|
||||
<https://github.com/rcbops/oz-image-build/tree/master/templates>`_.
|
||||
Here's how you would create a CentOS 6.4 image with Oz.
|
||||
|
||||
Create a template file (we'll call it ``centos64.tdl``) with
|
||||
Create a template file called ``centos64.tdl`` with
|
||||
the following contents. The only entry you will need to
|
||||
change is the ``<rootpw>`` contents.
|
||||
|
||||
|
@ -2,222 +2,282 @@
|
||||
Example: Fedora image
|
||||
=====================
|
||||
|
||||
Download a `Fedora <http://getfedora.org/>`_ ISO image.
|
||||
This procedure lets you create a Fedora 20 image.
|
||||
This example shows you how to install a Fedora image and focuses
|
||||
mainly on Fedora 25. Because the Fedora installation process
|
||||
might differ across versions, the installation steps might
|
||||
differ if you use a different version of Fedora.
|
||||
|
||||
#. Start the installation using :command:`virt-install` as shown below:
|
||||
Download a Fedora install ISO
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
#. Visit the `Fedora download site <https://getfedora.org/>`_.
|
||||
|
||||
#. Navigate to the
|
||||
`Download Fedora Server page <https://getfedora.org/en/server/download/>`_
|
||||
for a Fedora Server ISO image.
|
||||
|
||||
#. Choose the ISO image you want to download.
|
||||
|
||||
For example, the ``Netinstall Image`` is a good choice because it is a
|
||||
smaller image that downloads missing packages from the Internet during
|
||||
installation.
|
||||
|
||||
Start the installation process
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Start the installation process using either the :command:`virt-manager`
|
||||
or the :command:`virt-install` command as described previously.
|
||||
If you use the :command:`virt-install` command, do not forget to connect your
|
||||
VNC client to the virtual machine.
|
||||
|
||||
Assume that:
|
||||
|
||||
* The name of your virtual machine image is ``fedora``;
|
||||
you need this name when you use :command:`virsh` commands
|
||||
to manipulate the state of the image.
|
||||
* You saved the netinstall ISO image to the ``/tmp`` directory.
|
||||
|
||||
If you use the :command:`virt-install` command, the commands should look
|
||||
something like this:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# qemu-img create -f qcow2 /tmp/fedora.qcow2 10G
|
||||
# virt-install --virt-type kvm --name fedora --ram 1024 \
|
||||
--disk /tmp/fedora.qcow2,format=qcow2 \
|
||||
--network network=default \
|
||||
--graphics vnc,listen=0.0.0.0 --noautoconsole \
|
||||
--os-type=linux --os-variant=fedora23 \
|
||||
--location=/tmp/Fedora-Server-netinst-x86_64-25-1.3.iso
|
||||
|
||||
Step through the installation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
After the installation program starts, choose your preferred language and click
|
||||
:guilabel:`Continue` to get to the installation summary. Accept the defaults.
|
||||
|
||||
Review the Ethernet status
|
||||
--------------------------
|
||||
|
||||
Ensure that the Ethernet setting is ``ON``. Additionally, make sure that
|
||||
``IPv4 Settings' Method`` is ``Automatic (DHCP)``, which is the default.
|
||||
|
||||
Hostname
|
||||
--------
|
||||
|
||||
The installer allows you to choose a host name.
|
||||
The default (``localhost.localdomain``) is fine.
|
||||
You install the ``cloud-init`` package later,
|
||||
which sets the host name on boot when a new instance
|
||||
is provisioned using this image.
|
||||
|
||||
Partition the disks
|
||||
-------------------
|
||||
|
||||
There are different options for partitioning the disks.
|
||||
The default installation uses LVM partitions, and creates
|
||||
three partitions (``/boot``, ``/``, ``swap``), which works fine.
|
||||
Alternatively, you might want to create a single ext4
|
||||
partition that is mounted to ``/``, which also works fine.
|
||||
|
||||
If unsure, use the default partition scheme for the installer.
|
||||
While no scheme is inherently better than another, having the
|
||||
partition that you want to dynamically grow at the end of the
|
||||
list will allow it to grow without crossing another
|
||||
partition's boundary.
|
||||
|
||||
Select software to install
|
||||
--------------------------
|
||||
|
||||
Step through the installation, using the default options.
|
||||
The simplest thing to do is to choose the ``Minimal Install``
|
||||
install, which installs an SSH server.
|
||||
|
||||
Set the root password
|
||||
---------------------
|
||||
|
||||
During the installation, remember to set the root password when prompted.
|
||||
|
||||
Detach the CD-ROM and reboot
|
||||
----------------------------
|
||||
|
||||
Wait until the installation is complete.
|
||||
|
||||
To eject a disk by using the :command:`virsh` command,
|
||||
libvirt requires that you attach an empty disk at the same target
|
||||
that the CD-ROM was previously attached, which may be ``hda``.
|
||||
You can confirm the appropriate target using the
|
||||
:command:`virsh dumpxml vm-image` command.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# virsh dumpxml fedora
|
||||
<domain type='kvm' id='30'>
|
||||
<name>fedora</name>
|
||||
...
|
||||
<disk type='file' device='cdrom'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source file='/tmp/Fedora-Server-netinst-x86_64-25-1.3.iso'/>
|
||||
<backingStore/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
<readonly/>
|
||||
<alias name='ide0-0-0'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
...
|
||||
</domain>
|
||||
|
||||
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.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# virsh attach-disk --type cdrom --mode readonly fedora "" hda
|
||||
# virsh reboot fedora
|
||||
|
||||
Install the ACPI service
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To enable the hypervisor to reboot or shutdown an instance,
|
||||
you must install and run the ``acpid`` service on the guest system.
|
||||
|
||||
Log in as root to the Fedora guest and run the following commands
|
||||
to install the ACPI service and configure it to start when the
|
||||
system boots:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# dnf install acpid
|
||||
# systemctl enable acpid
|
||||
|
||||
Configure cloud-init to fetch metadata
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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 the ``cloud-init``
|
||||
package.
|
||||
|
||||
The ``cloud-init`` package automatically fetches the public key
|
||||
from the metadata server and places the key in an account.
|
||||
Install ``cloud-init`` inside the Fedora guest by
|
||||
running:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# yum install cloud-init
|
||||
|
||||
The account varies by distribution. On Fedora-based virtual machines,
|
||||
the account is called ``fedora``.
|
||||
|
||||
You can change the name of the account used by ``cloud-init``
|
||||
by editing the ``/etc/cloud/cloud.cfg`` file and adding a line
|
||||
with a different user. For example, to configure ``cloud-init``
|
||||
to put the key in an account named ``admin``, use the following
|
||||
syntax in the configuration file:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
users:
|
||||
- name: admin
|
||||
(...)
|
||||
|
||||
Install cloud-utils-growpart to allow partitions to resize
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
In order for the root partition to properly resize, install the
|
||||
``cloud-utils-growpart`` package, which contains the proper tools
|
||||
to allow the disk to resize using cloud-init.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# dnf install cloud-utils-growpart
|
||||
|
||||
Disable the zeroconf route
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For the instance to access the metadata service,
|
||||
you must disable the default zeroconf route:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# echo "NOZEROCONF=yes" >> /etc/sysconfig/network
|
||||
|
||||
Configure console
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
For the :command:`nova console-log` command to work properly
|
||||
on Fedora, you might need to do the following steps:
|
||||
|
||||
#. Edit the ``/etc/default/grub`` file and configure the
|
||||
``GRUB_CMDLINE_LINUX`` option. Delete the ``rhgb quiet``
|
||||
and add ``console=tty0 console=ttyS0,115200n8`` to the option.
|
||||
For example:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
...
|
||||
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap console=tty0 console=ttyS0,115200n8"
|
||||
|
||||
#. Run the following command to save the changes:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# qemu-img create -f qcow2 fedora-20.qcow2 8G
|
||||
# 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
|
||||
# grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
Generating grub configuration file ...
|
||||
Found linux image: /boot/vmlinuz-4.10.10-200.fc25.x86_64
|
||||
Found initrd image: /boot/initramfs-4.10.10-200.fc25.x86_64.img
|
||||
Found linux image: /boot/vmlinuz-0-rescue-c613978614c7426ea3e550527f63710c
|
||||
Found initrd image: /boot/initramfs-0-rescue-c613978614c7426ea3e550527f63710c.img
|
||||
done
|
||||
|
||||
This will launch a VM and start the installation process.
|
||||
Shut down the instance
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. code-block:: console
|
||||
From inside the instance, run as root:
|
||||
|
||||
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.
|
||||
========================================================================
|
||||
========================================================================
|
||||
.. code-block:: console
|
||||
|
||||
#. Choose the VNC or text mode to set the installation options.
|
||||
# poweroff
|
||||
|
||||
.. code-block:: console
|
||||
Clean up (remove MAC address details)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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?
|
||||
The operating system records the MAC address of the virtual Ethernet
|
||||
card in locations such as ``/etc/sysconfig/network-scripts/ifcfg-eth0``
|
||||
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.
|
||||
|
||||
1) Start VNC
|
||||
There is a utility called :command:`virt-sysprep`, that performs
|
||||
various cleanup tasks such as removing the MAC address references.
|
||||
It will clean up a virtual machine image in place:
|
||||
|
||||
2) Use text mode
|
||||
.. code-block:: console
|
||||
|
||||
Please make your choice from above ['q' to quit | 'c' to continue |
|
||||
'r' to refresh]:
|
||||
# virt-sysprep -d fedora
|
||||
|
||||
#. Set the timezone, network configuration, installation source,
|
||||
and the root password. Optionally, you can choose to create a user.
|
||||
Undefine the libvirt domain
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
#. Set up the installation destination as shown below:
|
||||
Now that you can upload the image to the Image service, you no
|
||||
longer need to have this virtual machine image managed by libvirt.
|
||||
Use the :command:`virsh undefine vm-image` command to inform libvirt:
|
||||
|
||||
.. code-block:: console
|
||||
.. code-block:: console
|
||||
|
||||
========================================================================
|
||||
Probing storage...
|
||||
Installation Destination
|
||||
# virsh undefine fedora
|
||||
|
||||
[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...
|
||||
========================================================================
|
||||
|
||||
|
||||
#. Run the following commands from the host to eject the disk and
|
||||
reboot using the :command:`virsh` command, as root.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# virsh attach-disk --type cdrom --mode readonly fedora-20 "" hdc
|
||||
# virsh destroy fedora-20
|
||||
# virsh start fedora-20
|
||||
|
||||
You can also use the GUI to detach and reboot it by manually
|
||||
stopping and starting.
|
||||
|
||||
#. Log in as root user when you boot for the first time after installation.
|
||||
|
||||
#. Install and run the ``acpid`` service on the guest system to enable
|
||||
the virtual machine to reboot or shutdown an instance.
|
||||
|
||||
Run the following commands inside the Fedora guest to install the
|
||||
ACPI service and configure it to start when the system boots:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# yum install acpid
|
||||
# chkconfig acpid on
|
||||
|
||||
#. Install the ``cloud-init`` package inside the Fedora guest by adding
|
||||
the EPEL repo:
|
||||
|
||||
The ``cloud-init`` package automatically fetches the public key
|
||||
from the metadata server and places the key in an account.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# yum install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
|
||||
# yum install cloud-init
|
||||
|
||||
You can change the name of the account used by ``cloud-init``
|
||||
by editing the ``/etc/cloud/cloud.cfg`` file and adding a line with
|
||||
a different user. For example, to configure ``cloud-init`` to put the
|
||||
key in an account named admin, add this line to the configuration file:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
user: admin
|
||||
|
||||
#. Disable the default ``zeroconf`` route for the instance to access
|
||||
the metadata service:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# echo "NOZEROCONF=yes" >> /etc/sysconfig/network
|
||||
|
||||
#. For the :command:`nova console-log` command to work properly on
|
||||
Fedora 20, you might need to add the following lines to
|
||||
the ``/boot/grub/menu.lst`` file:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
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
|
||||
|
||||
#. Shut down the instance from inside the instance as a root user:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# /sbin/shutdown -h now
|
||||
|
||||
#. Clean up and remove MAC address details.
|
||||
|
||||
The operating system records the MAC address of the virtual Ethernet
|
||||
card in locations such as ``/etc/sysconfig/network-scripts/ifcfg-eth0``
|
||||
and ``/etc/udev/rules.d/70-persistent-net.rules`` 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.
|
||||
|
||||
Use the :command:`virt-sysprep` utility. This performs various cleanup
|
||||
tasks such as removing the MAC address references.
|
||||
It will clean up a virtual machine image in place:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# virt-sysprep -d fedora-20
|
||||
|
||||
#. Undefine the domain since you no longer need to have this
|
||||
virtual machine image managed by libvirt:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# virsh undefine fedora-20
|
||||
Image is complete
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
The underlying image file that you created with the
|
||||
:command:`qemu-img create` command is ready to be uploaded to the
|
||||
Image service by using the :command:`openstack image create`
|
||||
:command:`qemu-img create` command is ready to be uploaded.
|
||||
For example, you can upload the ``/tmp/fedora.qcow2``
|
||||
image to the Image service by using the :command:`openstack image create`
|
||||
command. For more information, see the
|
||||
`Create or update an image
|
||||
<https://docs.openstack.org/user-guide/common/cli-manage-images.html#create-or-update-an-image-glance>`__.
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 10 KiB |
@ -60,7 +60,7 @@ Fedora
|
||||
~~~~~~
|
||||
|
||||
The Fedora project maintains a list of official cloud images at
|
||||
`Fedora download page <https://getfedora.org/cloud/download/>`_.
|
||||
`Fedora download page <https://alt.fedoraproject.org/cloud/>`_.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -116,14 +116,13 @@ be built with a web-based tool called `SUSE Studio <https://susestudio.com>`_.
|
||||
Red Hat Enterprise Linux
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Red Hat maintains official Red Hat Enterprise Linux cloud images.
|
||||
A valid Red Hat Enterprise Linux subscription is required to
|
||||
download these images.
|
||||
Red Hat maintains official Red Hat Enterprise Linux cloud images. A valid Red
|
||||
Hat Enterprise Linux subscription is required to download these images.
|
||||
|
||||
* `Red Hat Enterprise Linux 7 KVM Guest Image
|
||||
<https://access.redhat.com/downloads/content/69/ver=/rhel---7/x86_64/product-downloads>`_
|
||||
* `Red Hat Enterprise Linux 6 KVM Guest Image
|
||||
<https://rhn.redhat.com/rhn/software/channel/downloads/Download.do?cid=16952>`_
|
||||
<https://access.redhat.com/downloads/content/69/ver=/rhel---6/x86_64/product-downloads>`_
|
||||
|
||||
.. note::
|
||||
|
||||
|
@ -197,14 +197,17 @@ The account varies by distribution.
|
||||
On Ubuntu-based virtual machines, the account is called ``ubuntu``.
|
||||
On Fedora-based virtual machines, the account is called ``ec2-user``.
|
||||
|
||||
You can change the name of the account used by cloud-init by editing the
|
||||
``/etc/cloud/cloud.cfg`` file and adding a line with a different user.
|
||||
For example, to configure cloud-init to put the key in an account named
|
||||
``admin``, edit the config file so it has the line:
|
||||
You can change the name of the account used by ``cloud-init``
|
||||
by editing the ``/etc/cloud/cloud.cfg`` file and adding a line
|
||||
with a different user. For example, to configure ``cloud-init``
|
||||
to put the key in an account named ``admin``, use the following
|
||||
syntax in the configuration file:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
user: admin
|
||||
users:
|
||||
- name: admin
|
||||
(...)
|
||||
|
||||
Shut down the instance
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -2,10 +2,10 @@
|
||||
Use virt-install and connect by using a local VNC client
|
||||
========================================================
|
||||
|
||||
If you do not wish to use virt-manager (for example, you do not
|
||||
want to install the dependencies on your server, you don't have
|
||||
an X server running locally, the X11 forwarding over SSH isn't
|
||||
working), you can use the :command:`virt-install` tool to boot
|
||||
If you do not wish to use :command:`virt-manager` (for example,
|
||||
you do not want to install the dependencies on your server, you do
|
||||
not have an X server running locally, the X11 forwarding over SSH
|
||||
is not working), you can use the :command:`virt-install` tool to boot
|
||||
the virtual machine through libvirt and connect to the graphical
|
||||
console from a VNC client installed on your local machine.
|
||||
|
||||
@ -17,7 +17,7 @@ index.php?title=Welcome_to_TigerVNC>`_ (multiple platforms),
|
||||
`RealVNC <http://realvnc.com/>`_ (multiple platforms),
|
||||
`Chicken <http://sourceforge.net/projects/chicken/>`_ (Mac OS X),
|
||||
`Krde <http://userbase.kde.org/Krdc>`_ (KDE),
|
||||
`Vinagre <http://projects.gnome.org/vinagre/>`_ (GNOME).
|
||||
`Vinagre <https://wiki.gnome.org/Apps/Vinagre>`_ (GNOME).
|
||||
|
||||
The following example shows how to use the :command:`qemu-img`
|
||||
command to create an empty image file, and :command:`virt-install`
|
||||
@ -25,13 +25,13 @@ command to start up a virtual machine using that image file. As root:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# qemu-img create -f qcow2 /data/centos-6.4.qcow2 10G
|
||||
# virt-install --virt-type kvm --name centos-6.4 --ram 1024 \
|
||||
--cdrom=/data/CentOS-6.4-x86_64-netinstall.iso \
|
||||
--disk path=/data/centos-6.4.qcow2,size=10,format=qcow2 \
|
||||
--network network=default \
|
||||
--graphics vnc,listen=0.0.0.0 --noautoconsole \
|
||||
--os-type=linux --os-variant=rhel6
|
||||
# qemu-img create -f qcow2 /tmp/centos.qcow2 10G
|
||||
# virt-install --virt-type kvm --name centos --ram 1024 \
|
||||
--disk /tmp/centos.qcow2,format=qcow2 \
|
||||
--network network=default \
|
||||
--graphics vnc,listen=0.0.0.0 --noautoconsole \
|
||||
--os-type=linux --os-variant=centos7.0 \
|
||||
--location=/data/isos/CentOS-7-x86_64-NetInstall-1611.iso
|
||||
|
||||
Starting install...
|
||||
Creating domain... | 0 B 00:00
|
||||
@ -39,17 +39,17 @@ command to start up a virtual machine using that image file. As root:
|
||||
the console to complete the installation process.
|
||||
|
||||
The KVM hypervisor starts the virtual machine with the
|
||||
libvirt name, ``centos-6.4``, with 1024 MB of RAM.
|
||||
libvirt name, ``centos``, with 1024 MB of RAM.
|
||||
The virtual machine also has a virtual CD-ROM drive associated
|
||||
with the ``/data/CentOS-6.4-x86_64-netinstall.iso`` file and
|
||||
with the ``/data/isos/CentOS-7-x86_64-NetInstall-1611.iso`` file and
|
||||
a local 10 GB hard disk in qcow2 format that is stored
|
||||
in the host at ``/data/centos-6.4.qcow2``.
|
||||
in the host at ``/tmp/centos.qcow2``.
|
||||
It configures networking to use libvirt default network.
|
||||
There is a VNC server that is listening on all interfaces,
|
||||
and libvirt will not attempt to launch a VNC client automatically
|
||||
nor try to display the text console (``--no-autoconsole``).
|
||||
Finally, libvirt will attempt to optimize the configuration
|
||||
for a Linux guest running a RHEL 6.x distribution.
|
||||
for a Linux guest running a CentOS 7 distribution.
|
||||
|
||||
.. note::
|
||||
|
||||
@ -60,7 +60,7 @@ for a Linux guest running a RHEL 6.x distribution.
|
||||
192.168.122.0/24 subnet, and libvirt has iptables rules
|
||||
for doing NAT for IP addresses on this subnet.
|
||||
|
||||
Run the :command:`virt-install --os-variant list` command
|
||||
Run the :command:`osinfo-query os` command
|
||||
to see a range of allowed ``--os-variant`` options.
|
||||
|
||||
Use the :command:`virsh vncdisplay vm-name` command
|
||||
@ -68,10 +68,10 @@ to get the VNC port number.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
# virsh vncdisplay centos-6.4
|
||||
# virsh vncdisplay centos
|
||||
:1
|
||||
|
||||
In the example above, the guest ``centos-6.4`` uses VNC
|
||||
In the example above, the guest ``centos`` uses VNC
|
||||
display ``:1``, which corresponds to TCP port ``5901``.
|
||||
You should be able to connect a VNC client running on
|
||||
your local machine to display ``:1`` on the remote
|
||||
|
@ -33,7 +33,8 @@ permissions to run libvirt, but has sudo privileges, do:
|
||||
The ``-X`` flag passed to ssh will enable X11 forwarding over ssh.
|
||||
If this does not work, try replacing it with the ``-Y`` flag.
|
||||
|
||||
Click the :guilabel:`New` button at the top-left and step through the
|
||||
Click the :guilabel:`Create a new virtual machine` button at the top-left,
|
||||
or go to :menuselection:`File --> New Virtual Machine`. Then, follow the
|
||||
instructions.
|
||||
|
||||
.. figure:: figures/virt-manager.png
|
||||
@ -44,7 +45,7 @@ to specify information about the virtual machine.
|
||||
|
||||
.. note::
|
||||
|
||||
When using qcow2 format images you should check the option
|
||||
``customize before install``, go to disk properties and
|
||||
When using qcow2 format images, you should check the option
|
||||
``Customize configuration before install``, go to disk properties and
|
||||
explicitly select the :guilabel:`qcow2` format.
|
||||
This ensures the virtual machine disk size will be correct.
|
||||
|
Loading…
Reference in New Issue
Block a user