Editing Archlinux Template creation
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | + | Instructions manually create a minimal Archlinux (0.8) "Voodoo" OS Template. | |
− | == | + | == Prerequisites == |
− | + | I used a modified archbootstrap script which can be found at http://forzza.systs.org/openvz-misc/ | |
− | |||
− | + | Edit settings of script "archbootstrap" : | |
− | |||
− | + | <pre> | |
− | + | ARCH="i686" | |
− | + | IGNORE="rp-pppoe ppp wireless_tools xfsdump xfsprogs reiserfsprogs lshwd usbutils pciutils pcmciautils module-init-tools mdadm mkinitcpio libusb jfsutils lvm2 lilo cryptsetup device-mapper dhcpcd hwdetect dmapi gen-init-cpio grub" | |
− | |||
− | |||
− | |||
− | + | umark PACMAN_OPTS (remove '#') | |
− | + | </pre> | |
− | + | {{Note|I suggest to place the build for OpenVZ templates to /vz/template/, schema: /vz/template/$DIST/$VERSION/$ARCH/}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <pre> | |
+ | Built this OS-Template with: | ||
− | + | VE0_dist Debian | |
+ | VE0_ARCH i386 | ||
− | + | DIST arch | |
− | + | VERSION 0.8 | |
− | + | ARCH depends on VE0 settings above | |
− | + | </pre> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | == bootstrapping Archlinux == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Syntax: | |
− | + | VE0_# /usr/bin/archbootstrap /vz/template/$DIST/$VERSION/$ARCH/ [MIRROR] | |
− | |||
− | |||
− | |||
− | + | {{Note|Please use mirrors ! A full list of Archlinux mirrors : http://wiki.archlinux.org/index.php/Mirror}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | == enter the Build with chroot == | |
− | |||
− | + | All the commands below are executed from the root shell. I this howto "chroot" is used to enter as NEWROOT, a BUILD-VE must not be created! | |
− | |||
− | + | VE0_# chroot /vz/template/$DIST/$VERSION/$ARCH/ | |
− | |||
− | + | === setting DNS server === | |
− | + | For the chroot BUILD we also need to specify a DNS for it: | |
− | + | BUILD_# mv /etc/resolv.conf.pacorig /etc/resolv.conf | |
− | + | ||
− | |||
− | + | === update and install packages === | |
− | + | Update (sync) pacman cache and update installed packages | |
− | |||
− | |||
+ | BUILD_# pacman -Syu | ||
− | |||
− | + | Install openssh (client and server) , quota-tools and iproute | |
− | + | BUILD_# pacman -S openssh quota-tools iproute | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | === fix /etc/mtab === | |
− | + | Add symlink /proc/mount /etc/mtab | |
− | + | BUILD_# ln -s /proc/mounts /etc/mtab | |
− | |||
− | + | === fix /etc/inittab === | |
− | + | Remove getties from inittab | |
− | + | BUILD_# sed -i -e '/getty/d' /etc/inittab | |
− | |||
− | + | === create device nodes === | |
− | + | Create device nodes at /dev, like console, full, null, zero, urandom, ptmx and fifo of initctl | |
− | + | BUILD_# mknod -m 600 /dev/console c 5 1 | |
− | + | BUILD_# mknod -m 666 /dev/tty c 5 0 | |
− | + | BUILD_# mknod -m 666 /dev/full c 1 7 | |
− | + | BUILD_# mknod -m 600 /dev/initctl p | |
− | + | BUILD_# mknod -m 666 /dev/null c 1 3 | |
− | + | BUILD_# mknod -m 666 /dev/ptmx c 5 2 | |
− | + | BUILD_# mkdir pts | |
− | + | BUILD_# mknod -m 666 /dev/random c 1 8 | |
− | + | BUILD_# mknod -m 444 /dev/urandom c 1 9 | |
− | + | BUILD_# mknod -m 666 /dev/zero c 1 5 | |
− | |||
− | + | === sysinit script modification === | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Remove deleting of /etc/mtab in /etc/rc.sysinit and add mounting of /dev/pts | Remove deleting of /etc/mtab in /etc/rc.sysinit and add mounting of /dev/pts | ||
− | + | BUILD_# nano /etc/rc.sysinit | |
− | + | <pre> | |
− | + | [...] | |
− | + | /bin/rm -f /etc/mtab | |
+ | [...] | ||
+ | </pre> | ||
to | to | ||
− | + | <pre> | |
− | + | [...] | |
− | + | #/bin/rm -f /etc/mtab | |
− | + | /bin/mount -t devpts none /dev/pts | |
+ | [...] | ||
+ | </pre> | ||
− | |||
− | + | === modify the main configuration file === | |
+ | BUILD_# nano /etc/rc.conf | ||
+ | <pre> | ||
# Localization | # Localization | ||
LOCALE="en_US.utf8" | LOCALE="en_US.utf8" | ||
Line 218: | Line 147: | ||
# Add openssh to DAEMONS, start at bootup ; ssh-keys are build on first VE start !!! | # Add openssh to DAEMONS, start at bootup ; ssh-keys are build on first VE start !!! | ||
DAEMONS=(syslog-ng network netfs crond ssh) | DAEMONS=(syslog-ng network netfs crond ssh) | ||
+ | </pre> | ||
+ | |||
− | + | === enable ssh connections === | |
{{Note|All connection are disabled to VE, see /etc/hosts.deny, only affected server built-in with libwrap}} | {{Note|All connection are disabled to VE, see /etc/hosts.deny, only affected server built-in with libwrap}} | ||
− | Allow ssh: | + | Allow ssh : |
+ | |||
+ | <pre> | ||
+ | BUILD_# echo "ssh: ALL : ALLOW" >> /etc/hosts.allow} | ||
+ | </pre> | ||
− | |||
− | + | === lock (disable) the root account === | |
− | + | BUILD_# passwd -l root | |
− | |||
− | + | === exit the chroot to VE0 === | |
− | + | BUILD_# exit | |
+ | |||
+ | |||
+ | == build a exclude list == | ||
Shrink the OS-Template, so not all files needed in a VE - OS - TEMPLATE | Shrink the OS-Template, so not all files needed in a VE - OS - TEMPLATE | ||
− | |||
− | + | Remove unused pacman backup files | |
− | + | VE0_# find ./ -name '*.pacorig' > ../exclude.list-$ARCH | |
− | |||
− | + | /etc/resolv.conf is added by vzctl: | |
− | + | VE0_# echo "etc/resolv.conf" >> ../exclude.list-$ARCH | |
− | |||
− | + | dont add downloaded pkg to ostemplate: | |
− | |||
− | + | VE0_# find ./var/cache/ -name '*.tar.gz' >> ../exclude.list-$ARCH | |
− | |||
− | + | we dont need no logs and historys | |
− | + | VE0_# find ./var/cache/ -name '*.tar.gz' >> ../exlcude.list-$ARCH | |
− | |||
− | + | VE0_# find ./root/.bash_history >> ../exclude.list-$ARCH | |
− | + | ||
+ | == create OS-Template == | ||
+ | |||
+ | VE0_# tar -X ../exclude.list-$ARCH -czf /vz/template/cache/arch-0.8-$ARCH-minimal.tar.gz ./ | ||
+ | |||
+ | |||
+ | == use the OS-Template == | ||
+ | |||
+ | VE0_# vzctl create <VEID> --ostemplate arch-0.8-$ARCH-minimal ... | ||
+ | |||
+ | |||
+ | == update the OS-Template == | ||
+ | |||
+ | to update a template is really easy, enter the build with chroot, performing upgrade task | ||
+ | |||
+ | VE0_# chroot /vz/template/$DIST/$VERSION/$ARCH/ 'pacman -Syu' | ||
Update the exclude list, and pack upgraded OS - Template | Update the exclude list, and pack upgraded OS - Template | ||
− | |||
− | + | == Links == | |
+ | |||
+ | Archlinux wiki http://wiki.archlinux.org/index.php/Main_Page | ||
+ | |||
[[Category: HOWTO]] | [[Category: HOWTO]] | ||
[[Category: Templates]] | [[Category: Templates]] |