> /etc/apt/sou">
摘要:由于服务器加了内存,所以开始得瑟打算加些应用。玩玩虚拟主机吧.... 于是开始市场调查... vmware(用过,之前跑的跟蜗牛似的),于是乎 openvz,下面说说怎么装的.... root权限增加资源、下载key echo -e \"ndeb http://download.openvz.org/debian-systs etch openvz\" >> /etc/apt/sou
由于服务器加了内存,所以开始得瑟打算加些应用。玩玩虚拟主机吧....
于是开始市场调查... vmware(用过,之前跑的跟蜗牛似的),于是乎 openvz,下面说说怎么装的....
root权限增加资源、下载key
echo -e "ndeb/etc/apt/sources.list wget -q http://download.openvz.org/debian-systs/dso_archiv_signing_key.asc -O- | apt-key add - && apt-get update
更新系统
[sudo] apt-get update [sudo] apt-get dist-upgrade查询应该能找到
[sudo] apt-cache search linux-image*openvz* linux-image-openvz-686 - Linux for modern PCs (meta-package), OpenVZ support
安装
[sudo] apt-get install linux-image-openvz-amd64 [sudo] apt-get install iproute libatm1 rsync vzctl vzquota安装后重启看看....
选择新的openvz内核
看看是否安装成功
1. Kernel:
# uname -r 2.6.26-2-openvz-amd64
2. 查看进程:
# ps ax | grep vz 2349 ? S 0:00 [vzmond]
3. 查看网络:
# ifconfig venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)都显示了,开始下一步的安装,我装的是amd的,随意
[sudo] apt-get install vzctl-ostmpl-debian-5.0-i386-minimal [sudo] apt-get install vzctl-ostmpl-debian-5.0-amd64-minimal设置 sysctl
[sudo] nano /etc/sysctl.conf粘贴如下内容
# On Hardware Node we generally need # packet forwarding enabled and proxy arp disabled net.ipv4.conf.default.forwarding=1 net.ipv4.conf.default.proxy_arp=0 net.ipv4.ip_forward=1 # Enables source route verification net.ipv4.conf.all.rp_filter=1 # Enables the magic-sysrq key kernel.sysrq=1 # TCP Explict Congestion Notification #net.ipv4.tcp_ecn=0 # we do not want all our interfaces to send redirects net.ipv4.conf.default.send_redirects=1 net.ipv4.conf.all.send_redirects=0
[sudo] sysctl -p加入管道(非必要项目)
[sudo] ln -s /var/lib/vz /vz设置虚拟机
vzctl create 221 --ostemplate debian-5.0-amd64-minimal vzctl set 221 --onboot yes --save vzctl set 221 --hostname mx-vir1 --save vzctl set 221 --ipadd 168.168.168.221 --save vzctl set 221 --numothersock 120 --save vzctl set 221 --nameserver 202.106.196.115 --save vzctl set 221 --diskspace 15360M:20480M --save vzctl set 221 --privvmpages 1024M:2048M --save vzctl start 221 vzctl exec 221 passwd
start了就可以ssh看看了,ssh root@168.168.168.221 密码是刚才设置的。
下附删除代码
vzctl destroy <CT_ID>
vz虚拟机路径
/var/lib/vz/root/221 /var/lib/vz/private/221 /etc/vz/conf/221.conf
修改diskspace大小(选作,调到了10GB)
vzctl set 221 --diskspace 10485760:11530240 --save
修改空间和内存大小可以直接写M
vzctl set 221 --diskspace 15360M:20480M --save vzctl set 221 --privvmpages 1024M:2048M --save
大功告成!
相关文章推荐
虚拟主机的专业参数,分别都是什么意思?2022-09-09
中非域名注册规则是怎样的?注册域名有什么用处? 2022-01-10
HostEase新年活动促销 美国/香港主机全场低至五折2021-12-28
HostGator下载完整备份教程分享2021-12-28
Flink中有界数据与无界数据的示例分析2021-12-28