forked from RogerSik/OpenVZ-Template-Creator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
2_install_ubuntu_karmic.sh
executable file
·89 lines (72 loc) · 2.52 KB
/
2_install_ubuntu_karmic.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
#
# OpenVZ Template OS Creator
# http://github.com/RogerSik/OpenVZ-Template-Creator
#
rm /etc/init/tty*
mkdir /etc/init
cat << EOF > /etc/init/openvz.conf
# OpenVZ – Fix init sequence to have OpenVZ working with upstart
# by http://blog.bodhizazen.net/linux/openvz-ubuntu-9-10-templates/
description "Fix OpenVZ"
start on startup
task
pre-start script
mount -t proc proc /proc
mount -t devpts devpts /dev/pts
mount -t sysfs sys /sys
mount -t tmpfs varrun /var/run
mount -t tmpfs varlock /var/lock
mkdir -p /var/run/network
touch /var/run/utmp
chmod 664 /var/run/utmp
chown root.utmp /var/run/utmp
if [ "$(find /etc/network/ -name upstart -type f)" ]; then
chmod -x /etc/network/*/upstart || true
fi
end script
script
start networking
initctl emit filesystem --no-wait
initctl emit local-filesystems --no-wait
initctl emit virtual-filesystems --no-wait
init 2
end script
EOF
cat << EOF > /etc/apt/sources.list
deb http://de.archive.ubuntu.com/ubuntu karmic main #restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu karmic main #restricted universe multiverse
deb http://de.archive.ubuntu.com/ubuntu karmic-updates main #restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu karmic-updates main #restricted universe multiverse
deb http://de.archive.ubuntu.com/ubuntu karmic-security main #restricted universe multiverse
deb-src http://de.archive.ubuntu.com/ubuntu karmic-security main #restricted universe multiverse
#deb http://de.archive.ubuntu.com/ubuntu karmic-backports main #restricted universe multiverse
#deb-src http://de.archive.ubuntu.com/ubuntu karmic-backports main #restricted universe multiverse
EOF
cat << EOF > /etc/fstab
proc /proc proc defaults 0 0
none /dev/pts devpts rw 0 0
EOF
apt-get update
apt-get dist-upgrade -y
apt-get install anacron aptitude bc language-pack-en language-pack-de bash-completion logrotate ssh sshfs lsof man nano quota rsync vim wget -y
apt-get clean
# Link /etc/mtab to /proc/mounts, so df and friends will work:
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
update-rc.d -f mtab.sh remove
# tun and fuse device create
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
mknod /dev/fuse c 10 229
# Netzwerk
echo "hostname" > /etc/hostname
echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
# Note: the warning "/sbin/MAKEDEV: warning: can't read /proc/devices" is safe to ignore.
cd /dev && /sbin/MAKEDEV ptyp && cd /
#umount /dev
umount /proc
#umount /sys
# the real password set OpenVZ!
passwd