Compare commits
2 commits
fffaa21276
...
bdfa43aac6
| Author | SHA1 | Date | |
|---|---|---|---|
| bdfa43aac6 | |||
| 721fa48cfa |
2 changed files with 61 additions and 61 deletions
|
|
@ -49,9 +49,9 @@ _Nested virtualization_ should already work in Fedora, check as described in xre
|
|||
|
||||
3. Ensure the _Guestfish suite is installed_ to get the utilities to access and modify generated disk image files. If you follow xref:virtualization/installation.adoc[Adding Virtualization Support] exactly, it is. Otherwise install it.
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ sudo dnf install guestfs-tools
|
||||
$ sudo dnf install guestfs-tools
|
||||
----
|
||||
+
|
||||
Check to really install `guestfs-tools`, not `libguestfs-tools` (unless you need additional windows guests related software).
|
||||
|
|
@ -87,33 +87,33 @@ image::tutorials/imagefactory-kvm/059-list-volumes-en.png[Cockpit list volumes]
|
|||
|
||||
2. _Install Imagefactory_
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ sudo dnf install imagefactory imagefactory-plugins* pykickstart
|
||||
$ sudo dnf install imagefactory imagefactory-plugins* pykickstart
|
||||
----
|
||||
+
|
||||
This installs about 209 packages (in F38). To be sure, check and restore the SELinux labels for the installation directories.
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ sudo /sbin/restorecon -R -vF /var/lib/imagefactory
|
||||
[…]$ sudo /sbin/restorecon -R -vF /var/lib/oz
|
||||
$ sudo /sbin/restorecon -R -vF /var/lib/imagefactory
|
||||
$ sudo /sbin/restorecon -R -vF /var/lib/oz
|
||||
----
|
||||
|
||||
3. _Adjust Imagefactory configuration_
|
||||
|
||||
a. __Enlarge the amount of working memory__ for OZ, the backend used by ImageFactory.
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ sudo sed -i -e 's/# memory = 1024/memory = 2048/' /etc/oz/oz.cfg
|
||||
$ sudo sed -i -e 's/# memory = 1024/memory = 2048/' /etc/oz/oz.cfg
|
||||
----
|
||||
|
||||
b. Optional: _Switch the image output format_ from the default "raw" type to qcow2 to save disk space. If you have plenty thereof, leave it as is.
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ sudo vim /etc/oz/oz.cfg
|
||||
$ sudo vim /etc/oz/oz.cfg
|
||||
(edit)
|
||||
#image_type = raw
|
||||
image_type = qcow2
|
||||
|
|
@ -122,9 +122,9 @@ image_type = qcow2
|
|||
=== Set up a working directory
|
||||
|
||||
At a convenient location, create a directory where you will store all your working files, for example, in your home directory.
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$mkdir ~/imagefactory
|
||||
$ mkdir ~/imagefactory
|
||||
----
|
||||
|
||||
It will primarly used to store the kickstart and the template files. You may use your personal accout and use sudo for all commands. However, it is more convenient to work as root. However, this is only advisable in a dedicated VM as explained above.
|
||||
|
|
@ -135,17 +135,17 @@ The kickstart file describes the content of the disk image to create. Fetch the
|
|||
|
||||
1. Fetch the link:{attachmentsdir}/tutorials/imagefactory/fedora-server-kvm-dev.ks[basic kickstart file] and store it into this working directory. In many cases klicking the link stores the file into you default download directory, ~/Downloads in case of Fedora desktops or Macs.
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ mv ~/Downloads/fedora-server-kvm-dev.ks ~/imagefactory/
|
||||
$ mv ~/Downloads/fedora-server-kvm-dev.ks ~/imagefactory/
|
||||
----
|
||||
|
||||
2. Optional: _Clone the Fedora kickstart repository_ for easy access to reference material.
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ mkdir ~/imagefactory/FedoraKickstarts
|
||||
[…]$ git clone https://pagure.io/fedora-kickstarts.git -o upstream ~/imagefactory/FedoraKickstarts
|
||||
$ mkdir ~/imagefactory/FedoraKickstarts
|
||||
$ git clone https://pagure.io/fedora-kickstarts.git -o upstream ~/imagefactory/FedoraKickstarts
|
||||
----
|
||||
+
|
||||
If you are planning to contribute your VM you should create a fork, too, so you can provide a pull request.
|
||||
|
|
@ -159,9 +159,9 @@ You have to create this file in your working directoy. In this example we name i
|
|||
|
||||
The exact content depends entirely on local conditions. The basis is the following sample:
|
||||
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ vim ~/imagefactory/fedora-repo.ks
|
||||
$ vim ~/imagefactory/fedora-repo.ks
|
||||
|
||||
# Include the appropriate repo definitions
|
||||
# uncomment the repo specification to use.
|
||||
|
|
@ -191,9 +191,9 @@ The template file describes meta data of the disk image to create. That includes
|
|||
|
||||
Fetch the corresponding link:{attachmentsdir}/tutorials/imagefactory/fedora-server-kvm-dev.tdl[basic template file] and store it into the working directory. In many cases klicking the link stores the file into you default download directory, ~/Downloads in case of Fedora desktops or Macs.
|
||||
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ mv ~/Downloads/fedora-server-kvm-dev.tdl ~/imagefactory/
|
||||
$ mv ~/Downloads/fedora-server-kvm-dev.tdl ~/imagefactory/
|
||||
----
|
||||
|
||||
The version number inside the template file (22) is not necessarily the Fedora target version. For some reason it is best to leave it untouched! But you have to adjust the download URL!
|
||||
|
|
@ -207,24 +207,24 @@ The version number inside the template file (22) is not necessarily the Fedora t
|
|||
|
||||
1. prepare and optimize kickstart file with ksflatten:
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ ksflatten -c fedora-server-kvm-dev.ks -o fedora-server-kvm-dev-fl.ks
|
||||
$ ksflatten -c fedora-server-kvm-dev.ks -o fedora-server-kvm-dev-fl.ks
|
||||
----
|
||||
2. Check using ksvalidator
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ ksvalidator -i fedora-server-kvm-dev-fl.ks
|
||||
$ ksvalidator -i fedora-server-kvm-dev-fl.ks
|
||||
----
|
||||
|
||||
3. Create the image
|
||||
+
|
||||
Using a vm and guestfs-tools to adapt the image. This is the _preferred operation_ mode.
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]$ sudo imagefactory --debug base_image --file-parameter install_script \
|
||||
$ sudo imagefactory --debug base_image --file-parameter install_script \
|
||||
fedora-server-kvm-dev-fl.ks fedora-server-kvm-dev.tdl \
|
||||
--parameter offline_icicle true
|
||||
----
|
||||
|
|
@ -237,7 +237,7 @@ Additionally, you find loging output in the /var/lib/oz directory. Often specifi
|
|||
|
||||
4. Output in case of a successful generation
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
============ Final Image Details ============
|
||||
UUID: 4ebde351-e81b-427f-96b7-5acd5680013d
|
||||
|
|
@ -251,17 +251,17 @@ To access the filesystem inside a generated image, use guestfs-tools. Ensure tha
|
|||
|
||||
1. Copy the generated vm into the libvirt installation media pool
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]# qemu-img convert -c -O qcow2 /var/lib/imagefactory/storage/xxx-yyy-zzz.body /var/lib/libvirt/boot/fedora-server-kvm-dev.qcow2
|
||||
# qemu-img convert -c -O qcow2 /var/lib/imagefactory/storage/xxx-yyy-zzz.body /var/lib/libvirt/boot/fedora-server-kvm-dev.qcow2
|
||||
----
|
||||
|
||||
2. Check and analyze the file system
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]# cd /var/lib/libvirt/boot
|
||||
[…]# guestfish -a fedora-server-kvm-dev.qcow2
|
||||
# cd /var/lib/libvirt/boot
|
||||
# guestfish -a fedora-server-kvm-dev.qcow2
|
||||
Welcome ….
|
||||
><fs> run
|
||||
...(wait)
|
||||
|
|
@ -274,34 +274,34 @@ Welcome ….
|
|||
+
|
||||
Following the list of file systems above, mount each filesystem and check
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]# mkdir /mnt/test
|
||||
[…]# guestmount -a fedora-server-kvm-dev.qcow2 -m /dev/xxx/yyy /mnt/test
|
||||
# mkdir /mnt/test
|
||||
# guestmount -a fedora-server-kvm-dev.qcow2 -m /dev/xxx/yyy /mnt/test
|
||||
----
|
||||
|
||||
4. Clean up
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]# mkdir /mnt/test
|
||||
[…]# guestmount -a fedora-server-kvm-dev.qcow2 -m /dev/xxx/yyy /mnt/test
|
||||
# mkdir /mnt/test
|
||||
# guestmount -a fedora-server-kvm-dev.qcow2 -m /dev/xxx/yyy /mnt/test
|
||||
----
|
||||
|
||||
=== Instantiate and test a created image
|
||||
|
||||
1. Copy the generated vm into the libvirt disk image pool
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]# cp /var/lib/libvirt/boot/fedora-server-kvm-dev.qcow2 /var/lib/libvirt/images/vm-test.qcow2
|
||||
# cp /var/lib/libvirt/boot/fedora-server-kvm-dev.qcow2 /var/lib/libvirt/images/vm-test.qcow2
|
||||
----
|
||||
|
||||
2. Instantiate a VM
|
||||
+
|
||||
[source,]
|
||||
[source,console]
|
||||
----
|
||||
[…]# virt-install --name vm-test \
|
||||
# virt-install --name vm-test \
|
||||
--memory 4096 --cpu host --vcpus 2 --graphics none\
|
||||
--os-variant fedora-unknown\
|
||||
--import \
|
||||
|
|
|
|||
|
|
@ -47,26 +47,26 @@ If not already done install the xref:services/httpd-basic-setup.adoc[Fedora Web
|
|||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# dnf install wordpress
|
||||
# dnf install wordpress
|
||||
----
|
||||
. Add a database and a database user for Wordpress to the MariaDB DB.
|
||||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# mysql -u root
|
||||
# mysql -u root
|
||||
MariaDB [(none)]> show databases;
|
||||
MariaDB [(none)]> CREATE DATABASE wordpress ;
|
||||
MariaDB [(none)]> CREATE USER 'wordpress' IDENTIFIED BY 'wp-test-proj';
|
||||
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress';
|
||||
MariaDB [(none)]> quit;
|
||||
[…]#
|
||||
#
|
||||
----
|
||||
|
||||
. Check the database connectivity via TCP/IP
|
||||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]$ mysql -u wordpress wordpress -p
|
||||
$ mysql -u wordpress wordpress -p
|
||||
Enter password:
|
||||
Welcome to the MariaDB monitor. Commands end with ; or \g.
|
||||
Your MariaDB connection id is 18
|
||||
|
|
@ -77,7 +77,7 @@ Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|||
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.‘
|
||||
|
||||
MariaDB [wordpress]> quit
|
||||
[…]$
|
||||
$
|
||||
----
|
||||
|
||||
. Configure Wordpress to access the database defined above
|
||||
|
|
@ -86,7 +86,7 @@ Edit the Wordpress configuration file which is _in Fedora_ stored at /etc/wordpr
|
|||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# vim /etc/wordpress/wp-config.php
|
||||
# vim /etc/wordpress/wp-config.php
|
||||
define( 'DB_NAME', 'xxxxx' );
|
||||
define( 'DB_USER', 'xxxx' );
|
||||
define( 'DB_PASSWORD', 'xxxxxxxx' );
|
||||
|
|
@ -99,7 +99,7 @@ For security reasons, the default configuration restricts access to the local sy
|
|||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# vim /etc/httpd/conf.d/wordpress.conf
|
||||
# vim /etc/httpd/conf.d/wordpress.conf
|
||||
|
||||
Alias /wordpress /usr/share/wordpress
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ Modify the configuration file further and append at the end:
|
|||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# vim /etc/httpd/conf.d/wordpress.conf
|
||||
# vim /etc/httpd/conf.d/wordpress.conf
|
||||
|
||||
Alias /wordpress /usr/share/wordpress
|
||||
|
||||
|
|
@ -146,8 +146,8 @@ Provide authentication information
|
|||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# mkdir /etc/httpd/auth.d
|
||||
[…]# htpasswd -c /etc/httpd/auth.d/validusers {USER}
|
||||
# mkdir /etc/httpd/auth.d
|
||||
# htpasswd -c /etc/httpd/auth.d/validusers {USER}
|
||||
New password:
|
||||
Re-type new password:
|
||||
----
|
||||
|
|
@ -156,9 +156,9 @@ Re-type new password:
|
|||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# systemctl enable httpd
|
||||
[…]# systemctl start httpd
|
||||
[…]# systemctl status httpd
|
||||
# systemctl enable httpd
|
||||
# systemctl start httpd
|
||||
# systemctl status httpd
|
||||
----
|
||||
|
||||
== Check out and configure your site
|
||||
|
|
@ -202,23 +202,23 @@ Specifically you want to modify the base address of your Wordpress site, from wo
|
|||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# vim /etc/httpd/conf.d/wordpress.conf
|
||||
# vim /etc/httpd/conf.d/wordpress.conf
|
||||
## Alias /wordpress /usr/share/wordpress # <== Mod
|
||||
Alias /mycuteblog /usr/share/wordpress # <== Add
|
||||
|
||||
[…]# systemctl restart httpd
|
||||
# systemctl restart httpd
|
||||
----
|
||||
|
||||
* Alternatively you may want to access the Wordpress pages at your servers base address, example.com in this guide. Again, modify the Wordpress Apache configuration file.
|
||||
+
|
||||
[source,bash]
|
||||
----
|
||||
[…]# vim /etc/httpd/conf.d/wordpress.conf
|
||||
# vim /etc/httpd/conf.d/wordpress.conf
|
||||
## Alias /wordpress /usr/share/wordpress # <== Mod
|
||||
## Access wordpress via base address instead # <== Add
|
||||
DocumentRoot /usr/share/wordpress # <== Add
|
||||
|
||||
[…]# systemctl restart httpd
|
||||
# systemctl restart httpd
|
||||
----
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue