From 021239250b93dd9620ff4d3789d3bc67c1e9c061 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Wed, 18 Jun 2014 01:02:18 +0100 Subject: [PATCH] update openvz script and kickstart --- openvz/create-yum-openvz-7.sh | 47 ++++++++++++++++-------- openvz/openvz-7.ks | 68 +++++++++++++---------------------- 2 files changed, 57 insertions(+), 58 deletions(-) diff --git a/openvz/create-yum-openvz-7.sh b/openvz/create-yum-openvz-7.sh index b503894..9fd4c87 100644 --- a/openvz/create-yum-openvz-7.sh +++ b/openvz/create-yum-openvz-7.sh @@ -9,11 +9,19 @@ tmpyumconf=$mount/yum.conf cat > $tmpyumconf << __YUMCONF__ [centos7] name=centos 7 x86_64 -baseurl=http://buildlogs.centos.org/centos/7/os/x86_64-20140614/ -enabled=0 +baseurl=http://buildlogs.centos.org/centos/7/os/x86_64-20140617/ +enabled=1 gpgcheck=0 __YUMCONF__ +# Install the Core group +yum \ +--installroot $installroot \ +-c $tmpyumconf \ +-y groupinstall \ + Core + +# Install the necessary rpms yum \ --installroot $installroot \ -c $tmpyumconf \ @@ -29,16 +37,15 @@ yum \ passwd # Remove firmware files if installed -chroot $installroot rpm -e +yum \ +--installroot $installroot \ +-c $tmpyumconf \ +-y remove \ aic94xx-firmware \ alsa-firmware \ alsa-tools-firmware \ - cronie \ efibootmgr \ ethtool \ - iproute \ - iptables \ - iputils \ ivtv-firmware \ iwl100-firmware \ iwl105-firmware \ @@ -68,16 +75,24 @@ chroot $installroot rpm -e selinux-policy-targeted \ sudo \ upstart \ - vim-minimal \ xorg-x11-drv-ati-firmware \ zd1211-firmware -# Clean te yum configuration -yum --installroot=$installroot -c $tmpyumconf clean all +# Clean the yum configuration +yum --installroot $installroot -c $tmpyumconf clean all -# Remove unnessary files from the build -chroot $installroot rpm -e grub2 grub2-tools grubby centos-logos plymouth plymouth-scripts -chroot $installroot rpm -e initscripts kernel +# Remove unnessary files from the build, that are not required on a VZ container +yum \ +--installroot $installroot \ +-c $tmpyumconf \ +-y remove \ + grub2 \ + grub2-tools \ + grubby \ + centos-logos \ + plymouth \ + plymouth-scripts \ + kernel # Remove /boot, as that is not required chroot $installroot rm -rf /boot @@ -96,7 +111,9 @@ ln -s /proc/mounts $installroot/etc/mtab rm -f $installroot/dev/null mknod -m 600 $installroot/dev/console c 5 1 +# Copy the yum config to the system +cp $tmpyumconf $installroot/etc/yum.repos.d/centos.repo + # Now compress the image -cd $installroot; tar -cvzf /root/centos-7-x86_64-viayum.tar.gz . ; cd +cd $installroot; tar -cpzf /root/centos-7-x86_64-viayum.tar.gz . ; cd ls -lh /root/centos-7-x86_64-viayum.tar.gz -echo "Done building OS Template. Now test it." diff --git a/openvz/openvz-7.ks b/openvz/openvz-7.ks index c7180a7..59b2782 100644 --- a/openvz/openvz-7.ks +++ b/openvz/openvz-7.ks @@ -20,6 +20,7 @@ clearpart --all --initlabel part / --fstype ext4 --size=1024 --grow reboot %packages --excludedocs --nobase +@Core openssh-clients openssh-server yum @@ -32,13 +33,8 @@ passwd -aic94xx-firmware -alsa-firmware -alsa-tools-firmware --cronie --dhclient -efibootmgr -ethtool --iproute --iptables --iputils -ivtv-firmware -iwl100-firmware -iwl105-firmware @@ -64,62 +60,48 @@ passwd -linux-firmware -postfix -policycoreutils --rsyslog -selinux-policy -selinux-policy-targeted -sudo -upstart --vim-minimal -xorg-x11-drv-ati-firmware -zd1211-firmware %end %post # cleanup unwanted stuff +yum -y remove grub2 grub2-tools grubby centos-logos plymouth plymouth-scripts kernel -# ami-creator requires grub during the install, so we remove it (and -# its dependencies) in %post -rpm -e grub2 grub2-tools grubby centos-logos plymouth plymouth-scripts +# Remove /boot, as that is not required rm -rf /boot -# some packages get installed even though we ask for them not to be, -# and they don't have any external dependencies that should make -# anaconda install them -rpm -e MAKEDEV ethtool upstart initscripts iputils policycoreutils iptables \ - iproute - -# Remove kernel, as it's not required for openvz installations -rpm -e kernel - -# Remove files that are known to take up lots of space but leave -# directories intact since those may be required by new rpms. - -# locales -find /usr/{{lib,share}/{i18n,locale},{lib,lib64}/gconv,bin/localedef,sbin/build-locale-archive} \ - -type f | xargs /bin/rm - -# man pages and documentation -find /usr/share/{man,doc,info,gnome/help} \ - -type f | xargs /bin/rm - -# cracklib -find /usr/share/cracklib \ - -type f | xargs /bin/rm - -# sln -rm -f /sbin/sln - -# ldconfig -rm -rf /etc/ld.so.cache -rm -rf /var/cache/ldconfig/* - -# fstab +# Create fstab file, which is required for VZ installtions cat > /etc/fstab << __FSTAB__ none /dev/pts devpts rw,gid=5,mode=620 0 0 none /dev/shm tmpfs defaults 0 0 __FSTAB__ -# Timezone +# GMT to be default, but change for requirement +ln -sf /usr/share/zoneinfo/GMT /etc/localtime + +# Copy the yum config to the system +cp $tmpyumconf $installroot/etc/yum.repos.d/centos.repo + +# GMT to be default, but change for requirement cp -f /usr/share/zoneinfo/GMT /etc/localtime +# Misc post stuff for VZ +ln -s /proc/mounts /etc/mtab +rm -f /dev/null +mknod -m 600 /dev/console c 5 1 + +# Add a temporary yum repository to the config +cat > /etc/yum.repo.d/centos.repo << __YUMCONF__ +[centos7] +name=centos 7 x86_64 +baseurl=http://buildlogs.centos.org/centos/7/os/x86_64-20140617/ +enabled=1 +gpgcheck=0 +__YUMCONF__ + %end