当前位置:首页 > CN2资讯 > 正文内容

linux虚拟化之openvz

3天前CN2资讯

系统环境:

[root@openvz ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@openvz ~]# uname -a Linux openvz 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux [root@openvz ~]# lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: CentOS Description: CentOS release 6.5 (Final) Release: 6.5 Codename: Final

开始安装:

[root@openvz ~]# cd /etc/yum.repos.d/ [root@openvz yum.repos.d]# wget -P /etc/yum.repos.d/ http://ftp.openvz.org/openvz.repo [root@openvz yum.repos.d]# rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ [root@openvz yum.repos.d]# yum install vzkernel [root@openvz yum.repos.d]# echo "SELINUX=disabled" > /etc/sysconfig/selinux [root@openvz yum.repos.d]# cat /etc/sysctl.conf |grep -v "#"|grep -v ^$ net.ipv4.ip_forward = 1 net.ipv6.conf.default.forwarding = 1 net.ipv6.conf.all.forwarding = 1 net.ipv4.conf.default.proxy_arp = 0 net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 1 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 [root@openvz yum.repos.d]# sysctl -p [root@openvz yum.repos.d]# yum install vzctl vzquota ploop [root@openvz yum.repos.d]# reboot

openvz安装完成


下载系统模板

模板在这里http://openvz.org/Download/template/cache

[root@openvz ~]# uname -a Linux openvz 2.6.32-042stab085.20 #1 SMP Fri Mar 21 19:07:05 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux [root@openvz ~]# cd /vz/template/cache/ [root@openvz cache]# wget http://download.openvz.org/template/precreated/centos-5-x86.tar.gz [root@openvz cache]# vzctl create 1 --ostemplate centos-5-x86 [root@openvz cache]# vzctl set 1 --onboot yes --save [root@openvz cache]# vzctl set 1 --ipadd 172.16.10.21 --save [root@openvz cache]# vzctl set 1 --nameserver 114.114.114.114 --save [root@openvz cache]# vzctl set 1 --hostname --save [root@openvz cache]# vzctl set 1 --diskspace 10G:10G --save [root@openvz cache]# vzctl start 1 启动为1的虚拟机 Starting container... Container is mounted Adding IP address(es): 172.16.10.21 Setting CPU units: 1000 Container start in progress... [root@openvz cache]# vzctl exec 1 passwd 修改序号为1的虚拟机ROOT密码 New UNIX password: redhat BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: redhat Changing password for user root. passwd: all authentication tokens updated successfully. [root@openvz cache]# vzlist 查看序号为1的虚拟机 CTID NPROC STATUS IP_ADDR HOSTNAME 1 21 running 172.16.10.21 [root@openvz cache]# vzcalc -v 1 查看序号1 占用的资源 [root@openvz cache]# ping 172.16.10.21 PING 172.16.10.21 (172.16.10.21) 56(84) bytes of data. 64 bytes from 172.16.10.21: icmp_seq=1 ttl=64 time=0.276 ms 64 bytes from 172.16.10.21: icmp_seq=2 ttl=64 time=0.041 ms [root@openvz cache]# vzctl enter 1 进入 guest 相当于 xen 的 xm console ,不过从 guest 退出来不需特殊按键直接 exit 就可以退出 entered into CT 1 [root@centos5 /]# uname -a Linux 2.6.32-042stab085.20 #1 SMP Fri Mar 21 19:07:05 MSK 2014 i686 i686 i386 GNU/Linux [root@centos5 /]# cat /etc/redhat-release CentOS release 5.10 (Final)

OK大概先到这里

    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/19066.html

    分享给朋友:

    “linux虚拟化之openvz” 的相关文章

    微信海外服务器助力全球化业务拓展与用户体验优化

    微信海外服务器是微信在全球范围内部署的技术基础设施,旨在支持其海外业务的发展。这些服务器不仅是数据存储的中心,还承担着用户信息处理和互动的各种功能。随着技术的不断进步,微信的使用需求也在全球范围内快速增长,这种现象驱动着微信不断扩展其海外服务器的网络。 我们时常看到,微信与WeChat的分拆让用户数...

    解决BestTrace中的timestamp is error问题及优化网络性能指南

    BestTrace是一款强大的网络诊断工具,广泛用于追踪数据包从源头到目标的网络路径。它的工作原理结合了traceroute和ping的功能,让用户不仅能够查看每一跳的延迟,还能监测到丢包情况。这意味着,你在使用BestTrace时,能够获得关于网络连接质量的详细信息,及时发现潜在的问题。 在我实际...

    如何开启BBR查询并提升TCP网络性能

    BBR(Bottleneck Bandwidth and Round-trip propagation time)是一种由Google开发的TCP拥塞控制算法,我对它的了解让我感到非常兴奋。BBR旨在通过精确的网络条件监测,以提高传输速度和稳定性。传统的拥塞控制算法往往依赖于丢包率的变化来调整传输速...

    获取国外动态IP服务的指南与优势

    在当今互联网的世界中,动态IP(Dynamic IP)逐渐成为了一个重要的概念。它指的是由互联网服务提供商(ISP)动态分配的、可变的IP地址。与固定不变的静态IP相比,每次连接互联网时,动态IP都可能发生变化。这种灵活性不仅高效利用了IP资源,还在多个领域产生了实际应用的优势。 动态IP的特点非常...

    揭秘 cheapnat 优惠码的省钱技巧与使用攻略

    什么是 cheapnat 优惠码 我最近发现,cheapnat 优惠码成为了网络用户省钱的绝佳利器。它们通常是特定服务或产品的折扣代码,可以帮助用户在购买 VPS、域名注册或代理服务时享受不同程度的价格优惠。无论你是个人用户还是小型企业,合理利用这些优惠码都能帮你减少开支,同时享受到高质量的服务。...

    阿里云新用户优惠活动详解:如何高效利用云服务

    作为阿里云的新用户,我感到兴奋,因为阿里云为像我这样的新手提供了许多优惠和服务,让我能轻松地体验云产品。首先,我们来聊聊什么是阿里云新用户。简单来说,阿里云会通过是否购买过云产品来判断我是否是新用户,而并非仅仅看注册时间。这意味着,只要我没有购买过云服务,就能享受到新用户的特权。 新用户的权益和优惠...