Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Ubuntu Precise template creation

724 bytes added, 14:40, 16 February 2016
Disabled services added/fixed.
export NAME="ubuntu1404"
TMPL="14.04-x86"
 
Note: replace "i386" and "x86" to "amd64", if you want to get 64-bit environment.
== Prepare directory ==
apt-get -y install debootstrap
cd /usr/share/debootstrap/scripts && ln -s gutsy trusty && cd -
debootstrap --arch $ARCH $DIST /var/lib/vz/template/$NAME -$ARCH http://$COUNTRY.archive.ubuntu.com/ubuntu chroot /var/lib/vz/template/$NAME-$ARCH
Note: Debootstrap can miss Trusty profile (as in Debian Wheezy), so you should create it manually as seen above.
locale-gen ru_RU.UTF-8
locale-gen en_US.UTF-8
echo 'LANG="en_US.UTF-8"' > /etc/default/locale
Configure packages:
echo $NAME > /etc/mailname
echo '
# dma-0.0.2010.xx syntax
SMARTHOST 192.0.2.2
DBOUNCEPROG dbounce-simple-safecat
:
DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends dma bsd-mailx safecat
 
'''14.04 note:''' config syntax for dma-0.9 was changed:
echo '
# dma-0.9 syntax
SMARTHOST 192.0.2.2
MAILNAME /etc/mailname
' > /etc/dma/dma.conf
Disable hardware-related configs:
sed -i.orig -e 's,^#!.*,#!/bin/true,' /etc/init.d/ondemand sed -i.orig -e 's,\Disable(.* | \)\(sysctl .*\),\1 /bin/true \2,' { local f="/etc/init/procps$1.conf" sed -i.orig -e 's,^console output,, ; s,^env INIT_VERBOSE,,' local o="/etc/init/rc$1.confoverride" sed test -i.orig s "$o" && grep -e 's/qw "^\manual" "$ModLoad imklog/#o" && return echo "manual # \DISABLE UNDER OPENVZ" >> "$ModLoad imklog/g' /etc/rsyslog.confo" } Disable console sed Disable console-i.orig -e 's,^\([^#].*/dev/xconsole\),## \1,' /etc/rsyslog.d/50font Disable console-default.confsetup
:
mkdir /root/etc_init_console_ttyDisable ondemand Disable setvtrgb : Disable hwclock Disable hwclock-save : Disable ureadahead Disable ureadahead-other : Disable plymouth Disable plymouth-log Disable plymouth-ready Disable plymouth-shutdown Disable plymouth-splash Disable plymouth-stop Disable plymouth-upstart-bridge : Disable tty2 Disable tty3 Disable tty4 Disable tty5 Disable tty6 : Disable udev Disable udev-fallback-graphics Disable udev-finish Disable udevmonitor Disable udevtrigger : mv /etcsed -i.orig -e '/init| sysctl /console* s,$, || :,' /etc/init/tty* procps.conf sed -i.orig -e 's,^\$ModLoad imklog,## \$ModLoad imklog,g' /rootetc/etc_init_console_ttyrsyslog.conf
Cleanup and leave chroot:
apt-get clean
find /var/cache/apt /var/lib/apt/lists -type f -delete
apt-get clean
exit
rm -f /var/lib/vz/template/cache/ubuntu-$TMPL.tar.gz &&
tar czf /var/lib/vz/template/cache/ubuntu-$TMPL.tar.gz --numeric-owner -C /var/lib/vz/template/$NAME -$ARCH .
== How to create CT from template ==
12
edits