CentOS安裝OpenVZ和Vtonf控制面板

CentOS安裝OpenVZ和Vtonf控制面板

現在虛擬化技術非常流行,本文介紹基于OpenVZ平臺下的虛擬化配置安裝,以及Vtonf Web界面管理虛擬機應用。
本文爲簡易指導手册,代碼不保證100%準確。本文根據英文教程創作演繹。
一、安裝OpenVZ
1、第一次在CentOS中添加openVZ repository
打開終端複製以下命令
wget http://download.openvz.org/openvz.repo
rpm –import http://download.openvz.org/RPM-GPG-Key-OpenVZ
cp openvz.repo /etc.recpo.d
2、安裝openvz內核
yum install ovzkernel
3、編輯文件 /etc/systcl.conf
打開文件 /etc/systcl.conf
vi /etc/systcl.conf
添加以下內容:
net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
kernel.sysrq = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
4、禁止Selinux
禁止Selinux,打開配置文件
vi /etc/selinux/config
找到以下內容,將SELINUX設置成disabled,如下所設:
SELINUX=disabled
5、安裝openvz工具和插件
yum install vzctl vzquota
6、重啓openv服務
service vz restart
二、建立虛擬操作系統
現在,我們已經安裝好了Openvz,馬上去建立一個虛擬操作系統吧。首先下載一下操作系統模板。
本例將使用Slackware模板,其它的操作系統模板你可以查看這裏
1、首先建立和進入cache文件夾,本例如下:
mkdir -p /vz/template/cache
cd /vz/template/cache
2、接下來是下載模板
這個步驟可能會花去你很多時間,視網絡狀况,現在你可以瀏覽一下OSSS.CN開源社區,呵呵:
wget http://download.openvz.org/template/precreated/contrib/slackware-13.0-i386-minimal.tar.gz
下載屏幕如下列所示:
[root@localhost cache]# wget http://download.openvz.org/template/precreated/contrib/slackware-13.0-i386-minimal.tar.gz
–2010-06-27 16:55:33– http://download.openvz.org/template/precreated/contrib/slackware-13.0-i386-minimal.tar.gz
Resolving download.openvz.org… 64.131.90.11
Connecting to download.openvz.org|64.131.90.11|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 39641862 (38M) [application/x-gzip]
Saving to: `slackware-13.0-i386-minimal.tar.gz’
100%[===============================================================>] 39,641,862 4.48M/s in 14s
2010-08-09 16:55:47 (2.71 MB/s) – `slackware-13.0-i386-minimal.tar.gz’ saved [39641862/39641862]
3、建立虛擬機
假如虛擬機名爲:VPS ossscn
vzctl create ossscn –ostemplate slackware-13.0-i386-minimal –config basic
屏幕輸出:
Creating container private area (slackware-13.0-i386-minimal)
Performing postcreate actions
Container private area was created
4、設置虛擬機
[root@localhost cache]# vzctl set ossscn –onboot yes –saveSaved parameters for CT 102make a Hostname for The machien:vzctl set 102 –hostname Hackers.example.com –saveGive Ip adress 192.168.0.130 to the machine:
[root@localhost cache]# vzctl set 102 –ipadd 192.168.0.130 –saveSaved parameters for CT 102
[root@localhost cache]#
5、啓動虛擬機ossscn
vzctl start
屏幕輸出:
ossscn Starting container …Container is mountedAdding IP address(es): 192.168.0.130Setting CPU units: 1000Set hostname: Hackers.example.comContainer start in progress..
6、設置Root密碼
vzctl exec ossscn passwd
New password: 123456
Re-enter new password: 123456
Changing password for root
Enter the new password (minimum of 5, maximum of 127 characters)Please use a combination of upper and lower case letters and numbers.Password changed
7、進入slackware虛擬機ossscn
vzctl enter 102
屏幕輸出:
entered into CT ossscn
root@Hackers:/# cat /etc/slackware-version
Slackware 13.0.0.0.0
Stop of start or Exit
More commands :
To restart use : vzctl restart
To stop use : vzctl stop
to destroy the vm machine user : vzctl destro ossscn
For more commands use :vzctl -help
三、爲OpenVZ安裝Vtonf Web管理界面
VTONF是虛擬機控制面板,專門爲GNU/Linux中運行OpenVZ虛擬機技術設計。VTONF是基于GPL許可證下發布的自由軟件。
1、安裝Vtonf
打開終端,輸入以下命令,不要忘記將vtonf版本vtonfinstaller.x.x-beta1.tar.gz中的x改爲你下載的版本。
cd /tmp
wget http://mesh.dl.sourceforge.net/sourceforge/vtonf/vtonfinstaller.x.x-beta1.tar.gz
tar xvfz vtonfinstaller.1.0-beta1.tar.gz
cd vtonfinstaller.x.x-beta1
./install
當Vtonf控制面板安裝完成,你可以登陸系統:
http://192.168.0.109:8001/
用戶名 : admin
密碼 : admin

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *