ArchServer Project :: Forums

You are not logged in.

#1 2010-Jan-31 12:53:29

ras0ir
Wiki Administrator
From: Ankara, Turkey
Registered: 2010-Jan-29
Posts: 20
Website

openvz template building script

Hi all!

I've created (ok, i've modified the original one tongue) a script to create an OpenVZ template for ArchServer. You can see the script and usage information by visiting this wiki article.

Feel free to contribute and correct mistakes.

Warning: it's not ready for daily usage yet (some packages are missing, and they'll be included in core repository in future)

Last edited by ras0ir (2010-Jan-31 13:38:26)

Offline

 

#2 2010-Jan-31 15:31:52

faelar
Forum Moderator
From: Amiens (FR)
Registered: 2009-Dec-17
Posts: 95

Re: openvz template building script

According to Wikipedia OpenVZ is: OpenVZ is an...

changed to :

According to Wikipedia, OpenVZ is an

Thank you for your contribution smile

Offline

 

#3 2010-Jan-31 15:33:37

ras0ir
Wiki Administrator
From: Ankara, Turkey
Registered: 2010-Jan-29
Posts: 20
Website

Re: openvz template building script

lol english is not my native language so feel free to correct my mistakes wink

Offline

 

#4 2010-Jan-31 22:01:11

fukawi2
Yak Herder
From: Melbourne, Australia
Registered: 2009-Dec-16
Posts: 200
Website

Re: openvz template building script

Does OpenVZ require any specific kernel configuration? Should this "just work" (tm)?

Offline

 

#5 2010-Feb-01 00:07:31

ras0ir
Wiki Administrator
From: Ankara, Turkey
Registered: 2010-Jan-29
Posts: 20
Website

Re: openvz template building script

fukawi2 wrote:

Does OpenVZ require any specific kernel configuration? Should this "just work" (tm)?

well it doesnt need any specific configuration, the script and template will work when the packages in PACKS variable available in the repositories smile

crond, zip, unzip and joe (feel free to drop joe :p) are missing at the moment.

Offline

 

#6 2010-Feb-01 08:02:15

fukawi2
Yak Herder
From: Melbourne, Australia
Registered: 2009-Dec-16
Posts: 200
Website

Re: openvz template building script

Yikes, I didn't realize we were missing a cron package :-|
http://git.archserver.org/?p=server-cor … 4782ce1051

Offline

 

#7 2010-Feb-03 08:51:54

triplem
Trusted User / Schwag Merchant
From: Frankfurt / Main, Germany
Registered: 2009-Dec-20
Posts: 147
Website

Re: openvz template building script

OpenVZ would be a perfect usage of ArchServer, I believe.

The given Script is really nice. I think we could probably replace the contents of the PACKS variable with something more streamlined (e.g. replace all Packages belonging to base with the group base).

ras0ir, are you going to maintain this one? Is there anything you need for this script, which is not already there?


The penguin found me, and I do take care about him :-)
Drinking decaf' won't make you as cool as the ArchServer guys!
Blog

Offline

 

#8 2010-Feb-03 16:05:09

ras0ir
Wiki Administrator
From: Ankara, Turkey
Registered: 2010-Jan-29
Posts: 20
Website

Re: openvz template building script

Code:

PACKS="sed gawk coreutils filesystem texinfo grep pacman logrotate \
module-init-tools wget curl net-tools procps tar cpio  \   
gzip bzip2 psmisc initscripts iptables iputils dnsutils iproute2 \
less dash bash which openssh sudo vixie-cron syslog-ng  \      
util-linux-ng"

i've removed zip, unzip and lzma-utils from the list (they'll be useful, but not needed ATM). I'm compiling kernel26-ovz26 at the moment, i'll test vz template tonight.

Offline

 

#9 2010-Feb-07 08:12:48

ras0ir
Wiki Administrator
From: Ankara, Turkey
Registered: 2010-Jan-29
Posts: 20
Website

Re: openvz template building script

Happy end tongue
http://omploader.org/vM2gzcA

Note: I've updated OpenVZ Template page.

