How To Create An OpenVZ OS Template For CentOS 7 Public QA

Home » CentOS-Virt » How To Create An OpenVZ OS Template For CentOS 7 Public QA
CentOS-Virt No Comments

Greetings,

First start of by working on a physical system, virtual machine, or container that matches the OS Template you are wanting to build. I used my CentOS 7 Public QA OS OpenVZ container to build it.

You must of course have a working yum. Once we are beyond Public QA and there is stuff in /etc/yum.repos.d/ this won’t be a problem. One thing to note is that the –enablerepo= must refer to a repo your build host has and viewable via “yum repolist”. That repo should point to the desired CentOS 7 build tree directory.

A note about the package list. Yes, listed out every individual packcage is tedious. Perhaps some package groups could be used but they typically drag in a lot of unwanted additional packages. Suggestions welcome.

Here is a simple script and please don’t nag at me because I’m a scripting novice. I hope email client word wrapping and screen sizes don’t butcher it too bad:

– – – – –

# To get a package list without version numbers from a target system
# rpm -qa –qf “%{n} ” > packages.txt
# Put contents of packages.txt after “-y install \” line below

mkdir /ostemplate

yum \
–installroot /ostemplate \
–nogpg \
–releasever=7 \
–enablerepo