How to create a full template for centos
Hello All I am a new user of openVZ. I need a full centos 4 or 5 32 bit template. I was looking in the wiki and in the precreated are but i did not fine. I found in the wiki some tutorials to create a template for other distros. However, I am looking for Centos. Can you help guys Thanks
Re: How to create a full template for centos
hi u can make it via yum yum search vztmpl then yum install vztmpl-XXX [...] vzpkgcache centos-4-i386-minimal more explain in wiki http://wiki.openvz.org/OS_template_cache_preparation
Thanks for the reply I know this way sir What I meant was different. I want to have a full centos distro not a minimal or with less features one. I need it because I do not want to handle dependencies problem. Moreover, I want to use it for production. I am looking for a step by step manual but I could not find I want to build it from scratch Regards
nop you are meaning this vzpkgcache centos-4-i386-default
With the CentOS metadata package, you can create your own OS Template. You don't have to go with the stock stuff that it installs when you create it, just edit the following file and add the packages you want in the OS Template you create: /vz/template/centos/{version}/{arch}/config/default.list To change what goes in the minimal, you can edit: /vz/template/centos/{version}/{arch}/config/minimal.list Once you have the packages you want (and it'll figure out all of the dependencies), just use the vzpkgcache command to build your template. That's how you build an OS Template with what you want in it. Another way, it to create a VPS from the stock template or a pre-created template... and install and configure it just the way you like it... and then stop the VPS... and then tar.gz up the private dir (such that it doesn't contain any file references above it's own root)... and then copy that .tar.gz file to your /vz/template/cache directory... and bingo... you have a new OS template. If you have local/LAN copies of the CentOS repos and want to make your OS template builds faster and use less bandwidth, you can edit the following file: /vz/template/centos/{version}/{arch}/config/yum.conf Just comment out the stock mirror or baseurl lines and put in your own. You can also add additional repos. The most recent release by Steve (a community member) of the CentOS-5 metadata package will save your VPS from accidentally installing udev (and removing vzdev) which usually renders the VPS unusable... so make sure you find the latest metadata package he posted here in the forum. I don't have the URL handy but you can search for it. I don't think his package has been added to the OpenVZ project download section. Any other questions?
Hi dowdle, Thanks for your instructions. I managed to add some packages in default.list and created a VPS based on this template. The problem is I don't know what packages I still missing because the default.list doesn't contain a workable collection of packages to run as a server. For my case, I want to install asterisk, but the default template cache doesn't have compiler, I used yum install gcc within VE to install it, but when I compile it, the following error showed up: checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for AIX... no checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking minix/config.h usability... no checking minix/config.h presence... no checking for minix/config.h... no checking whether it is safe to define __EXTENSIONS__... yes checking for uname... /bin/uname checking for gcc... (cached) gcc checking whether we are using the GNU C compiler... (cached) yes checking whether gcc accepts -g... (cached) yes checking for gcc option to accept ISO C89... (cached) none needed checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no checking for CC... no checking for cxx... no checking for cc++... no checking for cl.exe... no checking for FCC... no checking for KCC... no checking for RCC... no checking for xlC_r... no checking for xlC... no checking whether we are using the GNU C++ compiler... no checking whether g++ accepts -g... no checking how to run the C preprocessor... gcc -E checking how to run the C++ preprocessor... /lib/cpp configure: error: C++ preprocessor "/lib/cpp" fails sanity check See `config.log' for more details. Can you tell me what else I have to install?
I have no idea what you need to install to have a working asterisk system because I've not installed that. In this case, I don't think you need to edit the default.list because there may be so much work you have to do after that (any third-party packages or configs?) that you don't want to have to go through that each and every time you create a new VPS of the same type. I'd recommend you start with a basic VPS OS Template, get a running VPS, add everything you need to the running VPS. Install any third-party stuff and configure as desired. After you have gotten asterisk setup how you want it on the running VPS, if desired, remove any of the packages you don't need/want. Do you still need the compiler and all of the devel packages after you have your application going? Anyway, getting rid of the build stuff if you don't need it anymore will make your final OS Template smaller. Then just shut down your VPS and pack it up like so: vzctl stop {VEID} cd /vz/private/{VEID} tar -cvzf /vz/template/cache/{mynewtemplate}-i386.tar.gz Now you can use your new OS Template to create new VPSes with all of that work intact but your hostname, ip address, nameserver stuff is stored in the {VEID}.conf so your OS Template created from the shutdown VPS is fairly independent. Just make sure to change or remove any passwords you don't want shared. Does that sound like a plan?
Oh, one minor but important detail to add. If the size of your OS Templates gets too big, you may have a problem using vzctl create as it's extraction size may be bigger than the default 1GB diskspace value. There is probably an easy way to avoid that but the --diskspace parameter isn't a valid option with the vzctl create command, only with the vzctl set command. Rather than figuring out the better solution to that problem, I've just created a new private dir for my VPS and used tar to extract the OS Template where it goes... and manually copied/edited an existing {VEID}.conf as needed to get the new VPS going. That's kinda the brute force way to do it but it worked for me when I tried it.
Hi, Did the template creation for Asterisk worked for you? can you explain the step for me bcoz I am also stuck..
Additionally for asterisk you may need to add the following packages to your template list: glibc gcc-c++ compat-gcc-c++