/[d-i]/trunk/manual/en/appendix/chroot-install.xml
ViewVC logotype

Contents of /trunk/manual/en/appendix/chroot-install.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 36758 - (show annotations) (download) (as text)
Fri Apr 28 19:18:18 2006 UTC (7 years ago) by fjp
File MIME type: text/xml
File size: 13567 byte(s)
* chroot-install:
  - add /etc/hosts to be created for network configuration
  - make kernel/linux-image variable
* Document -- command line option for passing parameters to boot loader configuration
1 <!-- retain these comments for translator revision tracking -->
2 <!-- $Id$ -->
3
4 <sect1 id="linux-upgrade">
5 <title>Installing &debian; from a Unix/Linux System</title>
6
7 <para>
8
9 This section explains how to install &debian; from an existing
10 Unix or Linux system, without using the menu-driven installer as
11 explained in the rest of the manual. This <quote>cross-install</quote>
12 HOWTO has been requested by users switching to &debian; from
13 Red Hat, Mandrake, and SUSE. In this section some familiarity with
14 entering *nix commands and navigating the file system is assumed. In
15 this section, <prompt>$</prompt> symbolizes a command to be entered in
16 the user's current system, while <prompt>#</prompt> refers to a
17 command entered in the Debian chroot.
18
19 </para><para>
20
21 Once you've got the new Debian system configured to your preference,
22 you can migrate your existing user data (if any) to it, and keep on
23 rolling. This is therefore a <quote>zero downtime</quote> &debian;
24 install. It's also a clever way for dealing with hardware that
25 otherwise doesn't play friendly with various boot or installation
26 media.
27
28 </para>
29
30 <sect2>
31 <title>Getting Started</title>
32 <para>
33
34 With your current *nix partitioning tools, repartition the hard
35 drive as needed, creating at least one filesystem plus swap. You
36 need at least 150MB of space available for a console only install,
37 or at least 300MB if you plan to install X.
38
39 </para><para>
40
41 To create file systems on your partitions. For example, to create an
42 ext3 file system on partition <filename>/dev/hda6</filename> (that's
43 our example root partition):
44
45 <informalexample><screen>
46 # mke2fs -j /dev/hda6
47 </screen></informalexample>
48
49 To create an ext2 file system instead, omit <userinput>-j</userinput>.
50
51 </para><para>
52
53 Initialize and activate swap (substitute the partition number for
54 your intended Debian swap partition):
55
56 <informalexample><screen>
57 # mkswap /dev/hda5
58 # sync; sync; sync
59 # swapon /dev/hda5
60 </screen></informalexample>
61
62 Mount one partition as <filename>/mnt/debinst</filename> (the
63 installation point, to be the root (<filename>/</filename>) filesystem
64 on your new system). The mount point name is strictly arbitrary, it is
65 referenced later below.
66
67 <informalexample><screen>
68 # mkdir /mnt/debinst
69 # mount /dev/hda6 /mnt/debinst
70 </screen></informalexample>
71
72 </para>
73 <note><para>
74
75 If you want to have parts of the filesystem (e.g. /usr) mounted on
76 separate partitions, you will need to create and mount these directories
77 manually before proceding with the next stage.
78
79 </para></note>
80 </sect2>
81
82 <sect2>
83 <title>Install <command>debootstrap</command></title>
84 <para>
85
86 The tool that the Debian installer uses, which is recognized as the
87 official way to install a Debian base system, is
88 <command>debootstrap</command>. It uses <command>wget</command> and
89 <command>ar</command>, but otherwise depends only on
90 <classname>/bin/sh</classname> and basic Unix/Linux tools<footnote>
91
92 <para>
93
94 These include the GNU core utilities and commands like <command>sed</command>, <command>grep</command>, <command>tar</command> and <command>gzip</command>.
95
96 </para>
97
98 </footnote>. Install <command>wget</command> and
99 <command>ar</command> if they aren't already on your current system,
100 then download and install <command>debootstrap</command>.
101
102 </para>
103
104 <!-- The files linked to here are from 2004 and thus currently not usable
105 <para>
106
107 If you have an rpm-based system, you can use alien to convert the
108 .deb into .rpm, or download an rpm-ized version at
109 <ulink url="http://people.debian.org/~blade/install/debootstrap"></ulink>
110
111 </para>
112 -->
113
114 <para>
115
116 Or, you can use the following procedure to install it
117 manually. Make a work folder for extracting the .deb into:
118
119 <informalexample><screen>
120 # mkdir work
121 # cd work
122 </screen></informalexample>
123
124 The <command>debootstrap</command> binary is located in the Debian
125 archive (be sure to select the proper file for your
126 architecture). Download the <command>debootstrap</command> .deb from
127 the <ulink url="http://ftp.debian.org/debian/pool/main/d/debootstrap/">
128 pool</ulink>, copy the package to the work folder, and extract the
129 binary files from it. You will need to have root privileges to install
130 the binaries.
131
132 <informalexample><screen>
133 # ar -x debootstrap_0.X.X_arch.deb
134 # cd /
135 # zcat /full-path-to-work/work/data.tar.gz | tar xv
136 </screen></informalexample>
137
138 </para><para>
139
140 Note that running <command>debootstrap</command> may require you to have
141 a minimal version of <classname>glibc</classname> installed (currently
142 GLIBC_2.3). <command>debootstrap</command> itself is a shell script, but
143 it calls various utilities that require <classname>glibc</classname>.
144
145 </para>
146 </sect2>
147
148 <sect2>
149 <title>Run <command>debootstrap</command></title>
150 <para>
151
152 <command>debootstrap</command> can download the needed files directly
153 from the archive when you run it. You can substitute any Debian
154 archive mirror for <userinput>http.us.debian.org/debian</userinput> in
155 the command example below, preferably a mirror close to you
156 network-wise. Mirrors are listed at
157 <ulink url="http://www.debian.org/misc/README.mirrors"></ulink>.
158
159 </para><para>
160
161 If you have a &releasename; &debian; CD mounted at
162 <filename>/cdrom</filename>, you could substitute a file URL instead
163 of the http URL: <userinput>file:/cdrom/debian/</userinput>
164
165 </para><para>
166
167 Substitute one of the following for <replaceable>ARCH</replaceable>
168 in the <command>debootstrap</command> command:
169
170 <userinput>alpha</userinput>,
171 <userinput>arm</userinput>,
172 <userinput>hppa</userinput>,
173 <userinput>i386</userinput>,
174 <userinput>ia64</userinput>,
175 <userinput>m68k</userinput>,
176 <userinput>mips</userinput>,
177 <userinput>mipsel</userinput>,
178 <userinput>powerpc</userinput>,
179 <userinput>s390</userinput>, or
180 <userinput>sparc</userinput>.
181
182 <informalexample><screen>
183 # /usr/sbin/debootstrap --arch ARCH &releasename; \
184 /mnt/debinst http://http.us.debian.org/debian
185 </screen></informalexample>
186
187 </para>
188 </sect2>
189
190 <sect2>
191 <title>Configure The Base System</title>
192 <para>
193
194 Now you've got a real Debian system, though rather lean, on disk.
195 <command>Chroot</command> into it:
196
197 <informalexample><screen>
198 # LANG= chroot /mnt/debinst /bin/bash
199 </screen></informalexample>
200
201 </para>
202
203 <sect3>
204 <title>Mount Partitions</title>
205 <para>
206
207 You need to create <filename>/etc/fstab</filename>.
208
209 <informalexample><screen>
210 # editor /etc/fstab
211 </screen></informalexample>
212
213 Here is a sample you can modify to suit:
214
215 <informalexample><screen>
216 # /etc/fstab: static file system information.
217 #
218 # file system mount point type options dump pass
219 /dev/XXX / ext3 defaults 0 1
220 /dev/XXX /boot ext3 ro,nosuid,nodev 0 2
221
222 /dev/XXX none swap sw 0 0
223 proc /proc proc defaults 0 0
224
225 /dev/fd0 /mnt/floppy auto noauto,rw,sync,user,exec 0 0
226 /dev/cdrom /mnt/cdrom iso9660 noauto,ro,user,exec 0 0
227
228 /dev/XXX /tmp ext3 rw,nosuid,nodev 0 2
229 /dev/XXX /var ext3 rw,nosuid,nodev 0 2
230 /dev/XXX /usr ext3 rw,nodev 0 2
231 /dev/XXX /home ext3 rw,nosuid,nodev 0 2
232 </screen></informalexample>
233
234 Use <userinput>mount -a</userinput> to mount all the file systems you
235 have specified in your <filename>/etc/fstab</filename>, or to mount
236 file systems individually use:
237
238 <informalexample><screen>
239 # mount /path # e.g.: mount /usr
240 </screen></informalexample>
241
242 You can mount the proc file system multiple times and to arbitrary
243 locations, though <filename>/proc</filename> is customary. If you didn't use
244 <userinput>mount -a</userinput>, be sure to mount proc before continuing:
245
246 <informalexample><screen>
247 # mount -t proc proc /proc
248 </screen></informalexample>
249
250 </para><para>
251
252 The command <userinput>ls /proc</userinput> should now show a non-empty
253 directory. Should this fail, you may be able to mount proc from outside
254 the chroot:
255
256 <informalexample><screen>
257 # mount -t proc proc /mnt/debinst/proc
258 </screen></informalexample>
259
260 </para>
261 </sect3>
262
263 <sect3>
264 <title>Configure Keyboard</title>
265 <para>
266
267 To configure your keyboard:
268
269 <informalexample><screen>
270 # dpkg-reconfigure console-data
271 </screen></informalexample>
272
273 </para><para>
274
275 Note that the keyboard cannot be set while in the chroot, but will be
276 configured for the next reboot.
277
278 </para>
279 </sect3>
280
281 <sect3>
282 <title>Configure Networking</title>
283 <para>
284
285 To configure networking, edit
286 <filename>/etc/network/interfaces</filename>,
287 <filename>/etc/resolv.conf</filename>,
288 <filename>/etc/hostname</filename> and
289 <filename>/etc/hosts</filename>.
290
291 <informalexample><screen>
292 # editor /etc/network/interfaces
293 </screen></informalexample>
294
295 Here are some simple examples from
296 <filename>/usr/share/doc/ifupdown/examples</filename>:
297
298 <informalexample><screen>
299 ######################################################################
300 # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
301 # See the interfaces(5) manpage for information on what options are
302 # available.
303 ######################################################################
304
305 # We always want the loopback interface.
306 #
307 auto lo
308 iface lo inet loopback
309
310 # To use dhcp:
311 #
312 # auto eth0
313 # iface eth0 inet dhcp
314
315 # An example static IP setup: (broadcast and gateway are optional)
316 #
317 # auto eth0
318 # iface eth0 inet static
319 # address 192.168.0.42
320 # network 192.168.0.0
321 # netmask 255.255.255.0
322 # broadcast 192.168.0.255
323 # gateway 192.168.0.1
324 </screen></informalexample>
325
326 Enter your nameserver(s) and search directives in
327 <filename>/etc/resolv.conf</filename>:
328
329 <informalexample><screen>
330 # editor /etc/resolv.conf
331 </screen></informalexample>
332
333 A simple <filename>/etc/resolv.conf</filename>:
334
335 <informalexample><screen>
336 search hqdom.local\000
337 nameserver 10.1.1.36
338 nameserver 192.168.9.100
339 </screen></informalexample>
340
341 Enter your system's host name (2 to 63 characters):
342
343 <informalexample><screen>
344 # echo DebianHostName &gt; /etc/hostname
345 </screen></informalexample>
346
347 If you have multiple network cards, you should arrange the names of
348 driver modules in the <filename>/etc/modules</filename> file into the
349 desired order. Then during boot, each card will be associated with the
350 interface name (eth0, eth1, etc.) that you expect.
351
352 </para>
353 </sect3>
354
355 <sect3>
356 <title>Configure Locales</title>
357 <para>
358
359 To configure your locale settings to use a language other than
360 English, install the locales support package and configure it:
361
362 <informalexample><screen>
363 # apt-get install locales
364 # dpkg-reconfigure locales
365 </screen></informalexample>
366
367 NOTE: Apt must be configured beforehand by creating a sources.list and
368 running apt-get update.
369 Before using locales with character sets other than ASCII or latin1,
370 please consult the appropriate localization HOWTO.
371
372 </para>
373 </sect3>
374 </sect2>
375
376 <sect2>
377 <title>Install a Kernel</title>
378 <para>
379
380 If you intend to boot this system, you probably want a Linux kernel
381 and a boot loader. Identify available pre-packaged kernels with
382
383 <informalexample><screen>
384 # apt-cache search <phrase condition="classic-kpkg">kernel</phrase><phrase condition="common-kpkg">linux</phrase>-image
385 </screen></informalexample>
386
387 Then install your choice using its package name.
388
389 <informalexample><screen>
390 # apt-get install <phrase condition="classic-kpkg">kernel</phrase><phrase condition="common-kpkg">linux</phrase>-image-<replaceable>&kernelversion;-arch-etc</replaceable>
391 </screen></informalexample>
392
393 </para>
394 </sect2>
395
396 <sect2>
397 <title>Set up the Boot Loader</title>
398 <para>
399
400 To make your &debian; system bootable, set up your boot loader to load
401 the installed kernel with your new root partition. Note that debootstrap
402 does not install a boot loader, though you can use apt-get inside your
403 Debian chroot to do so.
404
405 </para><para arch="i386">
406
407 Check <userinput>info grub</userinput> or <userinput>man
408 lilo.conf</userinput> for instructions on setting up the
409 bootloader. If you are keeping the system you used to install Debian, just
410 add an entry for the Debian install to your existing grub
411 <filename>menu.lst</filename> or <filename>lilo.conf</filename>. For
412 <filename>lilo.conf</filename>, you could also copy it to the new system and
413 edit it there. After you are done editing, call lilo (remember it will use
414 <filename>lilo.conf</filename> relative to the system you call it from).
415
416 </para><para arch="i386">
417
418 Here is a basic <filename>/etc/lilo.conf</filename> as an example:
419
420 <informalexample><screen>
421 boot=/dev/hda6
422 root=/dev/hda6
423 install=menu
424 delay=20
425 lba32
426 image=/vmlinuz
427 label=Debian
428 </screen></informalexample>
429
430 </para><para arch="powerpc">
431
432 Check <userinput>man yaboot.conf</userinput> for instructions on
433 setting up the bootloader. If you are keeping the system you used to
434 install Debian, just add an entry for the Debian install to your
435 existing <filename>yaboot.conf</filename>. You could also copy it to
436 the new system and
437 edit it there. After you are done editing, call ybin (remember it will
438 use <filename>yaboot.conf</filename> relative to the system you call it from).
439
440 </para><para arch="powerpc">
441
442 Here is a basic <filename>/etc/yaboot.conf</filename> as an example:
443
444 <informalexample><screen>
445 boot=/dev/hda2
446 device=hd:
447 partition=6
448 root=/dev/hda6
449 magicboot=/usr/lib/yaboot/ofboot
450 timeout=50
451 image=/vmlinux
452 label=Debian
453 </screen></informalexample>
454
455 On some machines, you may need to use <userinput>ide0:</userinput>
456 instead of <userinput>hd:</userinput>.
457
458 </para>
459 </sect2>
460 </sect1>

Properties

Name Value
svn:keywords Id

  ViewVC Help
Powered by ViewVC 1.1.5