存档在 ‘linux 应用’ 分类

Cacti中文版RPM快速安装

2009年12月15日

» 阅读更多: Cacti中文版RPM快速安装

Debian 5下的nginx+php+mysql的解决方案

2009年12月12日

» 阅读更多: Debian 5下的nginx+php+mysql的解决方案

nginx 进程异常终止受Single 25影响

2009年12月10日

» 阅读更多: nginx 进程异常终止受Single 25影响

常用的vsftpd配置

2009年12月10日

» 阅读更多: 常用的vsftpd配置

nginx出现空白页或图片下载了一半的问题

2009年12月8日

» 阅读更多: nginx出现空白页或图片下载了一半的问题

Apache通过mod_proxy联合Tomcat

2009年11月30日

» 阅读更多: Apache通过mod_proxy联合Tomcat

Debian Lenny xen server setup

2009年10月22日

Debian Lenny xen server setup

Posted Mon, 03/30/2009 – 16:34 by patrick

Printer-friendly versionSend to friend

<!–{12384361177770}-This guide describes the way I intalled my home server. The server is a Debian Lenny installation containing a variaty of virtual servers. The virtualisation is done by xen. This guides describes the proceses needed, commands issued and so on.

Good luck!

Step 1 – Basic installation

First install a minimal Lenny from a network boot machine.
(I assume you will manage this without desciption)

Step 2 – Change settings

We need to change the IP address of the server as we want it to have a static address (instead of an address issued by DHCP):

# nano /etc/network/interfaces

Change the following parts of this file

[...]
# The primary network
interface
allow-hotplug eth0
iface eth0 inet static
address      192.168.2.201
netmask      255.255.255.0
network      192.168.2.1
broadcast    192.168.2.255
gateway      192.168.2.1
# IPtables settings
[...]

Now restart the network device:

# ifdown eth0
# ifup eth0

Now we need to install the ssh-server to make maintainance a bit easier:

# apt-get install openssh-server

Step 3 – Install xen

Finally it is time to install our mighty xen:

# apt-get install xen-hypervisor-i386 linux-image-2.6-xen-686 linux-headers-2.6-xen-686 xen-utils-3.2-1 xen-tools bridge-utils

To make the consoles work we also need to make some changes to the inittab:

# nano /etc/inittab

Step 4 – Edit xen to make it work properly

After the installation there are still a few adjustments to make in order to get it running smoothly. Firstly we make the consoles work. Therefore we need to make some changes to the inittab:

# nano /etc/inittab

Change the following parts of this file

[…]
#
1:2345:respawn:/sbin/getty 38400 hvc0
2:23:respawn:/sbin/getty 38400 tty1
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
[…]

Also edit the /etc/xen/xend-config.sxp

# nano /etc/xen/xend-config.sxp

See the desciption on: http://www.howtoforge.com/virtualization-with-xen-on-debian-lenny-amd64

Next edit the xen-tools.conf

# nano /etc/xen-tools/xen-tools.conf

See the desciption on: http://www.howtoforge.com/virtualization-with-xen-on-debian-lenny-amd64

Finally we also need to make some adjustments to prevent the famous “clocksource/0: Time went backwards” error (or similar problems) by not using the xen clock. First we need to install ntp on the dom0:

# apt-get install ntp

Also see: http://wiki.debian.org/Xen

Then, later, we also have to take some steps into account for the domU, but we see about them later!

Now it is time to load our new (xen)kernel. Therefore, reboot the server:

# reboot

Step 5 – Create a domU (virtual server)

Let’s create a dumU:

# xen-create-image --hostname=<DOMAIN>.hanckmann.net --size=4Gb --swap=256Mb –ip=192.168.2.<IP ADDRESS> --memory=128Mb --arch=i386 –role=udev

For example:

# xen-create-image --hostname=apache.hanckmann.net --size=4Gb --swap=256Mb --ip=192.168.2.211 --memory=128Mb --arch=i386 –role=udev

Before we do anything else, we first prevent the famous “clocksource/0: Time went backwards” error. Edit the *.cfg file of the created domU domain:

# nano /etc/xen/<DOMAIN>.hanckmann.net.cfg

Now add (or expand) the extra line:

[…]
extra=”clocksource=jiffies”
[…]

This domU runs a standard Debian Lenny installation on the i386 platform with 4Gb disk space, 256Mb swap space and 128Mb memory.

Step 6 – Start the domU

Now it is time to start this domU. This is done via the command “xm create …cfg”. In my example I would issue the command:

# xm create /etc/xen/apache.hanckmann.net.cfg

Check if the domU managed to start by typing:

# xm list

The domU should be in that list.

To work with the domU we have to connect to its console. We do this via:

# xm console apache.hanckmann.net

Step 7 – Adjusting the domU

The domU needs some minor adjustments to make it work nicely. First we, again, go on to prevent the famous “clocksource/0: Time went backwards” error. Type:

# nano /etc/sysctl.conf

and add the line:

[…]
xen.independent_wallclock=1
[…]

Now install the ntp client on this machine:

# apt-get install ntp

To activate the changes without a reboot perform the following steps:

# sysctl -p
# echo "jiffies"> /sys/devices/system/clocksource/clocksource0/current_clocksource

Besides this it is a good idea to generate an rsa key so you can ssh into your virtual machine (sshserver is installed by default):

# ssh-keygen

You can also simply reboot the domU.

Step 8 – Exit the domU environment

To exit the domU environment type CTRL + ]

Step 9 – Read the following information sources

» 阅读更多: Debian Lenny xen server setup

apache2.0 prefork和worker模块性能调优

2009年6月2日

» 阅读更多: apache2.0 prefork和worker模块性能调优

TOMCAT6.0配置

2009年6月1日

TOMCAT6.0配置
» 阅读更多: TOMCAT6.0配置

[转+总结]Linux虚拟系统安装VMware Tools总结

2009年4月30日

» 阅读更多: [转+总结]Linux虚拟系统安装VMware Tools总结