The repository was created by the SolusVM 2 team.
SolusVM 2 comes with a number of OS images available out of the box. However, you may want to build your custom OS images (with desired parameters, installed packages, OS versions, and so on).
This repository will help you do so. It contains a number of scripts and configs
to help you build custom cloud-init
compatible QEMU/KVM OS images.
Note: SolusVM 2 OS Images Builder was tested and it works on CentOS servers. We cannot guarantee that it will work on Ubuntu or Debian.
Check if the server where you want to build the image (or the build server for short) meets the following requirements:
qemu-kvm
packageyum install unzip curl
for CentOS.Install Packer by HashiCorp:
Access the build server command line via SSH.
Download Packer:
curl -kO https://releases.hashicorp.com/packer/1.7.8/packer_1.7.8_linux_amd64.zip
Unzip the Packer archive by running the unzip packer_1.7.8_linux_amd64.zip
command.
Run the cp packer /usr/sbin/
command to copy the Packer binary to the /usr/sbin/
directory.
The repository contains directories named after OSes whose images you can build (centos
, debian
, fedora
, and so on).
To customize a future OS image, change the content of the JSON template file in the corresponding directory
(for example, the /centos/solus-centos-8.json
file).
Examples of possible changes are below:
-m
parameter in qemuargs
. "variables"
section.Note: The disk size must be larger than the packed image size.
For more information on customizing an OS image, read the HashiCorp Packer documentation.
To start building an OS image, run the following command specifying the image OS as a parameter:
./build.sh build debian|fedora|centos-8|windows-2019
For example, if the image OS is Fedora, run the following command:
./build.sh build fedora
You can also launch some additional actions that will be executed with the build:
To transfer a built OS image to another server via scp, run ./build.sh
with the --opt_destination
option, for example:
./build.sh build fedora --opt_destination=root@10.2.3.4:/
To use this option, you must also set up the SSH_KEY environment variable with a private SSH key of the destination server as the variable value.
To clean up the output directory after removing a built OS image, run ./build.sh
with the --cleanup
option.
This option may be useful if you transfer the image using the --opt_destination
option. After the image was transferred, you may no longer need it in the output directory.
When you have launched the build, we recommend that you connect to the build server via VNC. It will help you monitor the build and promptly see any errors if they occur.
If you see the following error:
Build 'solusvm2' errored: Failed creating Qemu driver: exec: "qemu-system-x86_64": executable file not found in $PATH
Then create a symbolic link from /usr/libexec/qemu-kvm
to /usr/libexec/qemu-system-x86_64
:
# ln -s /usr/libexec/qemu-kvm /usr/bin/qemu-system-x86_64
Note: If Packer still cannot find the location of the qemu-kvm
package during the build, check the "qemu_binary": "/.../.../qemu-kvm"
line in the JSON template and edit the path to qemu-kvm
if necessary.
By default, the ./output
and the ./build
directories will be created during the script execution.
Once the build is finished, you will find the built OS image in the ./output
directory.
The ./build
directory will contain packer.log
.
html/Autounattend.xml
and
increase the disk size in the .json
file.