• 欢迎访问南思工作室官方站点.
  • 文章内容如有失效请文章下留言,我们看到后会第一时间处理。
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏南思工作室吧。
  • 图片服务器和主服务器都挂了CDN,如有异常,请留言,我们会尽快处理。

Kvm虚拟机中使用OpenVZ Web Panel面板开Openvz小鸡

linux nansi 4个月前 (08-07) 430次浏览 0个评论
文章目录[隐藏]

Kvm 虚拟机中使用 OpenVZ Web Panel 面板开 Openvz 小鸡

系统 CentOS 6.8 x64

开始安装 openvz

先安装 Openvz 内核

<span class="pln">cd </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">yum</span><span class="pun">.</span><span class="pln">repos</span><span class="pun">.</span><span class="pln">d
wget http</span><span class="pun">:</span><span class="com">//download.openvz.org/openvz.repo</span><span class="pln">
rpm </span><span class="pun">--</span><span class="kwd">import</span><span class="pln"> http</span><span class="pun">:</span><span class="com">//download.openvz.org/RPM-GPG-Key-OpenVZ</span><span class="pln">
yum update </span><span class="pun">-</span><span class="pln">y
yum install vzkernel
yum install vzctl vzquota</span>

修改/etc/sysctl.conf

<span class="pln">vi </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">sysctl</span><span class="pun">.</span><span class="pln">conf</span>

修改以下两项设置转发

<span class="pln">net</span><span class="pun">.</span><span class="pln">ipv4</span><span class="pun">.</span><span class="pln">ip_forward </span><span class="pun">=</span> <span class="lit">1</span><span class="pln">
kernel</span><span class="pun">.</span><span class="pln">sysrq </span><span class="pun">=</span> <span class="lit">1</span>

使上面的配置文件生效

<span class="pln">modprobe bridge
lsmod</span><span class="pun">|</span><span class="pln">grep bridge</span>

重启[必须]

<span class="pln">reboot</span>

完成 Openvz 安装
#检查开机是否设置为启动

<span class="pln">chkconfig </span><span class="pun">--</span><span class="pln">list vz</span>

#启动检查 openvz 是否启动

<span class="pln">service vz status</span>

#如果没自动启动执行,默认情况下会开机自动启动

<span class="pln">service vz start</span>

安装控制面板 OpenVZ Web Panel

#下载一键安装脚本

<span class="pln">wget https</span><span class="pun">:</span><span class="com">//raw.githubusercontent.com/sibprogrammer/owp/master/installer/ai.sh</span>

经测试默认脚本是使用 googlecode 托管的程序,但由于 googlecode 改版升级脚本里的下载地址是无效的,所以需要手动替换下载地址,国内可能需要 fan 墙

<span class="pln">vi ai</span><span class="pun">.</span><span class="pln">sh</span>

<span class="pln">DOWNLOAD_URL</span><span class="pun">=</span><span class="str">"http://ovz-web-panel.googlecode.com/files/ovz-web-panel-$VERSION.tgz"</span>

替换为

<span class="pln">DOWNLOAD_URL</span><span class="pun">=</span><span class="str">"https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ovz-web-panel/ovz-web-panel-2.4.tgz"</span>

然后执行脚本

<span class="pln">sh ai</span><span class="pun">.</span><span class="pln">sh
</span><span class="com">#也可以查看 OpenVZ Web Panel 官方教程 https://github.com/sibprogrammer/owp/blob/master/INSTALL.md</span>

OpenVZ Web Panel 面板安装完成
安装结束后,使用如下信息登录控制面板:
http://你的 Ip 地址:3000 默认 OpenVZ Web Panel 平台端口 3000
然后就可以创建你的 openvz 小鸡鸡了 `(*∩_∩*)′
常见问题
一. 在测试过程中,开通小鸡的时候提示:

Internal error: Command ‘vzctl create 1 –ostemplate centos-5-x86 –config vswap-1024m’ execution failed with code 99 Output: Can’t load ploop library: libploop.so: cannot open shared object file: No such file or directory Please install ploop packages! Alternatively, if you can’t or don’t want to use ploop, please add –layout simfs option, or set VE_LAYOUT=simfs in /etc/vz/vz.conf Creation of container private area failed

#提示 让你安装 ploop 可以直接使用以下命令即可

<span class="pln">yum install ploop</span>

二.主机做 nat 转发映射到小鸡问题
#将主机的外网 2222 端口映射到小鸡的 22 端口

<span class="pln">iptables </span><span class="pun">-</span><span class="pln">t nat </span><span class="pun">-</span><span class="pln">A PREROUTING </span><span class="pun">-</span><span class="pln">d </span><span class="pun">你的外网</span><span class="pln"> IP </span><span class="pun">-</span><span class="pln">p tcp </span><span class="pun">-</span><span class="pln">m tcp </span><span class="pun">--</span><span class="pln">dport </span><span class="lit">2222</span> <span class="pun">-</span><span class="pln">j DNAT </span><span class="pun">--</span><span class="pln">to</span><span class="pun">-</span><span class="pln">destination </span><span class="pun">小鸡</span><span class="pln"> ip</span><span class="pun">:</span><span class="lit">22</span>

#如果提示 iptables v1.4.7: can’t initialize iptables table `nat’: Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.

<span class="pln">vi </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">modprobe</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">openvz</span><span class="pun">.</span><span class="pln">conf</span>

<span class="pln">options nf_conntrack ip_conntrack_disable_ve0</span><span class="pun">=</span><span class="lit">1</span>

替换为

<span class="pln">options nf_conntrack ip_conntrack_disable_ve0</span><span class="pun">=</span><span class="lit">0</span>

然后重启

<span class="pln">reboot</span>

重启后执行

<span class="pln">iptables </span><span class="pun">-</span><span class="pln">L </span><span class="pun">-</span><span class="pln">n </span><span class="pun">-</span><span class="pln">t nat</span>

没报错那就在执行上面的 iptables 命令


南思工作室 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Kvm 虚拟机中使用 OpenVZ Web Panel 面板开 Openvz 小鸡
免责声明:本站一切资源仅用作交流学习,请勿用作商业或违法行为!如造成任何后果,本站概不负责!
喜欢 (11)
关于作者:
南思工作室管理员
发表我的评论
取消评论
表情 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址