linux虚拟化OPenVZ实验配置笔记_第1页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、linux虚拟化openvz实验配置笔记/etc/yum.repos.d rootlocalhost wget /openvz.repo -2011-11-03 09:24:52- /openvz.repo resolving . 1 connecting to |1|:80. connect. http request sent, awaiting response. 200

2、 ok length: 2205 (2.2k) tt/plain saving to: openvz.repo 100%= 2,205 -.-k/s in 0s 2011-11-03 09:24:53 (149 mb/s) - openvz.repo saved 2205/2205 然后按照你所用法的linux版本,修改openvz.repo文件。 openvz-kernel-rhel5 name=openvz rhel5-ba kernel baseurl=/kernel/brahes/rhel5-2.6.18/current/ mirror

3、list=/kernel/mirrors-rhel5-2.6.18 d=1 gpgcheck=1 gpgkey=/rpm-gpg-key-openvz no2:rootlocalhost rpm -import /rpm-gpg-key-openvz no3.rootlocalhost yum search vzkernel no4.rootlocalhost yum install ovzkernel no5.执行安装后,会发觉在grub.co

4、nf中多了一项引导: title openvz (2.6.18-274.3.1.el5.028stab094.3) root (hd0,0) kernel /vmlinuz-2.6.18-274.3.1.el5.028stab094.3 ro root=label=/ rhgb quiet selinux=0 inid /initrd-2.6.18-274.3.1.el5.028stab094.3.img vi /boot/grub/menu.t /可以设置默认引导为openvz (2.6.18-274.3.1.el5.028stab094.3) no6.安装管理工具 rootlocalhos

5、t yum install vzctl vz 三、修改参数 setting sysctl parameters vim /etc/sysctl.conf on hardware node we generally need packet forwarding enabled and proxy arp disabled net.ipv4.ip_forward = 1 xy_arp = 0 enables source route verifiion net.ipv4.conf.all.rp_filter = 1 enables the magi

6、c-sysrq key kernel.sysrq = 1 tcp explict congestion notification net.ipv4.t_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 net.ipv4.i_echo_ignore_broadcasts=1 net.ipv4.conf.default.forwarding=1 修改上面的文件后,执行 sys

7、ctl -p 四、配置openvz 1.vi /etc/vz/vz.conf 加入下面一行: neighbour_devs=all 2.关闭selinux vi /etc/sysconfig/selinux 3.重启计算机 不论是否修改了selinux,openvz安装后都需要重新启动,然后在grub菜单中,挑选 openvz (2.6.18-274.3.1.el5.028stab094.3) 引导。 五、用法 openvz 1.到/download/template/precreated下载os的模板文件,需要虚拟出什么类型的系统,就下载对应的模板。

8、保存到/vz/template/cache cd /vz/template/cache wget /template/precreated/contrib/centos-5-i386-default.tar.gz 2.创建vps vzctl create 101 -ostemplate centos-5-i386-default -config vps.basic vzctl create 101 -ostemplate centos-6-x86 -config vswap-256m 解释:centos-6-x86为你所下载的模板文件的名称(我

9、下载的为centos-6-x86.tar.gz)(除去末尾的.tar.gz);vswap-256m或vps.basic 为/etc/vz/conf中配置文件名称的一部分,如下: rootlocalhost ls /etc/vz/conf/ 0.conf ve-basic.conf-sample ve-unlimited.conf-sample ve-vswap-256m.conf-sample 101.conf ve-light.conf-sample ve-vswap-1024m.conf-sample ve-vswap-512m.conf-sample vzctl 101 -onboot

10、yes -save /设置开机启动 vzctl set 101 -hostname -save /设置主机名 vzctl set 101 -ipa 01 -save /设置ip vzctl set 101 -numothersock 120 -save vzctl set 101 -nameserver 01-save vzctl start 101 vzctl enter 101 /在主机进入虚拟机 vzctl set 101 -user root:test deleting virtual private server vzctl destroy

11、 101 vps is currently mounted ( first) vzctl stop 101 stop vps . vps was stopped vps is unmounted vzctl destroy 101 destroying vps private area: /vz/private/101 vps private area was destroyed ls /etc/sysconfig/vz-scripts/101.* /etc/sysconfig/vz-scripts/101.conf.destroyed /etc/sysconfig/vz-scripts/10

12、1.mount.destroyed /etc/sysconfig/vz-s cripts/101.umount.destroyed vzctl us 101 vps 101 deleted unmounted down vzctl exec 101 /etc/init.d/sshd status sshd is stopped vzctl exec 101 /etc/init.d/sshd start starting sshd: ok vzctl exec 101 /etc/init.d/sshd status sshd (p 26187) is running. 提高 1.在创建vps时用法默认的参数(-ostemplate -config ) 修改/etc/vz/vz.conf, 用下面两行代替配置文件中相应项: def_ostemplate= centos-6-x86 /你所下载的模板文件名,除掉.tar.gz configfile= vswap-256m / /etc/vz/conf名目中,你所想用的sample文件中的一个,注重只取文件名去掉ve和conf-sample的部分。 vzctl start 101 this command starts vps 101,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论