您的位置:首页 > 运维架构

如何在OpenVZ下安装管理软件HyperVM 建立VPS服务

2011-12-26 02:36 429 查看
转载自: http://www.hostdon.com/thread-37-1-1.html

OpenVZ是开源软件,是基于Linux平台的操作系统级服务器虚拟化解决方案。OpenVZ采用SWsoft的Virutozzo虚拟化服务器软件产品的内核,Virutozzo是SWsoft公司提供的商业虚拟化解决方案。

OpenVZ可以在单个物理服务器上创建多个隔离的虚拟专用服务器(VPS)并以最大效率共享硬件和管理资源。每个VPS的运行和独立服务器完全一致,因其自身的用户、应用程序都可以独立重起,它拥有根访问权限、用户、IP地址、内存、处理器、文件、应用服务、系统库文件和配置文件等。拥有轻量级处理损耗和高效设计的OpenVZ是运行应用服务和实时数据生产型服务器虚拟化的最佳选择。OpenVZ软件同时为用户提供工具,协助自动化管理虚拟服务器。基于模板的应用程序部署可以在几分钟内用简单的方法创建新的虚拟服务器并投入使用,而且与其他的虚拟化技术相比,OpenVZ可以在每CPU上运行几倍于其他虚拟化服务器技术的虚拟化服务器。

从应用程序和VPS用户的角度来看,每个VPS是完全独立的系统,这种独立性由位于系统内核之上的虚拟化层来提供。注意仅有极小的CPU资源消耗在虚拟化过程中(大约1-2%)。OpenVZ虚拟化层实现的主要特性包括:

◆VPS看起来像一套普通的Linux系统。它具有标准的启动脚本、软件厂商提供的科可以运行在VPS内部的软件而无需为OpenVZ做特别的修改或调整;

◆用户可以修改任何配置文件和安装其他软件;

◆VPS相互之间完全隔离(包括文件系统,进程,内部进程通讯(IPC),sysct1变量);

◆VPS不会绑定在一个CPU上,可以使用所有的CPU资源。属于某个VPS的进程可以运行在所有可获得的CPU之上。
【自述】

HyperVM可以提供方便易用的管理,是管理更多的VPS或者虚拟机客户变得轻松,具体选项–virtualization-type供选择的参数有三个:xen/openvz/NONE,分别对应部署xen环境、部署openvz环境和不用部署虚拟机环境,若在已经部署好虚拟机环境的服务器上安装,则应使用NONE模式。
【准备工作】
需要一台差不多的服务器,不然速度很慢,我使用的是国外的

Dual Xeon 2.8GHZ Dedicated  Server

速度还算可以,尤其是下载HyperVM安装包里面的东西很快,国内的可能很慢,因为源在国外。

其次先安装好OpenVZ环境,如果不知道怎么安装可以搜索下,

下来说说,HyperVM安装:

——————————————————————————————————

先关闭掉 SELinux. Open  /etc/sysconfig/selinux…

vi /etc/sysconfig/selinux

SELINUX to disabled

如果你的一样就不要修改了

————————————

# This file controls the state of SELinux on the system.

#  SELINUX= can take one of these three values:

# enforcing – SELinux security  policy is enforced.

# permissive – SELinux prints warnings instead of  enforcing.

# disabled – SELinux is fully disabled.

SELINUX=disabled

#  SELINUXTYPE= type of policy in use. Possible values are:

# targeted – Only  targeted network daemons are protected.

# strict – Full SELinux  protection.

SELINUXTYPE=targeted

——————————————————————

接下来运行:

_____

setenforce 0

______________

再下来检查下

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

不一样的话修改后运行

sysctl  -p (使sysctl.conf生效)

————————————————————————————————

然后,修改/boot/grub/menu.lst,设置为从OpenVZ的核心启动。

具体可能跟这个不一样,自行修改

[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

重启服务器后,查看vz服务是否正常即可。

——————————————————

接下来HyperVM安装:

【注意引用内容】

1、mysql的问题

HyperVM在安装时,需要在mysql中创建库和导入数据,所以,mysql应为默认安装,不要设置任何密码,否则请先删除后重装mysql:

# rm -rf /var/lib/mysql

# rpm -e mysql-server

# rm  /var/log/mysqld.log.rpmsave

# yum install mysql-server

※  注意,若您的服务器上已有mysql的数据,请注意备份。或参考网上的资料,清空mysql的管理员密码。

本次例子未执行这部,一般情况下服务器已经安装。

————————————————————————————————

2.开始安装:

在系统下执行

#  wget http://download.lxlabs.com/downl ... m-install-master.sh

#  sh ./hypervm-install-master.sh –virtualization-type=openvz(可选项)

安装完成后会显示:

FINISHED –21:25:15–

Downloaded: 6 files, 601M in 1m 13s (8.29  MB/s)

Executing Update Cleanup… Will take a long time to  finish….

Congratuations. hyperVM has been installed succesfully on your  server as master

You can connect to the server at https://:8887 or http://:8888
Please note that first is secure ssl  connection, while the second is normal one.

The login and password are  ‘admin’ ‘admin’. After Logging in, you will have to change your password to  something more secure

Thanks for choosing hyperVM to manage your Server, and  allowing us to be of service

***There is one more step you have to do to make this complete. Open  /etc/grub.conf, and change the ‘default=1′ line to ‘default=0′, and reboot this  machine. You will be rebooted into the openvz kernel and will able to manage  vpses from the hyperVM interface

接下来启动hypervm服务,不然不能打开后台!

[root@po ~]#  service hypervm start

/usr/local/lxlabs/hypervm/httpdocs

Starting hypervm:  cat: /usr/local/lxlabs/hypervm//pid/wrapper.pid: No such file or  directory

mysqld (pid 6582) is running…

Started hypervm

这样hypervm就完成安装,可以用
https://ip地址:8887 http://ip地址:8888
登陆管理了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息