Install from existing Linux (Italiano)

From ArchWiki
Revision as of 16:18, 11 November 2010 by Ahel (Talk | contribs) (Setup the host system)

Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Install from existing Linux (Italiano)#)

This guide is intended to combine and update the three previously existing and highly similar alternative install guides on this wiki. This guide is intended for anybody who wants to install Arch Linux from any other running Linux -- be it off a LiveCD or a pre-existing install of a different distro.

Overview

Pacman di Arch Linux puo' essere configurato (-r) per operare in una qualsiasi directory, usando essa come contesto di "root" mentre si esegue pacman.

Cio' e' utile per creare un nuovo sistema Arch Linux dal disco live di un altra distro o da una installazione esistente. E' altresi' utile per creare nuovi ambienti chroot come sistemi "host", mantenendo una "golden-master" per lo sviluppo e la distribuzione, o altri divertenti motivi come rootfs-over-NFS per macchine senza disco.

Nel caso di un host x86_64, e' comunque possibile usare un pacman i686 per creare un ambiente chroot a 32bit. Guardare Arch64 Install bundled 32bit system.

Lungo questa guida, ci si riferisce a partizioni come /dev/hdxx o /dev/sdxx. Cioe' ci si riferisce a una qualunque dev si abbia nel proprio sistema per la partizione in questione. La convenzione e': Drive 1, Partition 1: /dev/hda1 or /dev/sda1 Drive 1, Partition 2: /dev/hda2 or /dev/sda2 Drive 2, Partition 1: /dev/hdb1 or /dev/sdb1 etc...

In genere verra' utilizzata /dev/sdxx , ma si faccia attenzione che sul proprio sistema quell'entrata potrebbe essere /dev/hdxx.

In questo articolo, "host" si riferisce al computer che e' usato per creare l'installazione, e "target" e' il computer dove si vuole installare Arch. Questi potrebbero essere lo stesso computer. Non e' necessario che l'host sia una distribuzione Arch -- potrebbe essere Debian o un sistema Redhat. La sezione inititolata "Setup del sistema host" spiega come installare pacman nell'host. La sezione seguente intitolata "Setup del sistema target" spiega come usare pacman dal sistema host per installare Arch Linux nel computer target. Quindi se il proprio sistema e' gia' Arch Linux, si puo' procedere alla sezione "Setup del sistema target".

Setup the host system

E' necessario installare il pacchetto pacman di Archlinux nel proprio ambiente linux (host).Inoltre si dovra' recuperare la lista dei mirrors site [1] che pacman utilizzera' per scaricare i pacchetti del sistema.

Get the required packages

Si devono recuperare i pacchetti richiesti dal proprio ambiente linux ospitante.Nell'esempio dato qua si assume si stia usando un ambiente i686. ""Se si sta utilizzando un sistema linux a 64bit si dovra' cambiare a ogni evenienza "i686" con "x86_64".

Tutte i numeri di versione utilizzati qui possono essere cambiati. Si prega di controllare i numeri di versione in principio e annotarli. I numeri della versione possono essere trovati "

