We have imported custom images with well-defined names. The spec for our naming convention has slightly changed but enough requiring images be renamed in maas. I know this can be done by re-importing the image(s), but is there a way to just natively rename imported images without actual importing?
Unfortunately MAAS does not support renaming images at this time.
Please ignore me if am asking anything silly am newbie .
How can i create a custom image in maas.
for example i need to install apache webserver and mysql on the centos7
how can i achieve that
Have you tried the MAAS image builder ?
Thanks for your replay.
When i add this am getting the below error
i have created a account in launchpad.net and created a ppa called customimage
here i have replaced with
$ sudo add-apt-repository \ “https://LaunchpadID:Password@private-ppa.launchpad.net/maas-image-builder-partners/stable/ubuntu"
$ sudo add-apt-repository \ “https://myid:firstname.lastname@example.org/maas-image-builder-partners/stable/ubuntu"
is this correct?
root@john-maas:~# sudo add-apt-repository \
Hit:1 http://de.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://de.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://de.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://de.archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Ign:5 https://email@example.com/maas-image-builder-partners/stable/ubuntu bionic InRelease
Get:6 http://de.archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [19.2 kB]
Err:7 https://firstname.lastname@example.org/maas-image-builder-partners/stable/ubuntu bionic Release
404 Not Found [IP: 22.214.171.124 443]
Get:8 http://de.archive.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [8,100 B]
Reading package lists… Done
E: The repository ‘https://email@example.com/maas-image-builder-partners/stable/ubuntu bionic Release’ does not have a Release file.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
may i know y this happen is anything wrong with my command.
please assist me
So I apologize, someone had apparently reverted the Image Builder page to an earlier version.
To get the PPA, you have to request it from Canonical support, via an Ubuntu Advantage for Infrastructure support package. Do you have Ubuntu Advantage, and did you request the PPA from support? If not, let me know and I will see if there’s another way to get you what you’re after.
Thanks for your response,
I have raised the request for the PPA on (launchpad)
do we have another way to achieve custom image? if yes please educate me
@antojohnaz, not as far as I know.
Hmm thanks you bill …
so if want to use maas-image-builder i have to buy a plan? right…
Both tools only generate the image, the images still have to be manually uploaded. Neither tool allows you to remain images already uploaded to MAAS.
Thanks for your replay…
but it is possible
to achive that please follow the below steps
#add a machine with vhd disk type on oracle virtual box with the help of maas
#once the machine is ready install the needed applications like (apache,tomcat,mysql…etc)
#copy the vhd file to another location
#then install apt-get install qemu-utils libguestfs-tools -y
#after that convert the vhd to raw
qemu-img convert -f vpc -O raw Centos-Cpanel-7GB.vhd Centos-Cpanel-7GB.raw
#then get the mount path by using the below command
sudo virt-list-filesystems Centos-Cpanel-7GB.raw
#then mount the raw file as like below
sudo guestmount -a Centos-Cpanel-7GB.raw -m /dev/vgroot/lvroot -r /mnt/loop -o allow_other
#then compress it as tar.gz file format
tar cvzf /root/Centos-Cpanel-7GB.tar.gz .
sudo umount /mnt/loop
Note: you must disable the selinux on the vhd image so that you can able to login the machine
then import the image to maas via cli as like below
maas $profile boot-resources create name=custom/$imagedisplayname architecture=amd64/generic content=@$tgzfilepath
finally now you can use your custom image
really sorry for the late response. So, do follow whatever other processes or advice that may already be working for you. The steps you outlined above seem amenable. For us, I designed some scripting foo around Packer which has some basic steps we/you use for pulling a base image, manipulating that image, and then tarballing it back up. Months after I got that working, someone in my office pointed me to this document (https://maas.io/docs/troubleshooting) which has some good hints on how to unsquash and remaster an image. Once it’s mastered and tarballed (not squashed) then you need only import it, which is performed with
maas-cli using the
boot-resources command. If you want or need more guidance on this process, feel free to reply to this and I’ll try and keep an eye on the thread for a few days.
Note that you don’t have to use packer to master an image. The concept for using something like Packer, chroot, or some other sandboxed environment is the ability to use the native package management within the environment one is mastering so that files and dependencies are properly installed. In fact, there are a few ways to master the image.
The simplest is to unarchive the base image, manipulate files, and re-archive the assets of the file system. The link above (troubleshooting) outlines that pretty well.
If you need to use the package management of the system you’re mastering or if you just want to be safe (I greatly recommend) then one can use
chroot requires you to have some greater than rudimentary knowledge about how to properly set up the environment. This link under the proposed answer (https://superuser.com/questions/111152/whats-the-proper-way-to-prepare-chroot-to-recover-a-broken-linux-installation) explains the steps you need to follow, specifically mounting
proc to the chrooted environment from the host system.
One can use a docker container, which was a method I used a long time ago. I liked it but depending on the machine on which you’re mastering (IE mac), you will need to know how to manipulate the VM docker runs in to increase the image disk space. I recommend using Linux, personally.
Finally, another method is using
systemd-container has some cool benefits to it, but it also (afaict) has some caveats of which one needs to be aware.
- it allows you to run the image so that systemd et al is running, which is a huge plus for setting up certain things in your environment.
- it manages all of the host-system dependencies you need in order to properly run the image unlike chroot where you have to manually set that up and tear down and it needs to be done in proper order (especially tear down).
- I seem to recall there being two ways to run the environment; with and without running systemd. There are caveats to both methods depending on your needs. If you run it outside of running systemd then you are once again responsible for setting up host-system dependencies. You might as well just use
chroot. Otherwise, you run the image as a machine where systemd boots the machine and the running container looks and operates as a full-blown running Linux machine running the image specified by
- if you want/need the system to run systemd, you will need to know how to “login” to the system since it runs as a real machine would; once it’s done booting, you have to login. This lends itself to difficult automatic/script configuration.
- the good news is one can sideband login, but again, if one is using scripting to master the environment then one needs to either write two scripts, or do some forking, or some other kind of concurrent processing I surmise, because you have to use a separate terminal to “login” to the running container side-stepping
Thanks for your replay and detailed explanation… i will check and let you know if anything needed…