个人工具

“UbuntuHelp:OpenVZ”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第2行: 第2行:
 
{{Languages|UbuntuHelp:OpenVZ}}
 
{{Languages|UbuntuHelp:OpenVZ}}
 
== Introduction ==
 
== Introduction ==
This page describes the installation of OpenVZ on "Ubuntu Server" as a host.  
+
This page describes the installation of [[UbuntuHelp:OpenVZ|OpenVZ]] on "Ubuntu Server" as a host.  
 
To properly implement the practical steps found in this guide, the reader should be a user of Ubuntu who is comfortable with the use of command-line applications, using the Bourne Again SHell (bash) environment, and editing system configuration files with their preferred text editor application.
 
To properly implement the practical steps found in this guide, the reader should be a user of Ubuntu who is comfortable with the use of command-line applications, using the Bourne Again SHell (bash) environment, and editing system configuration files with their preferred text editor application.
== About OpenVZ ==
+
== About [[UbuntuHelp:OpenVZ|OpenVZ]] ==
OpenVZ is a server virtualization solution for Linux. It enables one to create multiple virtual Linux servers which are isolated from the host and from each other, based on a technique called "Operating System Virtualization". Similar techniques are used in Solaris Zones, Linux-VServer and FreeBSD jails. This technique does not use hardware virtualization like KVM, XEN or VMware.
+
[[UbuntuHelp:OpenVZ|OpenVZ]] is a server virtualization solution for Linux. It enables one to create multiple virtual Linux servers which are isolated from the host and from each other, based on a technique called "Operating System Virtualization". Similar techniques are used in Solaris Zones, Linux-[[UbuntuHelp:VServer|VServer]] and FreeBSD jails. This technique does not use hardware virtualization like KVM, XEN or [[UbuntuHelp:VMware|VMware]].
 
The so called "Virtual Servers" or VPSs behave like stand alone servers. They consume less resources than their hardware virtualized counterparts, but must use the same kernel as the host. Therefor you can only have Linux VPSs on a Linux host.
 
The so called "Virtual Servers" or VPSs behave like stand alone servers. They consume less resources than their hardware virtualized counterparts, but must use the same kernel as the host. Therefor you can only have Linux VPSs on a Linux host.
 
The original documentation can be found here: [http://openvz.org/]  
 
The original documentation can be found here: [http://openvz.org/]  
== Installing OpenVZ ==
+
== Installing [[UbuntuHelp:OpenVZ|OpenVZ]] ==
 
This installation was tested on Ubuntu Server 7.04 (Feisty)
 
This installation was tested on Ubuntu Server 7.04 (Feisty)
* Because OpenVZ is not part of the standard repositories of Ubuntu, we first have to add the Debian repository for OpenVZ. Therefore add the following line to your "/etc/apt/sources.list"  
+
* Because [[UbuntuHelp:OpenVZ|OpenVZ]] is not part of the standard repositories of Ubuntu, we first have to add the Debian repository for [[UbuntuHelp:OpenVZ|OpenVZ]]. Therefore add the following line to your "/etc/apt/sources.list"  
 
<code><nowiki>"deb http://debian.systs.org/ stable openvz"</nowiki></code>  
 
<code><nowiki>"deb http://debian.systs.org/ stable openvz"</nowiki></code>  
 
(without quotes)
 
(without quotes)
第26行: 第26行:
 
When the new kernel is installed, change the /boot/grub/menu.lst file so that it boots the ovz kernel automatically
 
When the new kernel is installed, change the /boot/grub/menu.lst file so that it boots the ovz kernel automatically
 
* Now reboot the system in the new ovz-kernel
 
* Now reboot the system in the new ovz-kernel
* We still have to install the OpenVZ control utilities: vzctl and vzquota
+
* We still have to install the [[UbuntuHelp:OpenVZ|OpenVZ]] control utilities: vzctl and vzquota
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install vzctl vzquota
 
sudo apt-get install vzctl vzquota
第45行: 第45行:
 
<code><nowiki>"sudo sysctl -p"</nowiki></code>
 
<code><nowiki>"sudo sysctl -p"</nowiki></code>
 
== Download Template(s) ==
 
== Download Template(s) ==
Before we can create a new Virtual Private Server, we first have to download a template of the distro we want to use. OpenVZ uses "templates" or "cached templates". The difference is that "templates" are a sort of cookbook for "cached templates" A package manager is then used to download and create the cached template of the chosen distribution. Because most cached versions of popular distro's are already created and not that big, it is easiest to download the cached version and place it in the "/var/lib/vz/template/cache" directory (or the path you have chosen in the "/etc/vz/vz.conf" file).
+
Before we can create a new Virtual Private Server, we first have to download a template of the distro we want to use. [[UbuntuHelp:OpenVZ|OpenVZ]] uses "templates" or "cached templates". The difference is that "templates" are a sort of cookbook for "cached templates" A package manager is then used to download and create the cached template of the chosen distribution. Because most cached versions of popular distro's are already created and not that big, it is easiest to download the cached version and place it in the "/var/lib/vz/template/cache" directory (or the path you have chosen in the "/etc/vz/vz.conf" file).
 
The cached templates can be found here [http://openvz.org/download/template/cache/]  
 
The cached templates can be found here [http://openvz.org/download/template/cache/]  
 
== Create a new VPS ==
 
== Create a new VPS ==

2007年12月4日 (二) 11:13的版本

Introduction

This page describes the installation of OpenVZ on "Ubuntu Server" as a host. To properly implement the practical steps found in this guide, the reader should be a user of Ubuntu who is comfortable with the use of command-line applications, using the Bourne Again SHell (bash) environment, and editing system configuration files with their preferred text editor application.

About OpenVZ

OpenVZ is a server virtualization solution for Linux. It enables one to create multiple virtual Linux servers which are isolated from the host and from each other, based on a technique called "Operating System Virtualization". Similar techniques are used in Solaris Zones, Linux-VServer and FreeBSD jails. This technique does not use hardware virtualization like KVM, XEN or VMware. The so called "Virtual Servers" or VPSs behave like stand alone servers. They consume less resources than their hardware virtualized counterparts, but must use the same kernel as the host. Therefor you can only have Linux VPSs on a Linux host. The original documentation can be found here: [1]

Installing OpenVZ

This installation was tested on Ubuntu Server 7.04 (Feisty)

  • Because OpenVZ is not part of the standard repositories of Ubuntu, we first have to add the Debian repository for OpenVZ. Therefore add the following line to your "/etc/apt/sources.list"

"deb http://debian.systs.org/ stable openvz" (without quotes)

  • Now we have to get the correct signing key for this repository added to our system:
sudo wget http://debian.systs.org/dso_archiv_signing_key.asc
sudo apt-key add dso_archiv_signing_key.asc
sudo rm dso_archiv_signing_key.asc
  • When this is done we can update APT and install the ovz kernel.
sudo apt-get update
sudo apt-get install ovzkernel-2.6.18

When the new kernel is installed, change the /boot/grub/menu.lst file so that it boots the ovz kernel automatically

  • Now reboot the system in the new ovz-kernel
  • We still have to install the OpenVZ control utilities: vzctl and vzquota
sudo apt-get install vzctl vzquota

Networking

  • For the networking to work properly, ipv4 forwarding has to be turned on.

This enables your VPSs to communicate with the outside world. You can check this with the following command: cat /proc/sys/net/ipv4/ip_forward it should read "1". If it reads "0", it can be turned on by editing the "/etc/sysctl.conf" file. The malfunctioning network-settings are probably because of this bug, see [2]

  • To edit this file type:

"sudo nano -w /etc/sysctl.conf" and add the following line: "net.ipv4.conf.all.forwarding=1" and save the document. We can reload this config file to the system with: "sudo sysctl -p"

Download Template(s)

Before we can create a new Virtual Private Server, we first have to download a template of the distro we want to use. OpenVZ uses "templates" or "cached templates". The difference is that "templates" are a sort of cookbook for "cached templates" A package manager is then used to download and create the cached template of the chosen distribution. Because most cached versions of popular distro's are already created and not that big, it is easiest to download the cached version and place it in the "/var/lib/vz/template/cache" directory (or the path you have chosen in the "/etc/vz/vz.conf" file). The cached templates can be found here [3]

Create a new VPS

When we create a VPS, we must give it a number. This number must be unique and it is used to control the VPS during it's existence. A good guideline is to use the last three digits of the ip address you are going to use for this VPS. i.e.: 10.0.0.101 would be VPS 101! To create a VPS use this command:

sudo vzctl create 101 --ostemplate <the name of your template>

more to come...