Una volta certi dei numeri di versione, si scarichino i pacchetti richiesti (cambiare il valore di ARCH a seconda delle proprie necessita'):

ARCH=i686
mkdir /tmp/archlinux
cd /tmp/archlinux

Ora si scarichino i pacchetti richiesti:

wget http://www.archlinux.org/packages/core/$ARCH/pacman/download/
wget http://www.archlinux.org/packages/core/any/pacman-mirrorlist/download/

Nota: Se si dovessero incontrare problemi scaricando pacman-mirrorlist usare questo metodo diretto:

wget http://mirrors.kernel.org/archlinux/core/os/x86_64/pacman-mirrorlist-20100825-1-any.pkg.tar.gz

Si potrebbe aver bisogno di altre librerie per far funzionare pacman:

wget http://www.archlinux.org/packages/core/$ARCH/libfetch/download/
wget http://www.archlinux.org/packages/core/$ARCH/libarchive/download/
wget http://www.archlinux.org/packages/core/$ARCH/openssl/download/
wget http://www.archlinux.org/packages/core/$ARCH/xz/download/

Spacchettare tutti i pacchetti necessari:

for f in *.tar.gz ; do tar xzvf $f ; done

Prima di usare pacman, non scordare di editare /tmp/archlinux/etc/pacman.conf in modo da puntare a /tmp/archlinux/etc/pacman.d/mirrorlist e selezionare il proprio mirror prescelto. Per facilitare le cose (assumendo si stia utilizzando bash o zsh), si puo' configurare l'ambiente in tal modo

export PATH=/tmp/archlinux/usr/bin:$PATH
export LD_LIBRARY_PATH=/tmp/archlinux/usr/lib:$LD_LIBRARY_PATH
alias pacman="pacman --config /tmp/archlinux/etc/pacman.conf"

Install the required files onto the host system

Se non vi importa mettere in disordine il proprio sistema host, si puo' estrarre tutti i tarball scaricati nella propria directory root dando da root questi comandi:

cd /
for f in /tmp/archlinux/pacman-*pkg.tar.gz ; do
  tar xzf $f
done
  1. Se si sta installando da Ubuntu 9.10 LiveCD (o forse da anche altre versioni), saranno necessari non solo i file di pacman (shared libs) per usarlo. Usare lo script di Lucky descritto in [questo thread] per scaricarli!
  2. Alternatively, you can instead turn these tarballs into packages for your distribution with the alien tool. See the man page of the tool for instructions. The packages created that way may be installed into your host distribution using the usual package management tools available there. This approach offers the best integration into the host linux environment. For a debian package based system this is done with the following commands:
    cd /tmp/archlinux
    alien -d pacman-3.3.3-1-i686.pkg.tar.gz
    alien -d pacman-mirrorlist-20100131-1-i686.pkg.tar.gz
    


    RPM based systems will need to replace the parameter "-d" with "-r".

    These distribution packages can then get installed using the normal package management tools of the host linux environment.

  3. Under Fedora 12, I wasn't able to install pacman with any of the other methods, but with the nice script at http://bbs.archlinux.org/viewtopic.php?pid=734336#p734336 it will download and install it for you. Worked wonderfully for me.

  4. On Gentoo: Just unmask pacman by adding sys-apps/pacman to /etc/portage/package.keywords. Now just run emerge -av pacman.

    There is also a more detailed tutorial.

  5. An older method is discussed here.

Configure the host system

Configure your /etc/pacman.conf to your liking, and remove unnecessary mirrors from /etc/pacman.d/mirrorlist. Also, enabling at least a few mirrors might become necessary, as you may experience errors during syncing if you have no mirror set. You may want to manually resolve DNS in the /etc/pacman.d/mirrorlist, because pacman for i686 may not be able to get address information on x86_64 systems.

If you're installing from a LiveCD, and you have a system with a low amount of combined RAM and swap (< 1 GB), be sure to set the cachedir in /etc/pacman.conf to be in the new Arch partition (e.g. Template:Filename). Otherwise you could exhaust memory between the overhead of the existing distro and downloading necessary packages to install.

Setup the target system

Prepare a partition for Arch

You don't have to install Arch on a separate partition. You could instead build up a root filesystem in a normal directory, and then create a master tarball from it, or transfer it across the network.

However, most users will want to be installing Arch onto its own partition.

Prepare any partitions and filesystems you need for your installation. If your host system has any gui tools for this, such as gparted, cfdisk, or mandrakes diskdrake, feel free to use them.

To format a partition as ext3, you run (where /dev/sdxx is the partition you want to setup):

# mkfs.ext3 /dev/sdxx 

To format it as ext3 with journaling and dir_index:

# mkfs.ext3 -j -O dir_index /dev/sdxx 

To format it as reiserfs:

# mkreiserfs /dev/sdxx 

To format a partition as swap, and to start using it:

# mkswap /dev/sdxx 
# swapon /dev/sdxx

Most other filesystems can be setup with their own mkfs variant, take a look with tab completion. Available filesystems depend entirely on your host system.

Once you have your filesystems setup, mount them. Throughout this guide, we will refer to the new Arch root directory as /newarch, however you can put it wherever you like.

# mkdir /newarch 
# mount /dev/sdxx /newarch

Install the core

Update pacman. You may have to create the Template:Filename folder for it to work (see "Setup the host system" above):

# mkdir -p /newarch/var/lib/pacman 
# pacman -Sy -r /newarch
Issues while running pacman on 64 bit host: If during running pacman you end up with /tmp/archlinux/usr/bin/pacman: No such file or directory please symlink ld-linux-x86-64.so.2: ln -s /lib64/ld-linux-x86-64.so.2 /lib/


Install the 'base' group of packages:

# pacman -S base -r /newarch
Warning: The -r parameter doesn't change the location of Pacman's cache directory. If you don't want Pacman's cache to be created in your host distro, supply another location with --cachedir, or modify pacman.conf as described above.

Example without modifying the host system's pacman.conf:

# pacman --cachedir /newarch/var/cache/pacman/pkg -S base -r /newarch

Prepare /dev nodes

First, ensure the correct /dev nodes have been made for udev:

ls -alF /newarch/dev

This result in a list containing lines similar to the following (the dates will differ for you):

crw-------  1 root root 5, 1 2008-12-27 21:40 console
crw-rw-rw-  1 root root 1, 3 2008-12-27 21:42 null
crw-rw-rw-  1 root root 1, 5 2008-12-27 21:40 zero

Delete and recreate any device which has a different set of permissions (the crw-... stuff plus the two root entries) and major/minor numbers (the two before the date).

cd /newarch/dev 
rm console ; mknod -m 600 console c 5 1 
rm null ; mknod -m 666 null c 1 3 
rm zero ; mknod -m 666 zero c 1 5

All device nodes should have been created for you already with the right permissions and you should not need to recreate any of them.

Chroot

Now we will chroot into the new Arch system.

In order for DNS to work properly you need to edit Template:Filename or replace it with the resolv.conf from your running distribution

cp /etc/resolv.conf /newarch/etc/ 

Also, you need to copy a correctly setup mirrorlist into the new system:

cp /etc/pacman.d/mirrorlist /newarch/etc/pacman.d

Mount various filesystems into the new Arch system:

mount -t proc proc /newarch/proc
mount -t sysfs sys /newarch/sys
mount -o bind /dev /newarch/dev

If you have a separate Template:Filename partition, you'll probably need to mount that too. See Change Root for more details.

When everything is prepared, chroot into the new filesystem:

chroot /newarch /bin/bash

Install the rest

Install your preferred kernel, and any other packages you may wish to install. For the default kernel (which is already installed!):

pacman -S kernel26 

If you wish to install extra packages now, you may do so with:

pacman -S packagename

Configure the target system

Edit your Template:Filename, remembering to add /, swap and any other partitions you may wish to use. Be sure to use the /dev/sd* (sda1, sda2, sdb1, etc) for the partitions instead of /dev/hd*, as Arch uses the sdxx convention for all drives.

Edit your Template:Filename, Template:Filename and Template:Filename to your needs. Then rebuild your initcpio image:

mkinitcpio -p kernel26

Edit Template:Filename, uncommenting any locales you wish to have available, and build the locales:

locale-gen

Setup Grub

To use GRUB when chrooted, you need to ensure that Template:Filename is up-to-date:

grep -v rootfs /proc/mounts > /etc/mtab  

You can now run:

grub-install /dev/sdx

If grub-install fails, you can manually install:

grub 
grub> find /boot/grub/stage1     (You should see some results here if you have done everything right so far.   If not, back up and retrace your steps.)
grub> root (hd0,X) 
grub> setup (hd0) 
grub> quit 

Double-check your Template:Filename. Depending on the host, it could need correcting from hda to sda, and a prefix of /boot as well in the paths.

Manual recovery of GRUB libs

The Template:Filename files are expected to be in Template:Filename, which may not be the case if the bootloader was not installed during system installation or if the partition/filesystem was damages, accidentally deleted, etc.

Manually copy the grub libs like so:

# cp -a /usr/lib/grub/i386-pc/* /boot/grub
Note: Don't forget to mount the system's boot partition if your setup uses a separate one! The above assumes that either the boot partition resides on the root filesystem or is mounted to /boot on the root file system!


Detailed instructions for GRUB and LILO are available elsewhere on this wiki.

Finishing touches

See Beginners Guide:Configure your System. You can ignore 2.11, but the rest of that guide should be of use to you in post-installation configuration of your system.

Exit your chroot:

exit
umount /newarch/boot   # if you mounted this or any other separate partitions
umount /newarch/{proc,sys,dev}
umount /newarch

Reboot to your new Arch system!

Troubleshooting

Kernel Panic

If when you reboot into your new system you get a kernel panic saying console couldn't open:

kinit: couldn't open console, no such file... 

This means you didn't follow the instructions above. Follow the steps to create basic device nodes at the beginning of preparation.

Root device '/dev/sd??' doesn't exist

If when you reboot into your new system you get a error messages like this:

Root device '/dev/sda1' doesn't exist, attempting to create it... etc. 

This means the drives are showing up as "hda1" instead of "sda1" In which case change your GRUB or LILO settings to use "hd??" or try the following.

Edit /etc/mkinitcpio.conf and change "ide" to "pata" in the "HOOKS=" line. Then regenerate your initrd. (Make sure you have chroot'ed into the new system first.)

mkinitcpio -p kernel26

If you are using LVM make sure you add "lvm2" in the HOOKS line. Regenerate your initrd as above.

If you're installing to a device that needs PATA hook make sure it's located before autodetect hook in mkinitcpio.conf.

If your root partition is on an USB device, you have to add “usb” into your “HOOKS=” line before anything else, even “base”.

Another Method: Installing from Existing Linux with Arch's Image

Preparing the Installation Environment

You can grab whatever image from Arch's Download Page and get the content of image by mount loopback:

CD Image:

$ mount -o loop archlinux-2009.08-core-i686.iso /mnt/loop

with USB Image:

$ losetup -f archlinux-2009.08-core-i686.img
$ losetup -fo 32256 /dev/loop0
$ mount /dev/loop0 /mnt/loop

and the content of image:

$ ls /mnt/loop 
boot  core-pkgs.sqfs  isomounts  lost+found  overlay.sqfs  root-image.sqfs

extract the root image:

$ cd /mnt
$ unsquashfs loop/root-image.sqfs

after this step, you will have a new squashfs-root directory which contain new Arch system.

Install from New Environment

If you have Core Arch installation media, and want to install the core packages from it, just copy core-pkgs.sqfs to new squashfs-root directory:

$ cp loop/core-pkgs.sqfs squashfs-root

Now chroot into the new Arch system:

$ mount -t proc proc /mnt/squashfs-root/proc
$ mount -t sysfs sys /mnt/squashfs-root/sys
$ mount -o bind /dev /mnt/squashfs-root/dev 
$ chroot /mnt/squashfs-root /bin/bash

Now you're inside the new installation's filesystem. If you're going to use core-pkgs.sqfs, mount it now:

$ mkdir -p /src/core/pkg
$ mount -o loop -t squashfs core-pkgs.sqfs /src/core/pkg 

At this point, go ahead and launch Arch's aif installer!

$ aif -p interactive

and you can install Arch as normal (from CD or Internet) with the notice:

  • Your target partition must not using by host system


After installing Arch from chroot's environment, you can remove any squashfs-root directory and exit the chroot:

$ umount /src/core/pkg
$ exit
$ umount /mnt/squashfs-root/dev 
$ umount /mnt/squashfs-root/sys 
$ umount /mnt/squashfs-root/proc
$ rm -rf /mnt/squashfs-root

Update and Install packages from host system via chroot

Add an entry to your existing Grub bootloader's menu.lst, or if you installed a new Grub during the Arch installation process, add it to the /boot/grub/menu.lst on your Arch filesystem.

Now either reboot or chroot into the new Arch's partition to install further packages:

$ mkdir /mnt/arch
$ mount /dev/sdxx /mnt/arch
$ mount -t proc proc /mnt/arch/proc
$ mount -t sysfs sys /mnt/arch/sys
$ mount -o bind /dev /mnt/arch/dev 
$ chroot /mnt/arch /bin/bash

Update and install new packages:

# pacman -Syu