Difference between revisions of "Installation Chroot"

From ArchWiki
Jump to: navigation, search
m (moved ArchLinux Installation with Chroot to Installation Chroot over redirect: revert)
Line 1: Line 1:
 +
[[Category:Installation (English)]]
 +
{{i18n|Installation an ArchLinux system from a chroot}}
  
 +
 +
This article will detail the installation of Arch Linux from an other GNU/Linux (kernel >= 2.6.27) with a chroot.
 +
 +
This article was originally publish in the [http://wiki.archlinux.fr/Install_chroot ArchLinux.fr wiki].
 +
A script doing all the step describe in this page is available : [http://calimeroteknik.free.fr/arch-guide/install-chroot.sh install-chroot.sh] <br />
 +
It is indeed advice to read the article.
 +
 +
== Requirement ==
 +
 +
To install ArchLinux you need some data :
 +
 +
{| class="wikitable"
 +
!Variable
 +
!Description
 +
!Example
 +
|-
 +
|install_path
 +
|You have to mount in this directory all the partition that will be part of your system
 +
|/mnt/newarch
 +
|-
 +
|arch
 +
|Architecture of the system: (we can only install i686 from a i686 system)
 +
|i686 or x86_64
 +
|-
 +
|mirror
 +
|Miror of download: the list is available [http://archlinux.org/download/ here]
 +
|http://mir.archlinux.fr
 +
|-
 +
|pacman_mirrorlist_ver
 +
|Actual version of '''pacman-mirrorlist''', see [http://www.archlinux.org/packages/pacman-mirrorlist here].
 +
|20110703-1
 +
|}
 +
<br />
 +
You also need a minimal '''chroot'''. You can find an archive matching your achitecture [http://mir.archlinux.fr/~tuxce/chroot/ here].<br />
 +
 +
You can export variable with this command, for example :
 +
export install_path="/mnt/newarch"
 +
 +
{{warning|This method works only to install a system with the same architecture as the host system or to install a 32 bits system with a 64 bits host system.}}
 +
 +
Before we begin, we will crete the {{filename|tmp}} directory in the new architecture in order to put it temporary files. In {{codeline|$install_path}}:
 +
mkdir tmp
 +
chmod 1777 tmp
 +
 +
== Base system creation ==
 +
 +
We need to download the archive and the package {{filename|pacman-mirrorlist}}:
 +
cd "$install_path"/tmp
 +
wget "$mirror/core/os/$arch/pacman-mirrorlist-$pacman_mirrorlist_ver-any.pkg.tar.gz"
 +
wget "http://mir.archlinux.fr/~tuxce/chroot/archlinux.chroot.$arch.tgz"
 +
cd ..
 +
tar zxvf tmp/pacman-mirrorlist-$pacman_mirrorlist_ver-any.pkg.tar.gz
 +
tar zxvf tmp/archlinux.chroot.$arch.tgz
 +
 +
The mirror configuration file ({{filename|etc/pacman.d/mirrorlist}}) have all its lines commented, you have to uncomment at least one line, for example :
 +
Server = http://mir.archlinux.fr/$repo/os/$arch
 +
 +
== Chroot preparation ==
 +
 +
=== The network ===
 +
 +
In order to have dns resolution, copy your {{Codeline|/etc/resolv.conf}} from the host system to the chroot :
 +
cp /etc/resolv.conf etc/resolv.conf
 +
 +
=== Mount special file ===
 +
 +
We need to mount the special file system {{filename|/dev}}, {{filename|/proc}} and {{filename|/sys}} :
 +
mount -o bind /proc "$install_path"/proc
 +
mount -o bind /dev "$install_path"/dev
 +
mount -o bind /sys "$install_path"/sys
 +
 +
=== Register the mount partitions ===
 +
 +
Mount partition are list in {{filename|/etc/mtab}}, we need to copy it contents :
 +
grep -v rootfs /proc/mounts > etc/mtab
 +
 +
=== In the chroot ===
 +
 +
The ''chroot'' is ready, enter it :
 +
chroot "$install_path" /bin/bash
 +
 +
== Base system installation ==
 +
 +
pacman -Syf base
 +
 +
== Configure the new system ==
 +
 +
 +
=== Configure /etc/rc.conf ===
 +
 +
One of the central file in the ArchLinux system. You'll find everything you need [[rc.conf|here]].
 +
 +
=== Configure partitions ===
 +
 +
You have to fill the {{filename|/etc/fstab}}. This file list the partition that will be use by your new system. Your file must look like this :
 +
 +
#
 +
# /etc/fstab: static file system information
 +
#
 +
# <file system>    <dir>        <type>    <options>          <dump> <pass>
 +
devpts            /dev/pts      devpts    defaults            0      0
 +
shm                /dev/shm      tmpfs    nodev,nosuid        0      0
 +
 +
/dev/sda5          swap          swap      defaults            0      0
 +
/dev/sda6          /            ext4      defaults            0      1
 +
/dev/sda7          /home        ext4      defaults            0      2
 +
 +
Be carefull to check the existenve of the mount point.
 +
Additionnal information can be found [[fstab|here]]
 +
 +
=== Grub ===
 +
 +
Perhaps you'll need [[GRUB]] now. You'll find information [[grub|here]]
 +
 +
=== Users ===
 +
 +
==== Root password ====
 +
 +
The root password is empty by default, you may want to set one :
 +
passwd root
 +
 +
==== Main user ====
 +
 +
A basic configuration is :
 +
 +
useradd -G wheel,audio,optical,storage,video,power -m nom_utilisateur
 +
passwd nom_utilisateur
 +
 +
You'll find more information [[Groups|here]]
 +
 +
==== sudo configuration ====
 +
 +
See [[sudo|here]].

Revision as of 21:44, 3 August 2011

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 – فارسی


This article will detail the installation of Arch Linux from an other GNU/Linux (kernel >= 2.6.27) with a chroot.

This article was originally publish in the ArchLinux.fr wiki. A script doing all the step describe in this page is available : install-chroot.sh
It is indeed advice to read the article.

Requirement

To install ArchLinux you need some data :

Variable Description Example
install_path You have to mount in this directory all the partition that will be part of your system /mnt/newarch
arch Architecture of the system: (we can only install i686 from a i686 system) i686 or x86_64
mirror Miror of download: the list is available here http://mir.archlinux.fr
pacman_mirrorlist_ver Actual version of pacman-mirrorlist, see here. 20110703-1


You also need a minimal chroot. You can find an archive matching your achitecture here.

You can export variable with this command, for example :

export install_path="/mnt/newarch"
Warning: This method works only to install a system with the same architecture as the host system or to install a 32 bits system with a 64 bits host system.

Before we begin, we will crete the Template:Filename directory in the new architecture in order to put it temporary files. In Template:Codeline:

mkdir tmp
chmod 1777 tmp

Base system creation

We need to download the archive and the package Template:Filename:

cd "$install_path"/tmp
wget "$mirror/core/os/$arch/pacman-mirrorlist-$pacman_mirrorlist_ver-any.pkg.tar.gz"
wget "http://mir.archlinux.fr/~tuxce/chroot/archlinux.chroot.$arch.tgz"
cd ..
tar zxvf tmp/pacman-mirrorlist-$pacman_mirrorlist_ver-any.pkg.tar.gz
tar zxvf tmp/archlinux.chroot.$arch.tgz

The mirror configuration file (Template:Filename) have all its lines commented, you have to uncomment at least one line, for example :

Server = http://mir.archlinux.fr/$repo/os/$arch

Chroot preparation

The network

In order to have dns resolution, copy your Template:Codeline from the host system to the chroot :

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

Mount special file

We need to mount the special file system Template:Filename, Template:Filename and Template:Filename :

mount -o bind /proc "$install_path"/proc
mount -o bind /dev "$install_path"/dev
mount -o bind /sys "$install_path"/sys

Register the mount partitions

Mount partition are list in Template:Filename, we need to copy it contents :

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

In the chroot

The chroot is ready, enter it :

chroot "$install_path" /bin/bash

Base system installation

pacman -Syf base

Configure the new system

Configure /etc/rc.conf

One of the central file in the ArchLinux system. You'll find everything you need here.

Configure partitions

You have to fill the Template:Filename. This file list the partition that will be use by your new system. Your file must look like this :

#
# /etc/fstab: static file system information
#
# <file system>    <dir>         <type>    <options>          <dump> <pass>
devpts             /dev/pts      devpts    defaults            0      0
shm                /dev/shm      tmpfs     nodev,nosuid        0      0

/dev/sda5          swap          swap      defaults            0      0
/dev/sda6          /             ext4      defaults            0      1
/dev/sda7          /home         ext4      defaults            0      2

Be carefull to check the existenve of the mount point. Additionnal information can be found here

Grub

Perhaps you'll need GRUB now. You'll find information here

Users

Root password

The root password is empty by default, you may want to set one :

passwd root

Main user

A basic configuration is :

useradd -G wheel,audio,optical,storage,video,power -m nom_utilisateur
passwd nom_utilisateur

You'll find more information here

sudo configuration

See here.