| 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 |
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 utility used by the Debian installer, and 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 |
files from it. You will need to have root privileges to install
|
| 130 |
the files.
|
| 131 |
|
| 132 |
<informalexample><screen>
|
| 133 |
# ar -x debootstrap_0.X.X_all.deb
|
| 134 |
# cd /
|
| 135 |
# zcat /full-path-to-work/work/data.tar.gz | tar xv
|
| 136 |
</screen></informalexample>
|
| 137 |
|
| 138 |
</para>
|
| 139 |
</sect2>
|
| 140 |
|
| 141 |
<sect2>
|
| 142 |
<title>Run <command>debootstrap</command></title>
|
| 143 |
<para>
|
| 144 |
|
| 145 |
<command>debootstrap</command> can download the needed files directly
|
| 146 |
from the archive when you run it. You can substitute any Debian
|
| 147 |
archive mirror for <userinput>http.us.debian.org/debian</userinput> in
|
| 148 |
the command example below, preferably a mirror close to you
|
| 149 |
network-wise. Mirrors are listed at
|
| 150 |
<ulink url="http://www.debian.org/misc/README.mirrors"></ulink>.
|
| 151 |
|
| 152 |
</para><para>
|
| 153 |
|
| 154 |
If you have a &releasename; &debian; CD mounted at
|
| 155 |
<filename>/cdrom</filename>, you could substitute a file URL instead
|
| 156 |
of the http URL: <userinput>file:/cdrom/debian/</userinput>
|
| 157 |
|
| 158 |
</para><para>
|
| 159 |
|
| 160 |
Substitute one of the following for <replaceable>ARCH</replaceable>
|
| 161 |
in the <command>debootstrap</command> command:
|
| 162 |
|
| 163 |
<userinput>alpha</userinput>,
|
| 164 |
<userinput>arm</userinput>,
|
| 165 |
<userinput>hppa</userinput>,
|
| 166 |
<userinput>i386</userinput>,
|
| 167 |
<userinput>ia64</userinput>,
|
| 168 |
<userinput>m68k</userinput>,
|
| 169 |
<userinput>mips</userinput>,
|
| 170 |
<userinput>mipsel</userinput>,
|
| 171 |
<userinput>powerpc</userinput>,
|
| 172 |
<userinput>s390</userinput>, or
|
| 173 |
<userinput>sparc</userinput>.
|
| 174 |
|
| 175 |
<informalexample><screen>
|
| 176 |
# /usr/sbin/debootstrap --arch ARCH &releasename; \
|
| 177 |
/mnt/debinst http://http.us.debian.org/debian
|
| 178 |
</screen></informalexample>
|
| 179 |
|
| 180 |
</para>
|
| 181 |
</sect2>
|
| 182 |
|
| 183 |
<sect2>
|
| 184 |
<title>Configure The Base System</title>
|
| 185 |
<para>
|
| 186 |
|
| 187 |
Now you've got a real Debian system, though rather lean, on disk.
|
| 188 |
<command>Chroot</command> into it:
|
| 189 |
|
| 190 |
<informalexample><screen>
|
| 191 |
# LANG= chroot /mnt/debinst /bin/bash
|
| 192 |
</screen></informalexample>
|
| 193 |
|
| 194 |
</para>
|
| 195 |
|
| 196 |
<sect3>
|
| 197 |
<title>Mount Partitions</title>
|
| 198 |
<para>
|
| 199 |
|
| 200 |
You need to create <filename>/etc/fstab</filename>.
|
| 201 |
|
| 202 |
<informalexample><screen>
|
| 203 |
# editor /etc/fstab
|
| 204 |
</screen></informalexample>
|
| 205 |
|
| 206 |
Here is a sample you can modify to suit:
|
| 207 |
|
| 208 |
<informalexample><screen>
|
| 209 |
# /etc/fstab: static file system information.
|
| 210 |
#
|
| 211 |
# file system mount point type options dump pass
|
| 212 |
/dev/XXX / ext3 defaults 0 1
|
| 213 |
/dev/XXX /boot ext3 ro,nosuid,nodev 0 2
|
| 214 |
|
| 215 |
/dev/XXX none swap sw 0 0
|
| 216 |
proc /proc proc defaults 0 0
|
| 217 |
|
| 218 |
/dev/fd0 /mnt/floppy auto noauto,rw,sync,user,exec 0 0
|
| 219 |
/dev/cdrom /mnt/cdrom iso9660 noauto,ro,user,exec 0 0
|
| 220 |
|
| 221 |
/dev/XXX /tmp ext3 rw,nosuid,nodev 0 2
|
| 222 |
/dev/XXX /var ext3 rw,nosuid,nodev 0 2
|
| 223 |
/dev/XXX /usr ext3 rw,nodev 0 2
|
| 224 |
/dev/XXX /home ext3 rw,nosuid,nodev 0 2
|
| 225 |
</screen></informalexample>
|
| 226 |
|
| 227 |
Use <userinput>mount -a</userinput> to mount all the file systems you
|
| 228 |
have specified in your <filename>/etc/fstab</filename>, or to mount
|
| 229 |
file systems individually use:
|
| 230 |
|
| 231 |
<informalexample><screen>
|
| 232 |
# mount /path # e.g.: mount /usr
|
| 233 |
</screen></informalexample>
|
| 234 |
|
| 235 |
You can mount the proc file system multiple times and to arbitrary
|
| 236 |
locations, though <filename>/proc</filename> is customary. If you didn't use
|
| 237 |
<userinput>mount -a</userinput>, be sure to mount proc before continuing:
|
| 238 |
|
| 239 |
<informalexample><screen>
|
| 240 |
# mount -t proc proc /proc
|
| 241 |
</screen></informalexample>
|
| 242 |
|
| 243 |
</para><para>
|
| 244 |
|
| 245 |
The command <userinput>ls /proc</userinput> should now show a non-empty
|
| 246 |
directory. Should this fail, you may be able to mount proc from outside
|
| 247 |
the chroot:
|
| 248 |
|
| 249 |
<informalexample><screen>
|
| 250 |
# mount -t proc proc /mnt/debinst/proc
|
| 251 |
</screen></informalexample>
|
| 252 |
|
| 253 |
</para>
|
| 254 |
</sect3>
|
| 255 |
|
| 256 |
<sect3>
|
| 257 |
<title>Configure Keyboard</title>
|
| 258 |
<para>
|
| 259 |
|
| 260 |
To configure your keyboard:
|
| 261 |
|
| 262 |
<informalexample><screen>
|
| 263 |
# dpkg-reconfigure console-data
|
| 264 |
</screen></informalexample>
|
| 265 |
|
| 266 |
</para><para>
|
| 267 |
|
| 268 |
Note that the keyboard cannot be set while in the chroot, but will be
|
| 269 |
configured for the next reboot.
|
| 270 |
|
| 271 |
</para>
|
| 272 |
</sect3>
|
| 273 |
|
| 274 |
<sect3>
|
| 275 |
<title>Configure Networking</title>
|
| 276 |
<para>
|
| 277 |
|
| 278 |
To configure networking, edit
|
| 279 |
<filename>/etc/network/interfaces</filename>,
|
| 280 |
<filename>/etc/resolv.conf</filename>,
|
| 281 |
<filename>/etc/hostname</filename> and
|
| 282 |
<filename>/etc/hosts</filename>.
|
| 283 |
|
| 284 |
<informalexample><screen>
|
| 285 |
# editor /etc/network/interfaces
|
| 286 |
</screen></informalexample>
|
| 287 |
|
| 288 |
Here are some simple examples from
|
| 289 |
<filename>/usr/share/doc/ifupdown/examples</filename>:
|
| 290 |
|
| 291 |
<informalexample><screen>
|
| 292 |
######################################################################
|
| 293 |
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
|
| 294 |
# See the interfaces(5) manpage for information on what options are
|
| 295 |
# available.
|
| 296 |
######################################################################
|
| 297 |
|
| 298 |
# We always want the loopback interface.
|
| 299 |
#
|
| 300 |
auto lo
|
| 301 |
iface lo inet loopback
|
| 302 |
|
| 303 |
# To use dhcp:
|
| 304 |
#
|
| 305 |
# auto eth0
|
| 306 |
# iface eth0 inet dhcp
|
| 307 |
|
| 308 |
# An example static IP setup: (broadcast and gateway are optional)
|
| 309 |
#
|
| 310 |
# auto eth0
|
| 311 |
# iface eth0 inet static
|
| 312 |
# address 192.168.0.42
|
| 313 |
# network 192.168.0.0
|
| 314 |
# netmask 255.255.255.0
|
| 315 |
# broadcast 192.168.0.255
|
| 316 |
# gateway 192.168.0.1
|
| 317 |
</screen></informalexample>
|
| 318 |
|
| 319 |
Enter your nameserver(s) and search directives in
|
| 320 |
<filename>/etc/resolv.conf</filename>:
|
| 321 |
|
| 322 |
<informalexample><screen>
|
| 323 |
# editor /etc/resolv.conf
|
| 324 |
</screen></informalexample>
|
| 325 |
|
| 326 |
A simple <filename>/etc/resolv.conf</filename>:
|
| 327 |
|
| 328 |
<informalexample><screen>
|
| 329 |
search hqdom.local\000
|
| 330 |
nameserver 10.1.1.36
|
| 331 |
nameserver 192.168.9.100
|
| 332 |
</screen></informalexample>
|
| 333 |
|
| 334 |
Enter your system's host name (2 to 63 characters):
|
| 335 |
|
| 336 |
<informalexample><screen>
|
| 337 |
# echo DebianHostName > /etc/hostname
|
| 338 |
</screen></informalexample>
|
| 339 |
|
| 340 |
If you have multiple network cards, you should arrange the names of
|
| 341 |
driver modules in the <filename>/etc/modules</filename> file into the
|
| 342 |
desired order. Then during boot, each card will be associated with the
|
| 343 |
interface name (eth0, eth1, etc.) that you expect.
|
| 344 |
|
| 345 |
</para>
|
| 346 |
</sect3>
|
| 347 |
|
| 348 |
<sect3>
|
| 349 |
<title>Configure Locales</title>
|
| 350 |
<para>
|
| 351 |
|
| 352 |
To configure your locale settings to use a language other than
|
| 353 |
English, install the <classname>locales</classname> support package
|
| 354 |
and configure it:
|
| 355 |
|
| 356 |
<informalexample><screen>
|
| 357 |
# aptitude install locales
|
| 358 |
# dpkg-reconfigure locales
|
| 359 |
</screen></informalexample>
|
| 360 |
|
| 361 |
NOTE: <classname>apt</classname> must be configured beforehand by creating
|
| 362 |
a sources.list and running <command>aptitude update</command>.
|
| 363 |
Before using locales with character sets other than ASCII or latin1,
|
| 364 |
please consult the appropriate localization HOWTO.
|
| 365 |
|
| 366 |
</para>
|
| 367 |
</sect3>
|
| 368 |
</sect2>
|
| 369 |
|
| 370 |
<sect2>
|
| 371 |
<title>Install a Kernel</title>
|
| 372 |
<para>
|
| 373 |
|
| 374 |
If you intend to boot this system, you probably want a Linux kernel
|
| 375 |
and a boot loader. Identify available pre-packaged kernels with
|
| 376 |
|
| 377 |
<informalexample><screen>
|
| 378 |
# apt-cache search linux-image
|
| 379 |
</screen></informalexample>
|
| 380 |
|
| 381 |
Then install your choice using its package name.
|
| 382 |
|
| 383 |
<informalexample><screen>
|
| 384 |
# aptitude install linux-image-<replaceable>&kernelversion;-arch-etc</replaceable>
|
| 385 |
</screen></informalexample>
|
| 386 |
|
| 387 |
</para>
|
| 388 |
</sect2>
|
| 389 |
|
| 390 |
<sect2>
|
| 391 |
<title>Set up the Boot Loader</title>
|
| 392 |
<para>
|
| 393 |
|
| 394 |
To make your &debian; system bootable, set up your boot loader to load
|
| 395 |
the installed kernel with your new root partition. Note that
|
| 396 |
<command>debootstrap</command> does not install a boot loader, though you
|
| 397 |
can use <command>aptitude</command> inside your Debian chroot to do so.
|
| 398 |
|
| 399 |
</para><para arch="x86">
|
| 400 |
|
| 401 |
Check <userinput>info grub</userinput> or <userinput>man
|
| 402 |
lilo.conf</userinput> for instructions on setting up the
|
| 403 |
bootloader. If you are keeping the system you used to install Debian, just
|
| 404 |
add an entry for the Debian install to your existing grub
|
| 405 |
<filename>menu.lst</filename> or <filename>lilo.conf</filename>. For
|
| 406 |
<filename>lilo.conf</filename>, you could also copy it to the new system and
|
| 407 |
edit it there. After you are done editing, call lilo (remember it will use
|
| 408 |
<filename>lilo.conf</filename> relative to the system you call it from).
|
| 409 |
|
| 410 |
</para><para arch="x86">
|
| 411 |
|
| 412 |
Here is a basic <filename>/etc/lilo.conf</filename> as an example:
|
| 413 |
|
| 414 |
<informalexample><screen>
|
| 415 |
boot=/dev/hda6
|
| 416 |
root=/dev/hda6
|
| 417 |
install=menu
|
| 418 |
delay=20
|
| 419 |
lba32
|
| 420 |
image=/vmlinuz
|
| 421 |
label=Debian
|
| 422 |
</screen></informalexample>
|
| 423 |
|
| 424 |
</para><para arch="powerpc">
|
| 425 |
|
| 426 |
Check <userinput>man yaboot.conf</userinput> for instructions on
|
| 427 |
setting up the bootloader. If you are keeping the system you used to
|
| 428 |
install Debian, just add an entry for the Debian install to your
|
| 429 |
existing <filename>yaboot.conf</filename>. You could also copy it to
|
| 430 |
the new system and
|
| 431 |
edit it there. After you are done editing, call ybin (remember it will
|
| 432 |
use <filename>yaboot.conf</filename> relative to the system you call it from).
|
| 433 |
|
| 434 |
</para><para arch="powerpc">
|
| 435 |
|
| 436 |
Here is a basic <filename>/etc/yaboot.conf</filename> as an example:
|
| 437 |
|
| 438 |
<informalexample><screen>
|
| 439 |
boot=/dev/hda2
|
| 440 |
device=hd:
|
| 441 |
partition=6
|
| 442 |
root=/dev/hda6
|
| 443 |
magicboot=/usr/lib/yaboot/ofboot
|
| 444 |
timeout=50
|
| 445 |
image=/vmlinux
|
| 446 |
label=Debian
|
| 447 |
</screen></informalexample>
|
| 448 |
|
| 449 |
On some machines, you may need to use <userinput>ide0:</userinput>
|
| 450 |
instead of <userinput>hd:</userinput>.
|
| 451 |
|
| 452 |
</para>
|
| 453 |
</sect2>
|
| 454 |
</sect1>
|