• Aucun résultat trouvé

Configure The Base System

Dans le document Ubuntu Installation Guide (Page 121-125)

D. Random Bits

D.4. Installing Ubuntu from a Unix/Linux System

D.4.4. Configure The Base System

Now you’ve got a real Ubuntu system, though rather lean, on disk.chrootinto it:

# LANG=C.UTF-8 chroot /mnt/ubuntu /bin/bash

After chrooting you may need to set the terminal definition to be compatible with the Ubuntu base system, for example:

# export TERM=xterm-color

Depending on the value of TERM, you may have to install thencurses-termpackage to get support for it.

D.4.4.1. Create device files

At this point/dev/only contains very basic device files. For the next steps of the installation addi-tional device files may be needed. There are different ways to go about this and which method you should use depends on the host system you are using for the installation, on whether you intend to use a modular kernel or not, and on whether you intend to use dynamic (e.g. usingudev) or static device files for the new system.

A few of the available options are:

install the makedev package, and create a default set of static device files using (after chrooting)

# apt-get install makedev

# mount none /proc -t proc

# cd /dev

# MAKEDEV generic

manually create only specific device files usingMAKEDEV

bind mount /dev from your host system on top of /dev in the target system; note that the postinst scripts of some packages may try to create device files, so this option should only be used with care

D.4.4.2. Mount Partitions

You need to create/etc/fstab.

# editor /etc/fstab

Here is a sample you can modify to suit:

# /etc/fstab: static file system information.

#

# file system mount point type options dump pass

/dev/XXX / ext3 defaults 0 1

/dev/XXX /boot ext3 ro,nosuid,nodev 0 2

/dev/XXX none swap sw 0 0

proc /proc proc defaults 0 0

sys /sys sysfs defaults 0 0

/dev/fd0 /media/floppy auto noauto,rw,sync,user,exec 0 0 /dev/cdrom /media/cdrom iso9660 noauto,ro,user,exec 0 0

/dev/XXX /tmp ext3 rw,nosuid,nodev 0 2

/dev/XXX /var ext3 rw,nosuid,nodev 0 2

/dev/XXX /usr ext3 rw,nodev 0 2

/dev/XXX /home ext3 rw,nosuid,nodev 0 2

Usemount -ato mount all the file systems you have specified in your/etc/fstab, or, to mount file systems individually, use:

# mount /path # e.g.: mount /usr

Current Ubuntu systems have mountpoints for removable media under/media, but keep compatibil-ity symlinks in/. Create these as as needed, for example:

# cd /media

# mkdir cdrom0

# ln -s cdrom0 cdrom

# cd /

# ln -s media/cdrom

You can mount the proc and sysfs file systems multiple times and to arbitrary locations, though/proc and/sysrespectively are customary. If you didn’t usemount -a, be sure to mount proc and sysfs before continuing:

# mount -t proc proc /proc

# mount -t sysfs sysfs /sys

The commandls /procshould now show a non-empty directory. Should this fail, you may be able to mount proc from outside the chroot:

# mount -t proc proc /mnt/ubuntu/proc

D.4.4.3. Setting Timezone

Setting the third line of the file /etc/adjtimeto “UTC” or “LOCAL” determines whether the system will interpret the hardware clock as being set to UTC respective local time. The following command allows you to set that.

# editor /etc/adjtime Here is a sample:

0.0 0 0.0 0

UTC

The following command allows you to choose your timezone.

# dpkg-reconfigure tzdata

D.4.4.4. Configure Networking

To configure networking, edit /etc/network/interfaces, /etc/resolv.conf, /etc/hostnameand/etc/hosts.

# editor /etc/network/interfaces

Here are some simple examples from/usr/share/doc/ifupdown/examples:

######################################################################

# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

# See the interfaces(5) manpage for information on what options are

# available.

######################################################################

# We always want the loopback interface.

# auto lo

iface lo inet loopback

# To use dhcp:

#

# auto eth0

# iface eth0 inet dhcp

# An example static IP setup: (broadcast and gateway are optional)

#

# auto eth0

# iface eth0 inet static

# address 192.168.0.42

# network 192.168.0.0

# netmask 255.255.255.0

# broadcast 192.168.0.255

# gateway 192.168.0.1

Enter your nameserver(s) and search directives in/etc/resolv.conf:

# editor /etc/resolv.conf A simple example/etc/resolv.conf: search hqdom.local

nameserver 10.1.1.36 nameserver 192.168.9.100

Enter your system’s host name (2 to 63 characters):

# echo UbuntuHostName > /etc/hostname And a basic/etc/hostswith IPv6 support:

127.0.0.1 localhost 127.0.1.1 UbuntuHostName

# The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts

If you have multiple network cards, you should arrange the names of driver modules in the /etc/modulesfile into the desired order. Then during boot, each card will be associated with the interface name (eth0, eth1, etc.) that you expect.

D.4.4.5. Configure Apt

Debootstrap will have created a very basic/etc/apt/sources.listthat will allow installing ad-ditional packages. However, it is suggested that you add some adad-ditional sources, for example for source packages and security updates:

deb-src http://archive.ubuntu.com/ubuntu xenial main deb http://security.ubuntu.com/ubuntu xenial-security main deb-src http://security.ubuntu.com/ubuntu xenial-security main Make sure to runaptitude updateafter you have made changes to the sources list.

D.4.4.6. Configure Locales and Keyboard

To configure your locale settings to use a language other than English, install the appropriate language packs and configure them. Currently the use of UTF-8 locales is recommended.

# aptitude install language-pack-de language-pack-gnome-de To configure your keyboard (if needed):

# aptitude install console-setup

# dpkg-reconfigure keyboard-configuration

Note that the keyboard cannot be set while in the chroot, but will be configured for the next reboot.

Dans le document Ubuntu Installation Guide (Page 121-125)