服务器在线 - 服务器软件 - 网站地图 服务器在线,专注于服务器技术!

当前位置:主页 > 云和虚拟化 > OpenVZ > 正文

Ubuntu系统安装OpenVZ虚拟机

时间:2015-01-09    来源:服务器在线    投稿:泡泡    点击:

8.04以前版本安装openvz方法:

1)     将ubuntu的默认Shell由Dash改为Bash

       $ln Csf /bin/bash /bin/sh

2)      禁用AppArmor

       $/etc/init.d/apparmor stop

       $update-rc.d Cf apparmor remove

       $apt-get remove apparmor apparmor-utils

3)     安装OpenVZ

       $apt-getinstall linux-openvz vzctl vzquota

10.04版本安装openvz方法(需重新编译带有openvz补丁的linux内核):

1) 安装openvz参考https://help.ubuntu.com/community/OpenVZ

2) 创建虚拟主机

a.      下载ubuntu10.04系统模版:

$wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz

$mv ubuntu-10.04-x86.tar.gz/var/lib/vz/template/cache/

b.      创建虚拟主机:

$vzctl create101 Costemplate ubuntu-10.04-x86

101为虚拟机的编号,100以下的id为openvz内部使用。

默认情况下虚拟机被创建在/var/lib/vz/private/101/下

配置文件在/etc/vz/conf/101.conf

c.      修改虚拟主机配置:

方式一:直接修改/etc/vz/conf/目录下相关配置文件

方式二:使用vzctl命令修改(可以实时生效)。

设置主机名为test.mytest.com,ip地址为192.168.2.100:

$ vzctl set 101 Chostnametest.mytest.com Csave

$ vzctl set 101 Cipadd192.168.2.100 Csave

设置允许的socket数量为480

$ vzctl set 101 Cnumothersock480 Csave

设置DNS服务器地址

$ vzctl set 101 -Cnameserver192.168.1.101 -Cnameserver 8.8.8.8 --save

d.      使用虚拟机

启用虚拟机:vzctl start 101

重新启动虚拟机:vzctl restart 101

进入虚拟机:vzctl enter 101

退出虚拟机:exit

停止虚拟机:vzctl stop 101

删除虚拟机:vzctl destroy 101

如果您的问题仍未解决,还可以加入服务器在线技术交流QQ群:8017413寻求帮助。


相关内容
最新热点内容
推荐内容