OpenVZ Forum


Home » General » Support » How to create a full template for centos
How to create a full template for centos [message #20761] Wed, 26 September 2007 04:37 Go to next message
shuaib85 is currently offline  shuaib85
Messages: 59
Registered: September 2007
Member
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 Smile


WebVZ: OpenVZ Web Management Tool
http://webvz.sourceforge.net
Re: How to create a full template for centos [message #21112 is a reply to message #20761] Tue, 02 October 2007 05:12 Go to previous messageGo to next message
Mr.Ash is currently offline  Mr.Ash
Messages: 42
Registered: September 2007
Member
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 Smile
Re: How to create a full template for centos [message #21115 is a reply to message #21112] Tue, 02 October 2007 08:28 Go to previous messageGo to next message
shuaib85 is currently offline  shuaib85
Messages: 59
Registered: September 2007
Member
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


WebVZ: OpenVZ Web Management Tool
http://webvz.sourceforge.net
Re: How to create a full template for centos [message #21118 is a reply to message #21115] Tue, 02 October 2007 08:58 Go to previous messageGo to next message
Mr.Ash is currently offline  Mr.Ash
Messages: 42
Registered: September 2007
Member
nop

you are meaning this

vzpkgcache centos-4-i386-default
Rolling Eyes
Re: How to create a full template for centos [message #21230 is a reply to message #21115] Wed, 03 October 2007 15:37 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
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?


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: How to create a full template for centos [message #22554 is a reply to message #21230] Tue, 30 October 2007 19:17 Go to previous messageGo to next message
r1ch97rd is currently offline  r1ch97rd
Messages: 2
Registered: October 2007
Junior Member
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?
Re: How to create a full template for centos [message #22561 is a reply to message #22554] Tue, 30 October 2007 21:44 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
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?


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: How to create a full template for centos [message #22562 is a reply to message #22561] Tue, 30 October 2007 21:47 Go to previous messageGo to next message
dowdle is currently offline  dowdle
Messages: 261
Registered: December 2005
Location: Bozeman, Montana
Senior Member
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.


--
TYL, Scott Dowdle
Belgrade, Montana, USA
Re: How to create a full template for centos [message #22564 is a reply to message #22561] Tue, 30 October 2007 22:03 Go to previous messageGo to next message
r1ch97rd is currently offline  r1ch97rd
Messages: 2
Registered: October 2007
Junior Member
Thanks a lot. I'll follow your advice.
Re: How to create a full template for centos [message #22897 is a reply to message #22564] Wed, 07 November 2007 09:04 Go to previous messageGo to next message
shyju is currently offline  shyju
Messages: 2
Registered: September 2007
Location: India
Junior Member

Hi,
Did the template creation for Asterisk worked for you?
can you explain the step for me bcoz I am also stuck..
Re: How to create a full template for centos [message #22929 is a reply to message #22897] Wed, 07 November 2007 15:27 Go to previous message
alticon-brian is currently offline  alticon-brian
Messages: 27
Registered: February 2006
Location: Washington, DC
Junior Member
Additionally for asterisk you may need to add the following packages to your template list:

  • glibc
  • gcc-c++
  • compat-gcc-c++
Previous Topic: Host OS and OpenVZ Kernel matching
Next Topic: *SOLVED* Easy way to create templates from iso packages
Goto Forum:
  


Current Time: Fri Nov 15 18:21:44 GMT 2024

Total time taken to generate the page: 0.03232 seconds