设为首页 收藏本站 订阅本站

blogger

CENTOS 下创建OPENVZ VPS命令

cache 发布于 技术文档 2014-06-26 [ 826 ] 次浏览 [ 0 ] 条评论

标签: OPENVZ

安装VE模版
下载需要安装的模板到/vz/template/cache目录(宿主机是Debain,则需要下载到/var/lib/vz/template/cache/目录)
# cd /vz/template/cache
# wget http://download.openvz.org/template/precreated/centos-6-x86.tar.gz
安装VE需要根据自己对VE的不同要求会有所不同,安装最基本的VE follow下面几步就可以

[[email protected] ~]# vzctl create 101 --ostemplate centos-6-x86
Creating container private area (centos-6-x86)
Performing postcreate actions
CT configuration saved to /etc/vz/conf/101.conf
Container private area was created
[[email protected] ~]# vzctl set 101 --hostname centos.ve1 --save
CT configuration saved to /etc/vz/conf/101.conf
[[email protected] ~]# vzctl set 101 --ipadd 192.168.0.10 --save
CT configuration saved to /etc/vz/conf/101.conf
[[email protected] ~]# vzctl set 101 --nameserver 192.168.0.1 --nameserver 8.8.8.8 --save
CT configuration saved to /etc/vz/conf/101.conf
设置密码 vzctl set 101 --userpasswd root:root
设置磁盘 vzctl set 101 --diskspace 10G:10G --save
设置内存 vzctl set 101 --ram 512M --swap 1G --save
设置cpu vzctl set 101 --cpuunits 10000 --save
全部帮助 vzctl --help

启动VE
[[email protected] ~]# vzctl start 101
Starting container ...
Container is mounted
Adding IP address(es): 192.168.0.10
Setting CPU units: 1000
Container start in progress...
进入VE
[[email protected] ~]# vzctl enter 101
entered into CT 101
[[email protected] /]#
退出VE
[[email protected] /]# exit
logout
exited from CT 101
[[email protected] ~]#
停止VE
[[email protected] ~]# vzctl stop 101
Stopping container ...
Container was stopped
Container is unmounted
销毁VE
[[email protected] ~]# vzctl destroy 101
Destroying container private area: /vz/private/101
Container private area was destroyed
查看正在宿主机上正在运行的VE
[[email protected] ~]# vzlist
CTID NPROC STATUS IP_ADDR HOSTNAME
101 17 running 192.168.0.10 centos.ve1

 

vzctl set 245 --privvmpages 2048m:4096m --vmguarpages 1024m --oomguarpages 1024m --save

 

CENTOS 下创建OPENVZ VPS命令:等您坐沙发呢!

发表评论