OpenVZ+HyperVM安装
今天把简单的OPENVZ和HYPERVM的安装过程写一个,留下做个记号!
系统:CentOS 5.1 for vmware6.0
系统安装就不说了,选最简单的安装就行,还有把防火墙,SELinux关闭就了!
[root@localhost ~]# uname -r
2.6.18-53.el5
2.6.18-53.el5
[root@localhost ~]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-53.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-53.el5.img
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-53.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-53.el5.img
安装openvz
cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
wget http://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
yum install ovzkernel
[root@bogon ~]# uname -r
2.6.18-92.1.13.el5.028stab059.6
2.6.18-92.1.13.el5.028stab059.6
安装完之后,会修改启动项,会把vz内核放到第一项去
[root@bogon ~]# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS OpenVZ (2.6.18-92.1.13.el5.028stab059.6)
root (hd0,0)
kernel /vmlinuz-2.6.18-92.1.13.el5.028stab059.6 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-92.1.13.el5.028stab059.6.img
title CentOS (2.6.18-53.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-53.el5.img
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS OpenVZ (2.6.18-92.1.13.el5.028stab059.6)
root (hd0,0)
kernel /vmlinuz-2.6.18-92.1.13.el5.028stab059.6 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-92.1.13.el5.028stab059.6.img
title CentOS (2.6.18-53.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-53.el5.img
安装vz工具
yum install vzctl vzquota
修改sysctl.conf
vi /etc/sysctl.conf
..........
net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
kernel.sysrq = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.conf.default.forwarding=1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
kernel.sysrq = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.conf.default.forwarding=1
..........
sysctl -p (使sysctl.conf生效)
修改/etc/vz/vz.conf
vi /etc/sysconfig/selinux
........
SELINUX=disabled
........
........
SELINUX=disabled
........
好了,OPENVZ就这安装好了,接下来安装hypervm
chmod 777 hypervm-install-master.sh
./hypervm-install-master.sh --virtualization-type=openvz
./hypervm-install-master.sh --virtualization-type=openvz
好了,,等他安装完再重启就OK了。
由于HyperVM的脚本在安装时,需要从官网下载大量的软件包,特别是OpenVZ的OSTemplate模板,数据量大,但传输速率又特别慢。为此,我在本地模拟了一个download.lxlabs.com的环境,把必要的软件包先预存放在服务器上。内容如下:
除了vpstemplate下的文件外,其他软件都是必须的。其中,repodata的内容,可以使用createrepo命令自动生成。
本地下载:
然后在/etc/hosts中加入本地到download.lxlabs.com的指向,并启动httpd服务:
引用
# cd /var/www/html/
# tree download/
download/
|-- hypervm
| `-- production
| `-- hypervm
| `-- hypervm-current.zip
|-- hypervm-thirdparty.2008.zip
|-- program-install.zip
|-- update
| |-- lxgeneral
| | `-- repodata
| | |-- filelists.xml.gz
| | |-- other.xml.gz
| | |-- primary.xml.gz
| | `-- repomd.xml
| `-- rhel-5.2
| `-- x86_64
| |-- lxphp
| | `-- lxphp-5.2.1-200.i386.rpm
| |-- lxprg
| | |-- lxlighttpd-1.4.18-5.i386.rpm
| | `-- lxzend-3.3-100lxa.i386.rpm
| `-- repodata
| |-- filelists.xml.gz
| |-- other.xml.gz
| |-- primary.xml.gz
| `-- repomd.xml
`-- vpstemplate
`-- centos-5-i386-afull.tar.gz
# tree download/
download/
|-- hypervm
| `-- production
| `-- hypervm
| `-- hypervm-current.zip
|-- hypervm-thirdparty.2008.zip
|-- program-install.zip
|-- update
| |-- lxgeneral
| | `-- repodata
| | |-- filelists.xml.gz
| | |-- other.xml.gz
| | |-- primary.xml.gz
| | `-- repomd.xml
| `-- rhel-5.2
| `-- x86_64
| |-- lxphp
| | `-- lxphp-5.2.1-200.i386.rpm
| |-- lxprg
| | |-- lxlighttpd-1.4.18-5.i386.rpm
| | `-- lxzend-3.3-100lxa.i386.rpm
| `-- repodata
| |-- filelists.xml.gz
| |-- other.xml.gz
| |-- primary.xml.gz
| `-- repomd.xml
`-- vpstemplate
`-- centos-5-i386-afull.tar.gz
除了vpstemplate下的文件外,其他软件都是必须的。其中,repodata的内容,可以使用createrepo命令自动生成。
本地下载:
下载文件
然后在/etc/hosts中加入本地到download.lxlabs.com的指向,并启动httpd服务:
# echo "192.168.228.30 download.lxlabs.com" >> /etc/hosts
# service httpd start
# service httpd start
启动hypervm服务:
# service hypervm start
/usr/local/lxlabs/hypervm/httpdocs
Starting hypervm: mysqld (pid 8554) 正在运行...
Started hypervm
/usr/local/lxlabs/hypervm/httpdocs
Starting hypervm: mysqld (pid 8554) 正在运行...
Started hypervm
简单使用
1、首次使用
首次进入,会提示您修改默认密码,输入两次新密码后,用update保存:
1、首次使用
首次进入,会提示您修改默认密码,输入两次新密码后,用update保存:
然后,会再提示您配置Lxguard设置,这是一个安全控制的配置。主要是可设置密码尝试次数,防止密码暴力破解,及设置允许访问的白名单IP信息,禁止的黑名单等:
然后,会再提示您配置Lxguard设置,这是一个安全控制的配置。主要是可设置密码尝试次数,防止密码暴力破解,及设置允许访问的白名单IP信息,禁止的黑名单等:
启动smtp服务: # service postfix start
然后,会再提示您配置Lxguard设置,这是一个安全控制的配置。主要是可设置密码尝试次数,防止密码暴力破解,及设置允许访问的白名单IP信息,禁止的黑名单等:
启动smtp服务: # service postfix start
甚至还会有提示您做好服务器上的ssh安全设定等:
2、创建VPS
建议先创建IP Pools,今后虚拟机可从中自行调用该地址池:
(Gateway对于openvz没有意义,只对xen有用。记住,在最下面需要把允许使用该IP Pools的服务器选上)
然后创建Resource Plans:
最后,创建vps:
2、创建VPS
建议先创建IP Pools,今后虚拟机可从中自行调用该地址池:
(Gateway对于openvz没有意义,只对xen有用。记住,在最下面需要把允许使用该IP Pools的服务器选上)
然后创建Resource Plans:
最后,创建vps:
网上提供了破解方法
请参考:这里。(留意代码中全角双引号问题)
我用以下内容覆盖原来的:/usr/local/lxlabs/hypervm/httpdocs/display.php
请参考:这里。(留意代码中全角双引号问题)
我用以下内容覆盖原来的:/usr/local/lxlabs/hypervm/httpdocs/display.php
<?php
function crack( )
{
global $gbl;
global $sgbl;
global $login;
global $ghtml;
$license = $login->getObject( "license" );
$name = $license->licensecom_b->lic_ipaddress;
if ( stristr($name,"Bendy")) {
return;
}
$license->licensecom_b->lic_ipaddress = "crack by www.dezend.cc Bendy ".stristr($name,"(");
$license->licensecom_b->lic_domain_num = "Unlimited";
$license->licensecom_b->lic_pserver_num = "Unlimited";
$license->licensecom_b->lic_maindomain_num = "Unlimited";
$license->licensecom_b->lic_vps_num = "Unlimited";
$license->licensecom_b->maindomain_num = "Unlimited";
$license->licensecom_b->domain_num = "Unlimited";
$license->licensecom_b->vps_num = "Unlimited";
$license->licensecom_b->pserver_num = "Unlimited";
$license->licensecom_b->client_num = "Unlimited";
$login->priv->maindomain_num = "Unlimited";
$login->priv->pserver_num = "Unlimited";
$login->priv->vps_num = "Unlimited";
$license->setUpdateSubaction( );
$license->write( );
$login->setUpdateSubaction( );
$login->write( );
throw new lxException ("Crack OK! your have Unlimited domain/vps NUM and full fuction now!", "");
exit;
}
$v = 0;
include_once( "htmllib/coredisplaylib.php" );
sleep( $v );
print_time( "start" );
display_init( );
print_time( "start", "Start" );
crack();
display_exec( );
?>
function crack( )
{
global $gbl;
global $sgbl;
global $login;
global $ghtml;
$license = $login->getObject( "license" );
$name = $license->licensecom_b->lic_ipaddress;
if ( stristr($name,"Bendy")) {
return;
}
$license->licensecom_b->lic_ipaddress = "crack by www.dezend.cc Bendy ".stristr($name,"(");
$license->licensecom_b->lic_domain_num = "Unlimited";
$license->licensecom_b->lic_pserver_num = "Unlimited";
$license->licensecom_b->lic_maindomain_num = "Unlimited";
$license->licensecom_b->lic_vps_num = "Unlimited";
$license->licensecom_b->maindomain_num = "Unlimited";
$license->licensecom_b->domain_num = "Unlimited";
$license->licensecom_b->vps_num = "Unlimited";
$license->licensecom_b->pserver_num = "Unlimited";
$license->licensecom_b->client_num = "Unlimited";
$login->priv->maindomain_num = "Unlimited";
$login->priv->pserver_num = "Unlimited";
$login->priv->vps_num = "Unlimited";
$license->setUpdateSubaction( );
$license->write( );
$login->setUpdateSubaction( );
$login->write( );
throw new lxException ("Crack OK! your have Unlimited domain/vps NUM and full fuction now!", "");
exit;
}
$v = 0;
include_once( "htmllib/coredisplaylib.php" );
sleep( $v );
print_time( "start" );
display_init( );
print_time( "start", "Start" );
crack();
display_exec( );
?>