Building LXC Containers on Ubuntu 20.04 Focal Fossa with the Older (-t template) Method

The command line tool 'yum' is not currently available in the repositories for Ubuntu 20.04 Focal Fossa. Many people respond to this by asking "Why would you want yum on a Debian-based distro anyway !!??" The answer is that yum and rpm were available in Ubuntu deb package repos up until Ubuntu 19.x because for one thing they are needed for lxc template-based container building (-t template) option of lxc-create.

Thus if you want to build a "template-based" LXC container using the (-t template) command line option on the new Ubuntu 20.04 Focal Fossa, you will be out of luck it would seem because you can't really install yum easily because it's not in the repo anymore on Ubuntu 20.04 and it has alot of nitty-gritty python version dependency and it depends on some other alphabet-soup packages too.

So what can you do to run a lxc-create command like the following successfully on Ubuntu 20.04 Focal Fossa?

sudo lxc-create -n oel73c10 -t oracle -- --release=7.3

Well, what you can do is create an LXC container on Ubuntu 20.04 Focal Fossa that DOES support yum (and rpm) installation from repo packages. For example an Ubuntu Linux 19.04 or earlier, or of course RedHat-family LXC container such as CentOS.

Then you can install LXC in THAT "build environment" container, and then you can build whatever container you want NESTED inside that "build environment" using your "fave" (-t template) option instead of using the more trendy (-t download) image-based LXC install method.

Once the lxc container has been built NESTED inside the BUILD ENVIRONMENT lxc container, you can then easily move it OUT back into the host OS container file system location (e.g. /var/lib/lxc/container-name).

You might possibly also have to run "lxc-update-config -c config" on it if your build environment container was using a significantly older version of LXC for the template-based build compared to the LXC version running on the host.

And now you are done. You now have a way to build template-based LXC containers (-t template) OR image-based (-t download) containers on Ubuntu 20.04 pretty quickly even without yum available on the host OS.

HTH