Last edited by ras0ir (2010-Feb-07 08:14:24)

Offline

 

#10 2010-Feb-07 08:44:41

triplem
Trusted User / Schwag Merchant
From: Frankfurt / Main, Germany
Registered: 2009-Dec-20
Posts: 147
Website

Re: openvz template building script

Great stuff, I think that Virtualiation is the future so as more we support it, the better it is.

Thanks ras0ir.


The penguin found me, and I do take care about him :-)
Drinking decaf' won't make you as cool as the ArchServer guys!
Blog

Offline

 

#11 2010-Feb-07 11:47:30

fukawi2
Yak Herder
From: Melbourne, Australia
Registered: 2009-Dec-16
Posts: 200
Website

Re: openvz template building script

Awesome.... good work ras0ir smile

So what are you hosting on it? Sourceforge mirror? Reddit clone? FOSS version of YouTube/Vimeo? tongue

Offline

 

#12 2010-Feb-13 02:03:23

ras0ir
Wiki Administrator
From: Ankara, Turkey
Registered: 2010-Jan-29
Posts: 20
Website

Re: openvz template building script

tongue

BTW, it's possible to use these OpenVZ templates in LXC as it supports OpenVZ templates by default.
see http://lxc.teegra.net/ for container setup.

Offline

 

#13 2010-Jul-25 10:17:50

slubman
Member
From: Grenoble
Registered: 2010-Jul-25
Posts: 4
Website

Re: openvz template building script

I had to make some changes to the buildtemplate script to get the container creation to work.

I needed to add the server-core repo, and delete the unzip package from PACKS

Below is the script I got to work

Code:

# simple script to create OpenVZ ArchServer template.
# For the original script see http://wiki.openvz.org/Talk:Archlinux_Template_creation

DISTRO=archserver
VERSION=20100702 

PACKS="sed gawk coreutils texinfo filesystem grep pacman logrotate 
module-init-tools wget curl net-tools procps tar cpio zip 
gzip bzip2 psmisc initscripts iputils dnsutils iproute2 
less dash which openssh vim vixie-cron sudo htop dcron rsyslog       
util-linux-ng"                                                      


MIRROR1=http://repo.archserver.org/redgum
MIRROR2=ftp://repo.archserver.org/redgum 

if [[ ${1} == 64 ]]; then
  ARCH=x86_64            
else                     
  if [[ ${1} == 32 ]]; then
    ARCH=i686              
  else                     
    echo "Usage: ${0} 32|64"
    exit 1                  
  fi                        
fi                          

ROOT=${DISTRO}-${VERSION}-${ARCH}

TEMPLATE=$(pwd)/${ROOT}.tar.gz

if [[ "$(whoami)" == "root" ]]; then
        echo "Building template: ${ROOT}"
else                                     
        echo "This script must be run as root (or with sudo)"
        exit 1                                               
fi                                                           

cat <<EOF > pacman.conf
[options]              
HoldPkg     = pacman glibc
SyncFirst   = pacman      

[server-core]
Server = ${MIRROR1}/server-core/os/${ARCH}
Server = ${MIRROR2}/server-core/os/${ARCH}

[testing]
Server = ${MIRROR1}/testing/os/${ARCH}
Server = ${MIRROR2}/testing/os/${ARCH}
EOF

mkarchroot -C pacman.conf ${ROOT} ${PACKS}

chmod 666 ${ROOT}/dev/null
chmod 666 ${ROOT}/dev/zero
mknod -m 666 ${ROOT}/dev/random c 1 8
mknod -m 666 ${ROOT}/dev/urandom c 1 9
mkdir -m 755 ${ROOT}/dev/pts
mkdir -m 1777 ${ROOT}/dev/shm
mknod -m 666 ${ROOT}/dev/tty c 5 0
mknod -m 666 ${ROOT}/dev/full c 1 7
mknod -m 600 ${ROOT}/dev/initctl p
mknod -m 666 ${ROOT}/dev/ptmx c 5 2


