Customize Cloud Disk Image using Guestfish | Modifikasi Cloud Disk Image Menggunakan Guestfish | Home Lab

Instalasi Libguestfs-tools

# yum -y install libguestfs-tools-c.x86_64
# export LIBGUESTFS_BACKEND=direct

Modifikasi Image Menggunakan Guestfish

# wget http://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 -O ~/CentOS-8-GenericCloud-8.2.x86_64.qcow2
# guestfish -i --network -a CentOS-8-GenericCloud-8.2.x86_64.qcow2
><fs> command "yum -y install httpd"
><fs> command "systemctl enable httpd"
><fs> command "systemctl is-enabled httpd"
><fs> touch /var/www/html/index.html
><fs> vi /var/www/html/index.html
><fs> cat /var/www/html/index.html
><fs> selinux-relabel /etc/selinux/targeted/contexts/files/file_contexts /
><fs> exit

Unggah Image ke Glance

# openstack image create \
--disk-format qcow2 \
--container-format bare \
--public \
--file CentOS-8-GenericCloud-8.2.x86_64.qcow2 \
CentOS-8

Buat Instance/Server

# openstack server create \
--image CentOS-8 \
--flavor m1.small \
--network private \
--security-group my_secgroup \
--key-name admin_key \
myserver-from-custom-image
# openstack floating ip create --project <project_name> --subnet <public_subnet> public
# openstack floating ip list -c “Floating IP Address” -c Port
# openstack server add floating ip myserver-from-custom-image <floating_ip_address>

Pengecekan Image

# openstack server list
# curl <ip_address_server>

--

--

Cloud Consultant | RHCSA | RHCE in Red Hat OpenStack | Google Cloud ACE | AWS SAA | LinkedIn: https://www.linkedin.com/in/achchusnulchikam

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ach.Chusnul Chikam

Ach.Chusnul Chikam

26 Followers

Cloud Consultant | RHCSA | RHCE in Red Hat OpenStack | Google Cloud ACE | AWS SAA | LinkedIn: https://www.linkedin.com/in/achchusnulchikam