Changes

Jump to: navigation, search

Slackware template creation

86 bytes added, 08:54, 28 May 2011
Edit /etc/rc.d/rc.syslog
This page is about making a template cache for OpenVZ [[VEcontainer]] from Slackware linux.
(This method was used for creating the minimal cache from Slackware 10.2)
The method is basically the same as described in article [[Debian template creation]].
=== Downloading and installing Slackware ===
First you need to download Slackware linux from [http://www.slackware.org/getslack/ http://www.slackware.org/getslack/]. Then you have to [http://www.slackware.org/install/ install] it to some hardware you can spare while the cache creation process is going on. For [[VEcontainer]] creation it is recommended not to install any unnecessary software into the box you are making the cache from.
This means for a minimal Slackware 10.2 cache I have chosen only series A (<tt>Base Linux System</tt>) at the package series selection screen of Slackware Setup. Then '''expert''' prompting mode on the next screen. On the Series A package selection screen I chose the following packages:
* dcron
* devs
* e2fsprogs <i>- This is not really needed for a VEcontainer, but let him install it</i>
* elvis
* etc
After selecting these packages just install the kernel and lilo, you are ready to run Slackware!
=== Configuring Slackware for acting as a VE container ===
Now that you have a running minimal Slackware installation, You can begin to prepare it to be
a template for a [[VEcontainer]]. First you need some additional packages, 7 exactly: * groff-1.19.1-i486-3.tgz <i>from the slackware/ap directory of installation media</i>* man-1.5p-i486-1.tgz <i>from the slackware/ap directory of installation media</i>* quota-3.12-i486-1.tgz <i>from the slackware/ap directory of installation media</i>* iptables-1.3.3-i486-1.tgz <i>from the slackware/n directory of installation media</i>* openssh-4.2p1-i486-1.tgz <i>from the slackware/n directory of installation media</i>* tcpip-0.17-i486-35.tgz <i>from the slackware/n directory of installation media</i>* whois-4.6.16-i486-1.tgz <i>from the slackware/n directory of installation media</i>
{| class="wikitable"
|+ '''List of additional packages'''
! Package !! Directory of installation media to take the package from
|-
| groff-1.19.1-i486-3.tgz || slackware/ap
|-
| man-1.5p-i486-1.tgz || slackware/ap
|-
| quota-3.12-i486-1.tgz || slackware/ap
|-
| iptables-1.3.3-i486-1.tgz || slackware/n
|-
| openssh-4.2p1-i486-1.tgz || slackware/n
|-
| tcpip-0.17-i486-35.tgz || slackware/n
|-
| whois-4.6.16-i486-1.tgz || slackware/n
|}
You can install these packages issuing the following command:
<pre>
# installpkg <packagename>
</pre>
After these steps, you are ready to move your Slackware installation into a [[VEcontainer]].
=== Moving a Slackware installation into a VE container ===
I did it by compressing the whole filesystem into a tgz file and copying it to the host running OpenVZ.
Compressing it is easy:
<pre>
# tar --numeric-owner -czf /slackware.tgz --exclude /slackware.tgz /
</pre>
But to copy it, you need to setup a network device on the slackware system (use <tt>ifconfig</tt> and <tt>ftp</tt> ) or manually remove the hard drive containing the Slackware installation and copying copy the tgz file from there.
After you got the tgz file on the host, make a new directory into <tt>/vz/private </tt> with a new VPSIDCTID, ''for example '' 777.Uncompress the tgz file into this directory and delete itremove the tgz.
<pre>
mv slackware.tgz /vz/private/777
</pre>
== Preparing the new VE container ==
=== Creating a new .conf file container config ===
Now you need to create the config configuration file for the Slackware [[VEcontainer]], 777.conf.:
<pre>
</pre>
You need to set it's OSTEMPLATE.<pre>echo "OSTEMPLATE=slackware-10.2-i486-minimal" >> /etc/sysconfig/vz-scripts/777.conf</pre> And an IP address and a Hostname<pre>vzctl set 777 --ipadd x.x.x.x --savevzctl set 777 --hostname myslacky --save</pre> === Getting the filesystem ready to run in a VE container ===
Now you need to make some minor alterations under the /vz/private/777 directory.
</pre>
==== Delete all keys from /vz/private/777/etc/ssh ====
<pre>
rm /vz/private/777/etc/ssh/*key*
</pre>
This will ensure that a unique ssh key is generated for every single [[VEcontainer]] at the first boot.
Edit ssh_config and sshd_config here if you want.
<pre>
rm /vz/private/777/etc/mtab
ln -s /proc/mounts /vz/private/777/etc/mtab /proc/mouns
</pre>
</pre>
==== Edit /vz/private/777/etc/inittab ====
Edit /vz/private/777/etc/inittab, put a hashmark (#) before the lines containing ====:
<pre>
c?:1235:respawn:/sbin/agetty 38400 tty? linux
This will prevent linux gettys to spawn.
==== Edit /vz/private/777/etc/shadow====
Edit <tt>/vz/private/777/etc/shadow</tt>, change root's password in the first line to an exclamation mark (<tt>!</tt>):
<pre>
#root:!:13305:0:::::
</pre>
This will disable the root login until the password chaned changed with "<tt>vzctl set VPSID CTID --userpasswd root:xxx"</tt>.
==== Edit /vz/private/777/etc/rc.d/rc.S ====
Edit <tt>/vz/private/777/etc/rc.d/rc.S</tt>, put putting a hashmark (<tt>#</tt>) before as the first character of the line containing:
<pre>
/bin/rm -f /etc/mtab*
</pre>
This should be line 162(239 - slackware 13.1). This will forbid Slackware to delete our symlink at every reboot.
==== Edit /vz/private/777/etc/rc.d/rc.syslog ====
Edit <tt>/vz/private/777/etc/rc.d/rc.syslog</tt> file, put a hashmark (<tt>#</tt>) before the lines containing
<pre>
sleep 1
killall klogd 2> /dev/null
</pre>
These should be lines 11, 12, 15 and 21. This will prevent <tt>klogd </tt> (which is usually not needed) from starting at boottimeboot timeSlackware 13.1 (12.0 and newest)<pre>chmod -x /vz/private/777/etc/rc.d/rc.syslog</pre> {{Note|if you are going to use iptables rules inside your Slackware containers which will do logging (i.e. the ones with the <tt>LOG</tt> target), you should not disable <tt>klogd</tt>.}}
== Testing the new VE container and making a cache file ==
=== Testing the new VE container ===
To test the new [[VEcontainer]], simply start it:
<pre>
vzctl start 777
</pre>
If you did everythingall everything all right (and I didn't make a mistake herethis article is correct) your new slackware Slackware [[container]] will boot.
If the VE container booted, and you can enter/ssh in to it, then stop it.:
<pre>
vzctl stop 777
=== Making a cache file ===
Now make a .tar.gz out of the [[VEcontainer]]:
<pre>
tar czf /vz/template/cache/slackware-10.2-i486-minimal.tar.gz /vz/private/777/
Anonymous user

Navigation menu