# we don't need any getty entries in a container
sed 's/^.*getty.*$/#&/' -i ${ROOT}/etc/inittab
echo "sshd: ALL: ALLOW" >> ${ROOT}/etc/hosts.allow
cd ${ROOT}
tar czvf ${TEMPLATE} .

echo "Created template: ${ROOT}"

i can start a VE created from this template, but I've got a problem with the /dev/tty

Code:

[root@ks369514 ~]# vzctl --verbose enter 888
entered into CT 888
[root@meagan /]# ls -lh /dev
total 4.0K
drwxr-xr-x 2 root root      160 2010-07-25 12:07 char
crw------- 1 root root   5,   1 2010-02-04 17:41 console
lrwxrwxrwx 1 root root       11 2010-07-25 11:52 core -> /proc/kcore
lrwxrwxrwx 1 root root       13 2010-07-25 11:52 fd -> /proc/self/fd
crw-rw-rw- 1 root root   1,   7 2010-07-25 12:07 full
crw-rw-rw- 1 root root  10, 229 2010-02-04 17:41 fuse
prw------- 1 root root        0 2010-07-25 12:07 initctl
crw-rw-rw- 1 root root   1,  11 2010-02-04 17:41 kmsg
srw-rw-rw- 1 root root        0 2010-07-25 12:07 log
brw-rw---- 1 root disk   7,   0 2010-02-04 17:41 loop0
drwxr-xr-x 2 root root       60 2010-02-04 17:41 net
crw-rw-rw- 1 root root   1,   3 2010-07-25 12:07 null
crw------- 1 root root 108,   0 2010-02-04 17:41 ppp
crw-rw-rw- 1 root tty    5,   2 2010-07-25 12:15 ptmx
drwxr-xr-x 2 root root        0 2010-07-25 12:07 pts
crw-rw-rw- 1 root root   1,   8 2010-07-25 12:07 random
drwxrwxrwt 2 root root       40 2010-07-25 12:07 shm
lrwxrwxrwx 1 root root       15 2010-07-25 11:52 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root       15 2010-07-25 11:52 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root       15 2010-07-25 11:52 stdout -> /proc/self/fd/1
-rw-r--r-- 1 root root        3 2010-07-25 12:07 tty[0-9]*
crw-rw-rw- 1 root root   1,   9 2010-07-25 12:07 urandom
crw-rw-rw- 1 root root   1,   5 2010-07-25 12:07 zero

With this I can't ssh from the box to other box:

Code:

debug1: read_passphrase: can't open /dev/tty: No such file or directory

On the HN (running CentOS 5.5), I also had to execute one command, to have the network working fine in the VE:

Code:

cp /etc/vz/dists/arch.conf /etc/vz/dists/archserver.conf

Last edited by slubman (2010-Jul-25 10:21:23)

Offline

 

#14 2010-Jul-25 10:41:05

fukawi2
Yak Herder
From: Melbourne, Australia
Registered: 2009-Dec-16
Posts: 200
Website

Re: openvz template building script

Hi slubman, welcome to AS smile

Thanks for the testing and feedback -- would you be able to report it on the Bug Tracker please? smile

Cheers,
~p

Offline

 

#15 2010-Jul-25 13:08:45

slubman
Member
From: Grenoble
Registered: 2010-Jul-25
Posts: 4
Website

Re: openvz template building script

I'll post on the bugtracker, once I'll be sure the problem is in archlinux, and note within OpenVZ on the HN.

Offline

 

#16 2010-Jul-25 22:56:47

fukawi2
Yak Herder
From: Melbourne, Australia
Registered: 2009-Dec-16
Posts: 200
Website

Re: openvz template building script

Ace, thanks big_smile

Offline

 

#17 2010-Jul-26 21:29:15

slubman
Member
From: Grenoble
Registered: 2010-Jul-25
Posts: 4
Website

Re: openvz template building script

I'm still working on the template, and indeed, the /etc/rc.sysinit is now heavily "patched" to have the good devices created, and other things sorted out (like the output of df -h). I still have to solve the problem with the creation of the /dev/tty[0-9]* file.

Offline

 

Board footer

Powered by FluxBB