| 1 |
# uml_setup-vhosts |
| 2 |
#---------------------------------- |
| 3 |
# make directory's |
| 4 |
mkdir /home/uml/<vhost-name> |
| 5 |
mkdir /home/uml/<vhost-name>/rootfs |
| 6 |
mkdir/home/uml/<vhost-name>/datafs |
| 7 |
|
| 8 |
#---------------------------------- |
| 9 |
# make 500MB ext3 root-filesystem |
| 10 |
cd /home/uml/<vhost-name>/rootfs |
| 11 |
dd if=/dev/zero of=root_fs.ext3 bs=4k count=$(((500*1024)/4)) |
| 12 |
# If ask 'Proceed anyway= (y,n)' answer 'y' |
| 13 |
mke2fs -j root_fs.ext3 |
| 14 |
# Setting interval between auto. check to 0 seconds |
| 15 |
tune2fs -i 0 root_fs.ext3 |
| 16 |
|
| 17 |
#------------------------------------- |
| 18 |
# make 1000MB reiserfs data-filesystem |
| 19 |
cd /home/uml/<vhost-name>/datafs |
| 20 |
dd if=/dev/zero of=data_fs.reiserfs bs=4k count=$(((1000*1024)/4)) |
| 21 |
mkreiserfs -f -f data_fs.reiserfs |
| 22 |
|
| 23 |
#----------------------------------- |
| 24 |
# mount loop filesystem |
| 25 |
mount -o loop <dev> <dir> |
| 26 |
|
| 27 |
#---------------------------------- |
| 28 |
# resize UNMOUNTED (loop)filesystem |
| 29 |
# from 1000MB to 2500MB |
| 30 |
dd if=/dev/zero bs=4k count=$(((2500*1024)/4)) >> data_fs |
| 31 |
|
| 32 |
# declare file 'data_fs' as loop_fs device |
| 33 |
losetup /dev/loop0 datafs |
| 34 |
|
| 35 |
# delete loop_fs device |
| 36 |
losetup -d /dev/loop0 |
| 37 |
|
| 38 |
# for ext2/3: |
| 39 |
# check filesystem |
| 40 |
e2fsck -p (-j) /dev/loop0 |
| 41 |
# resize fs |
| 42 |
ext2resize /dev/loop0 |
| 43 |
|
| 44 |
# for reiserfs: |
| 45 |
# check fs |
| 46 |
reiserfsck --check /dev/loop0 |
| 47 |
# resize fs |
| 48 |
resize_reiserfs -f /dev/loop0 |
| 49 |
|
| 50 |
|
| 51 |
#----------------------------- |
| 52 |
# Create a 'swap' image: |
| 53 |
cd /home/uml/<vhost-name> |
| 54 |
dd if=/dev/zero of=swap bs=$((1024*1024)) count=128 |
| 55 |
mkswap swap |
| 56 |
|
| 57 |
#---------------------------------- |
| 58 |
# Now boot your vhost (with ie. 'ubd2=data_fs') and |
| 59 |
# mount the new partition |
| 60 |
mount /dev/ubd/2 /home |
| 61 |
|
| 62 |
# if success you're in buisness |
| 63 |
# now modify /etc/fstab to mount the new partition at boot-time |
| 64 |
<snipped fstab start> |
| 65 |
/dev/ubd/0 / ext3 defaults,errors=remount-ro 0 1 |
| 66 |
/dev/ubd/1 none swap sw 0 0 |
| 67 |
proc /proc proc defaults 0 0 |
| 68 |
/dev/ubd/2 /home reiserfs defaults 0 1 |
| 69 |
<snipped fstab end> |
| 70 |
|
| 71 |
|
| 72 |
#-------------------------------- |
| 73 |
# NETWORK (tun/tap) |
| 74 |
# |
| 75 |
# Host configuration |
| 76 |
For Tun/tap to work, it must be compiled in or as module of the hosts kernel |
| 77 |
Install package uml-utilities which includes needed binary 'tunctl' , e.g. on Debian do: |
| 78 |
:#apt-get install uml-utilities |
| 79 |
|
| 80 |
# create tun network dev only if it does not exists |
| 81 |
mkdir /dev/net (only if not exists!) |
| 82 |
mknod /dev/net/tun c 10 200 |
| 83 |
|
| 84 |
# create tap device(s) |
| 85 |
tunctl -u <userid> <tap-device> |
| 86 |
e.g. |
| 87 |
tunctl -u barny tap2 (example if tap0 and tap1 already exists) |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
#--------------------------------------------------- |
| 95 |
# files which have to modified for debian woody root_fs |
| 96 |
# network |
| 97 |
/etc/network/interfaces |
| 98 |
|
| 99 |
# hostname |
| 100 |
/etc/hostname |
| 101 |
|
| 102 |
# hosts |
| 103 |
/etc/hosts |
| 104 |
|
| 105 |
# resolv.conf |
| 106 |
/etc/resolv.conf |
| 107 |
|
| 108 |
# fstab |
| 109 |
/etc/fstab |
| 110 |
|
| 111 |
# httpd.conf |
| 112 |
/usr/local/apache-2.0.36/conf/httpd.conf |
| 113 |
|
| 114 |
# mail |
| 115 |
/etc/mail/sendmail.cf |
| 116 |
/etc/mail/sendmail.mc |
| 117 |
/etc/mail/local-host-names |
| 118 |
|
| 119 |
# set hostname for amavis (not recommend) |
| 120 |
/etc/amavisd.conf |
| 121 |
|
| 122 |
# modified data_fs |
| 123 |
# apache examples |
| 124 |
/data/www/main/examples/ |
| 125 |
|