Re: Building local cloud image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6/12/20 10:20 PM, Michael Hall wrote:
> Just wondering what the current best platform is for building Fedora cloud-base images (specifically, for AWS). We're looking at potentially doing this as part of a community college IT course, then contributing the documented process back to the Fedora Documentation project.
> 
> I've installed ImageFactory with libvirt/qemu on a couple of Fedora machines now but cannot get an image to build. No matter what I do I get one of two error messages.
> 
> One error seems to read the value out of the <version></version> tages in the TCL template file, and return that as the error. So if I make the version "32", it returns "Error: '32'"
> 
> The second error mentions needing to run "add_image()' first, but no documentation I can find addresses this issue so not sure where to go from here.
> 
> Is ImageFactory the current recommended tool, a lot of its documentation seems to potentially be out of date?

In general if you are building images for Fedora (i.e. you want the changes you're doing to make it back into
Fedora at some point) it's going to have to go through image factory at some point.

> 
> Is HashiCorp's Packer a useful alternative?

I've never used it but I hear a lot of people do.

> 
> Is it absolutely necessary to get the whole Koji toolchain involved?

No, you can do it with just imagefactory. I used to do this inside a vagrant box with something
like:

Vagrant.configure(2) do |config|

    config.ssh.insert_key = 'true'
    config.vm.synced_folder "/var/b/shared", "/var/b/shared", type: "sshfs"

    config.vm.provider :libvirt do |domain|
      domain.memory = 6096
      domain.cpus = 2
    end

    host = 'imagefactory'
    box  = 'fedora/31-cloud-base'

    config.vm.define host do | tmp |
        tmp.vm.hostname = host
        tmp.vm.box = box

    end

    # Install tools for rpm-ostree
    config.vm.provision "shell", inline: <<-SHELL
      dnf install -y git imagefactory imagefactory-plugins* libvirt-client pykickstart
      systemctl enable libvirtd --now # the --now should work but doesn't for some reason
      sed -i.orig 's/\# memory = 1024/memory = 2048/' /etc/oz/oz.cfg
    SHELL

end

Then run:

sudo imagefactory --debug base_image --file-parameter install_script fedora-cloud-base.ks --parameter offline_icicle true ./fedora-rawhide.tdl
qemu-img convert -O qcow2 /var/lib/imagefactory/storage/9637af5b-4174-49f5-aab1-2bda7897a1d6.body image.qcow2

For the tdl file you can grab one from a recent koji build:

- https://koji.fedoraproject.org/koji/taskinfo?taskID=45568107
    - https://koji.fedoraproject.org/koji/taskinfo?taskID=45568112
        - https://kojipkgs.fedoraproject.org//work/tasks/8112/45568112/tdl-x86_64.xml

you can replace the repos in there with other ones like the ones from release day if you want.


> 
> Can we just build a normal VM image on libvirt with a suitable kickstart file and use that?

If you are just messing around with an image for your use I would just use `virt-install --noreboot` and
give anaconda a kickstart file. Something like: 

virt-install --name builder1 --ram  4500 --vcpus 4 --disk path=/path/to/image/file.img,size=10 \
	--accelerate --location https://dl.fedoraproject.org/pub/fedora/linux/development/32/Everything/x86_64/os/ \
        --initrd-inject /path/fo/kickstart.cfg --force --noreboot --network bridge=virbr0 --extra-args='ks=file://kickstart.cfg'

> 
> Looking for solutions that aren't too arduous as most students have limited Linux experience.

+1 - This stack is a bit daunting. Depending on what you are trying to do you might give Fedora CoreOS
a try as it's much easier to get that building locally. See https://github.com/coreos/coreos-assembler/#the-coreos-assembler
Once you get up and running it would be `cosa build && cosa buildextend-aws` then take that file and
upload it into ec2.

> 
> Thanks
> Mike
> 
> _______________________________________________
> cloud mailing list -- cloud@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to cloud-leave@xxxxxxxxxxxxxxxxxxxxxxx
> Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives: https://lists.fedoraproject.org/archives/list/cloud@xxxxxxxxxxxxxxxxxxxxxxx
> 
_______________________________________________
cloud mailing list -- cloud@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to cloud-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/cloud@xxxxxxxxxxxxxxxxxxxxxxx




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Big List of Linux Books]     [Yosemite News]     [Linux Apps]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]

  Powered by Linux