Um in einem RedHat Enterprise Linux 4 System freevps für virtuelle Hosts nutzen zu können, werden folgende Pakete benötigt:
binary source for kernel
freeVPS tools
Anschließend ist das System zu booten.
/proc/vservers/setup
freevps version 1.5 freevps build 1142922805 syscall vserver 273 total contexts count 3 active contexts count 0
/proc/vservers/self
vserver id 0 nodename s15204930.online.de flags: e0 - ALLOW ANY UNREG IPs ALLOW ANY UNREG DEVs STARTED init pid: 0 CapBset: 00000000fffffeff CPU Hard Limit: 0 CPU Guaranteed Limit: 0 CPU Usage: 0 context priority: 0 Process Limit: 0 Process Count: 76 Memory Limit: 0 Kb Used memory : 28596 Kb Context RSS limit: 0 Kb Context RSS : 28596 Kb Max Total memory : 38276 Kb Max RSS memory : 38276 Kb Context swap : 0 Kb Disk Limit: 0 Kb Used disk memory : 1392 Kb Files limit: 0 Used files : 440 TCP sockets limit: 0 Established sockets: 1 Incoming traffic : 548 Kb Outgoing traffic : 0 Kb Char device allow: Block device allow:
virtueller mailserver tirimail
mkdir -p /vservers/tirimail/root vserver_ctl -c 2 -r vserver_limit -c 2 -v /vservers/tirimail -m 512m vserver tirimail build 2 Locking context 2...OK Unlocking context 2...OK Locking context 2...OK Directory /vservers/tirimail has been populated /etc/freevps/tirimail.conf has been created. Look at it! We're now at /vservers/tirimail directory Locking context 2...lockfile: Forcing lock on "/var/run/vserver-2.lock" OK [führt u.a. cp -ax /sbin /bin /etc /usr /var /lib /vservers/tirimail/ aus] real 809m32.297s user 0m3.119s sys 0m24.173s
/etc/freevps/tirimail.conf
# you need force assign context identify S_CONTEXT=2 # Setup VPS's virtual interfaces: # VDEVCFG="ethV:ethH:speed:flag,[flag...] ..." # where: # ethV - the virtual interface (eth0, eth1 ...) # ethH - the host interface to which you want to attach the virtual interface # speed - speed limit for this interface with 64k-step (i.e.: 128k, 384k, 8M) # flag - virtual interface's flags (see man 8 vifconfig for detail) # For example: # VDEVCFG="eth0:eth0:0 eth1:eth0:128K:local eth2:eth1:2M:-local" VDEVCFG="veth0:eth0:0" # Setup IPv4 addresses for VPS's virtual interfaces # These addresses must be unique for whole server's interfaces and aliases addresses # A virtual interface may have more than one address. # IPCFG="ethV:IPv4Address:Netmask ..." # For example: IPCFG="veth0:87.106.38.111:255.255.255.255" # You can define on which device the IP alias will be done # The IP alias will be set when the server is started and unset # when the server is stopped ONBOOT=yes # You can set a different host name for the vserver # If empty, the host name of the main server is used S_HOSTNAME=tirimail # You can set a different NIS domain for the vserver # If empty, the current on is kept # Set it to "none" to have no NIS domain set S_DOMAINNAME= # You can set the priority level (nice) of all process in the vserver # Even root won't be able to raise it S_NICE= # You can set various flags for the new security context # lock: Prevent the vserver from setting new security context # sched: Merge scheduler priority of all processes in the vserver # so that it acts a like a single one. # private: No other process can join this security context. Even root # Do not forget the quotes around the flags S_FLAGS="" # You can set various capabilities. By default, the vserver are run # with a limited set, so you can let root run in a vserver and not # worry about it. He can't take over the machine. In some cases # you can to give a little more capabilities (such as CAP_NET_RAW) # S_CAPS="CAP_NET_RAW" S_CAPS="CAP_NET_ADMIN CAP_NET_RAW"
virtuelles interface erstellen
vifconfig -c 2 -d veth0 -e vifconfig -c 2 -d veth0 -i 87.106.38.111 vifconfig -c 2 -d veth0 -n 255.255.255.255 vifconfig -c 2 -d veth0 -a eth0
/etc/sysconfig/network-scripts/ifcfg-veth0
DEVICE=veth0 BOOTPROTO=static BROADCAST=87.106.38.111 IPADDR=87.106.38.111 NETMASK=255.255.255.255 NETWORK=87.106.38.111 ONBOOT=yes TYPE=Ethernet
/etc/sysconfig/network
NETWORKING=yes HOSTNAME=tirimail GATEWAY=10.255.255.1
/etc/sysconfig/static-routes
any host 10.255.255.1 veth0 any net 0.0.0.0/0 gw 10.255.255.1 veth0
chkconfig
chkconfig network on chkconfig sshd on chkconfig syslog on
Einloggen auf das virtuelle System tirimail:
vserver tirimail enter
Virtuelles System tirimail stoppen:
vserver tirimail stop
Virtuelles System tirimail starten:
vserver tirimail start
cat /proc/vservers/2 (für ctx 2, hier tirimail)
vserver id 2 nodename tirimail flags: 80 - STARTED init pid: 0 CapBset: 00000000951cfdff CPU Hard Limit: 0 CPU Guaranteed Limit: 0 CPU Usage: 0 context priority: 0 Process Limit: 0 Process Count: 6 Memory Limit: 524288 Kb Used memory : 4608 Kb Context RSS limit: 0 Kb Context RSS : 4608 Kb Max Total memory : 4808 Kb Max RSS memory : 4808 Kb Context swap : 0 Kb Disk Limit: 0 Kb Used disk memory : 2275995 Kb Files limit: 0 Used files : 88 TCP sockets limit: 0 Established sockets: 1 lo(none): 0: 127.0.0.1/255.0.0.0; veth0(eth0): 0: 87.106.38.111/255.255.255.255; Incoming traffic : 117 Kb Outgoing traffic : 193 Kb Char device allow: Block device allow: