/[gentoo]/xml/htdocs/proj/en/vps/vserver-howto.xml
Gentoo

Diff of /xml/htdocs/proj/en/vps/vserver-howto.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.7 Revision 1.8
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/proj/en/vps/vserver-howto.xml,v 1.7 2007/02/10 14:28:34 hollow Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/proj/en/vps/vserver-howto.xml,v 1.8 2007/03/26 18:50:21 hollow Exp $ -->
3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 3<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
4 4
5<guide link="/proj/en/vps/vserver-howto.xml"> 5<guide link="/proj/en/vps/vserver-howto.xml">
6<title>Gentoo Linux-VServer Howto</title> 6<title>Gentoo Linux-VServer Howto</title>
7 7
8<author title="Author"> 8<author title="Author">
9 <mail link="hollow@gentoo.org">Benedikt Boehm</mail> 9 <mail link="hollow@gentoo.org">Benedikt Boehm</mail>
10</author> 10</author>
11<author title="Editor"> 11<author title="Editor">
12 <mail link="fox2mike@gentoo.org">Shyam Mani</mail> 12 <mail link="fox2mike@gentoo.org">Shyam Mani</mail>
13</author> 13</author>
14 14
15<abstract> 15<abstract>
16In this Howto you will learn to setup a basic virtual server using the 16In this Howto you will learn to setup a basic virtual server using the
17Linux-VServer Technology 17Linux-VServer Technology
18</abstract> 18</abstract>
19 19
20<!-- The content of this document is licensed under the CC-BY-SA license --> 20<!-- The content of this document is licensed under the CC-BY-SA license -->
21<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 21<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
22<license/> 22<license/>
23 23
24<version>1.9</version> 24<version>1.10</version>
25<date>2007-02-10</date> 25<date>2007-03-26</date>
26 26
27<chapter> 27<chapter>
28<title>Introduction</title> 28<title>Introduction</title>
29<section> 29<section>
30<title>The Linux-VServer Concept</title> 30<title>The Linux-VServer Concept</title>
31<body> 31<body>
32 32
33<p> 33<p>
34The basic concept of the Linux-VServer solution is to separate the user-space 34The basic concept of the Linux-VServer solution is to separate the user-space
35environment into distinct units (sometimes called Virtual Private Servers) in 35environment into distinct units (sometimes called Virtual Private Servers) in
36such a way that each VPS looks and feels like a real server to the processes 36such a way that each VPS looks and feels like a real server to the processes
37contained within. 37contained within.
38</p> 38</p>
39 39
40</body> 40</body>
158<section> 158<section>
159<title>Setup host environment</title> 159<title>Setup host environment</title>
160<body> 160<body>
161 161
162<p> 162<p>
163To maintain your virtual servers you need the util-vserver package which 163To maintain your virtual servers you need the util-vserver package which
164contains all necessary programs and many useful features. 164contains all necessary programs and many useful features.
165</p> 165</p>
166 166
167<pre caption="Install util-vserver"> 167<pre caption="Install util-vserver">
168# <i>emerge >=sys-cluster/util-vserver-0.30.212</i> 168# <i>emerge >=sys-cluster/util-vserver-0.30.212</i>
169</pre> 169</pre>
170 170
171<p> 171<p>
172You have to run the <c>vprocunhide</c> command after every reboot in order to 172You have to run the <c>vprocunhide</c> command after every reboot in order to
173setup <path>/proc</path> permissions correctly for vserver guests. An init 173setup <path>/proc</path> permissions correctly for vserver guests. Two init
174script has been installed by util-vserver. To use it you should add it to the 174scripts have been installed by util-vserver which run the <c>vprocunhide</c>
175default runlevel: 175command for you and take care of virtual servers during shutdown of the host.
176</p> 176</p>
177 177
178<pre caption="vprocunhide init script"> 178<pre caption="util-vserver init scripts">
179# <i>rc-update add vprocunhide default</i> 179# <i>rc-update add vprocunhide default</i>
180# <i>/etc/init.d/vprocunhide start</i> 180# <i>/etc/init.d/vprocunhide start</i>
181# <i>rc-update add util-vserver default</i>
182# <i>/etc/init.d/util-vserver start</i>
181</pre> 183</pre>
182 184
183</body> 185</body>
184</section> 186</section>
185</chapter> 187</chapter>
186 188
187<chapter> 189<chapter>
188<title>Guest creation</title> 190<title>Guest creation</title>
189<section> 191<section>
190<title>Using vserver stage3/4</title> 192<title>Download a precompiled stage3/4</title>
191<body> 193<body>
192 194
195<p>
196Since many hardware related commands are not available inside a virtual server,
197there has been a patched version of baselayout known as baselayout-vserver.
198However, since baselayout-1.13.0_alpha12, all required changes have been
199integrated into normal baselayout, eliminating the need for seperate vserver
200stages, profiles and baselayout. The only (temporary) drawback is that
201baselayout-1.13 is still considered to be in alpha stage and there are no
202stages with baselayout-1.13 available on the mirrors yet.
193<p> 203</p>
194You have to download a vserver prepared stage3/4 from one of 204
205<p>
206As soon as baselayout-1.13 is stable you can use a precompiled stage3/4 from
195<uri link="/main/en/mirrors.xml">our mirrors</uri>. Those stages are located 207one of <uri link="/main/en/mirrors.xml">our mirrors</uri>. In the meantime
196under the <path>experimental/&lt;arch&gt;/vserver/</path> directory. 208please download a stage3/4 from
209<uri link="http://people.linux-vserver.org/~hollow/stages/">here</uri>.
197Since a stage3/4 contains a complete root filesystem you can use the template 210Since a stage3/4 contains a complete root filesystem you can use the template
198build method of util-vserver. However, this method is only available since 211build method of util-vserver. However, this method is only available since
199util-vserver-0.30.211, so make sure you have the right version installed. 212util-vserver-0.30.211, so make sure you have the right version installed.
200</p> 213</p>
201 214
202<p> 215<p>
203You have to choose a context ID for your vserver (dynamic context IDs are 216You have to choose a context ID for your vserver (dynamic context IDs are
204discouraged) as well as the necessary network device information (In this 217discouraged) as well as the necessary network device information (In this
205example eth0 is configured with 192.168.1.253/24 and the context ID is 218example eth0 is configured with 192.168.1.253/24 and the context ID is
206equivalent to the last two parts of the virtual servers IP). 219equivalent to the last two parts of the virtual servers IP).
207</p> 220</p>
208 221
209<note> 222<note>
210The context ID should be 1 &lt; ID &lt; 49152. 223The context ID should be 1 &lt; ID &lt; 49152.
224</note>
225
226</body>
227</section>
228<section>
229<title>Using the template build method</title>
230<body>
231
232<p>
233For a long time now, plain init style was the only init style available for
234gentoo, i.e. a normal init process will be started inside the guest, just like
235on any common Unix system. However this approach has some drawbacks:
236</p>
237
238<ul>
239<li>No possibility to see output of init/rc scripts</li>
240<li>Wasted resources for idle init processes in each guest</li>
241<li>Annoying conflicts for <path>/etc/inittab</path></li>
242</ul>
243
244<p>
245Therefore, many users have requested to reimplement the gentoo init style,
246which has been abandonned since it was a very hacky implementation and more
247or less worked by accident due to other modifications done to baselayout back
248then. However, as of util-vserver-0.30.212 the gentoo init style has been
249reimplemented in a concise manner and will get the default in the future.
250</p>
251
252<note>
253If there is not a good reason for using an extra init process for each guest
254or if you don't know what to do here, you should stick with gentoo init style.
211</note> 255</note>
212 256
213<pre caption="Start stage3 installation"> 257<pre caption="Start stage3 installation">
214# <i>vserver myguest build \</i> 258# <i>vserver myguest build \</i>
215 <i>--context 1253 \</i> 259 <i>--context 1253 \</i>
216 <i>--hostname gentoo \</i> 260 <i>--hostname gentoo \</i>
217 <i>--interface eth0:192.168.1.253/24 \</i> 261 <i>--interface eth0:192.168.1.253/24 \</i>
218 <i>--initstyle plain \</i> 262 <i>--initstyle gentoo \</i> <comment>(replace if needed)</comment>
219 <i>-m template -- \</i> 263 <i>-m template -- \</i>
220 <i> -d gentoo \</i> 264 <i> -d gentoo \</i>
221 <i> -t /path/to/stage4-&lt;arch&gt;-&lt;version&gt;.tar.bz2</i> 265 <i> -t /path/to/stage4-&lt;arch&gt;-&lt;version&gt;.tar.bz2</i>
222</pre> 266</pre>
223 267
224<note> 268<note>
225To reflect your network settings you should change 269To reflect your network settings you should change
226<path>/etc/conf.d/hostname</path>, <path>/etc/conf.d/domainname</path> and 270<path>/etc/conf.d/hostname</path>, <path>/etc/conf.d/domainname</path> and
227<path>/etc/hosts</path> inside the guest to your needs. See <uri 271<path>/etc/hosts</path> inside the guest to your needs. See <uri
228link="/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=8#doc_chap2_sect1">chapter 272link="/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=8#doc_chap2_sect1">chapter
2298.b.1</uri> and <uri 2738.b.1</uri> and <uri
230link="/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=8#doc_chap2_sect4">chapter 274link="/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=8#doc_chap2_sect4">chapter
2318.b.4</uri>. The rest of your virtual servers network setup will be 2758.b.4</uri>. The rest of your virtual servers network setup will be
232done on the host. 276done on the host.
233</note> 277</note>
234 278
235<p> 279<p>
236You should be able to start and enter the vserver by using the commands below. 280You should be able to start and enter the vserver by using the commands below.
237If you miss commands like <c>mount</c> or <c>dmesg</c> you should <c>emerge 281If you miss commands like <c>mount</c> or <c>dmesg</c> you should <c>emerge
238util-linux</c> inside your virtual server as the vserver profile doesn't ship 282util-linux</c> inside your virtual server as the vserver profile doesn't ship
239this package by default. 283this package by default.
240</p> 284</p>
241 285
242<pre caption="Test the virtual server"> 286<pre caption="Test the virtual server">
243# <i>vserver myguest start</i> 287# <i>vserver myguest start</i>
288
289
290Gentoo/Linux 1.13.0_alpha12; http://www.gentoo.org/
291 Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
292
293Press I to enter interactive boot mode
294
295 * Using existing device nodes in /dev [ ok ]
296 * root filesystem is mounted read-write - skipping
297 * Checking all filesystems [ ok ]
298 * Mounting local filesystems [ ok ]
299 * Activating (possible) swap [ ok ]
300 * Setting hostname to myguest [ ok ]
301 * Updating environment [ ok ]
302 * Cleaning /var/lock, /var/run [ ok ]
303 * Cleaning /tmp directory [ ok ]
304 * Initializing random number generator [ ok ]
305 * Setting system clock using the hardware clock [VPS] [ ok ]
306 * Starting syslog-ng [ ok ]
307 * Starting vixie-cron [ ok ]
308 * Starting local [ ok ]
244# <i>vserver-stat</i> 309# <i>vserver-stat</i>
245CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME 310CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME
2460 90 1.4G 153.4K 14m00s11 6m45s17 2h59m59 root server 3110 90 1.4G 153.4K 14m00s11 6m45s17 2h59m59 root server
2471252 2 3M 286 0m00s45 0m00s42 0m02s91 myguest 3121252 2 3M 286 0m00s45 0m00s42 0m02s91 myguest
248# <i>vserver myguest enter</i> 313# <i>vserver myguest enter</i>
249# <i>ps ax</i> 314# <i>ps ax</i>
250PID TTY STAT TIME COMMAND 315PID TTY STAT TIME COMMAND
251 1 ? S 0:00 init [3] 316 1 ? S 0:00 init [3]
25222887 ? Ss 0:00 /usr/sbin/syslog-ng 31722887 ? Ss 0:00 /usr/sbin/syslog-ng
25320496 pts/0 S 0:00 /bin/bash -login 31820496 pts/0 S 0:00 /bin/bash -login
25420508 pts/0 R+ 0:00 ps ax 31920508 pts/0 R+ 0:00 ps ax
255# <i>logout</i> 320# <i>logout</i>
256</pre> 321</pre>
257 322
258</body> 323</body>

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20