Preparing an Image for Deploying a Cloud Server
Before creating a cloud server from an image, you need to configure the image in advance. This ensures a successful installation and reliable operation of the control panel.
The following section covers the checks and settings required to deploy the server successfully.
Basic Settings
Partition Table
Make sure the disk has the correct partition structure. We recommend using MBR or GPT partitions, as they are supported by most Linux distributions and can be configured with command-line tools such as fdisk, gdisk and others.
gdisk -l /dev/vda
Sample output:
GPT fdisk (gdisk) version 1.0.5
Partition table scan:
MBR: MBR only
BSD: not present
APM: not present
GPT: not present
If a different partition structure is used, you may need to recreate the image with the correct configuration.
Disk Layout
If the disk has only one partition (the root partition) and it uses the ext3 or ext4 file system, the file system will be resized automatically when the server is installed from the image. It will be expanded to the disk size specified in the server configuration.
For example, if the block device in the image is 10 GB and the disk size specified at installation is 15 GB, the block device and file system will be automatically expanded to 15 GB.
The file system will not be expanded if LVM (Logical Volume Manager) is used.
OS Bootloader
We use SeaBIOS to run virtual machines, so a standard BIOS bootloader must be installed in the OS. If a UEFI bootloader is installed, remove it and install a BIOS bootloader.
If you use GRUB2, you can find installation and configuration instructions here.
Configuring /etc/fstab
To ensure stable system operation, configure the /etc/fstab file to mount the root partition by UUID. Example:
UUID=f19002a1-6e7a-45ac-91cd-24b7cc0e4cd9 / ext4 defaults 0 1
To get the UUID of a partition, you can use the command:
blkid
Sample output:
/dev/vda1: UUID="f19002a1-6e7a-45ac-91cd-24b7cc0e4cd9" TYPE="ext4" PARTUUID="f7a1fae1-01"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
Main User Account
When the server is created, a password will be generated for the root user (or Administrator on Windows). Make sure this user exists. The user normally exists unless it was deliberately deleted.
qemu-guest-agent
Check that the qemu-guest-agent service is installed and running. It is required for certain operations from the control panel, such as creating backups.
- Check the service status.
Systemd:
systemctl status qemu-guest-agent.service
OpenRC and init.d:
/etc/init.d/qemu-guest-agent status
or:
service qemu-guest-agent status
- Install the agent if it is not present on the system:
Debian/Ubuntu:
apt-get install qemu-guest-agent
CentOS / RHEL:
yum install qemu-guest-agent
Alpine Linux:
apk add qemu-guest-agent
- Enable it at startup:
Systemd:
systemctl enable qemu-guest-agent.service
init.d:
chkconfig --add qemu-guest-agent
OpenRC:
rc-update add qemu-guest-agent
On Windows, you need to install this service using a special ISO image, which you can download here. You can also use it to install the virtio drivers required to support virtualized devices.
These settings are sufficient to create a cloud server from the image. However, we recommend completing the remaining settings for more convenient server management.
Additional Settings
Network Settings
Once the server is running, it is important to make sure it is reachable on the network. To do this, configure the DHCP client to obtain IPv4 and IPv6 addresses automatically.
On most systems, a DHCP client is installed by default, but we recommend using the dhclient utility with the settings below:
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
option dhcp6.next-hop code 242 = ip6-address;
send host-name = gethostname();
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers, dhcp6.next-hop;
timeout 300;
SSH Access
Since SSH is usually used for remote access to the server, it is important to check that SSH is installed and starts when the server boots.
- Check the status:
Systemd:
systemctl status ssh.service
OpenRC and init.d:
/etc/init.d/ssh status
or:
service ssh status
- Install SSH if it is not present:
Debian/Ubuntu:
apt-get install openssh-server
CentOS / RHEL:
yum -y install openssh-server openssh-clients
Alpine Linux:
apk add openssh
- Enable it at startup:
Systemd:
systemctl enable ssh.service
Init.d:
chkconfig --add ssh
OpenRC:
rc-update add sshd
- Also make sure that your firewall allows access to the SSH port (22 by default).
Disabling swap
We recommend disabling the swap file.
- Check the current state of the swap file:
swapon --show
Sample output:
NAME TYPE SIZE USED PRIO
/swap.img file 685M 0B -2
- Disable swap:
swapoff -a