ArchLinux:Installation: Difference between revisions

From Wiki³
Line 106: Line 106:
{{Console|1=<span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # fdisk /dev/sdb<br /><br /><span style="color:#00a800">Welcome to fdisk (util-linux 2.24.1).</span><br />Changes will remain in memory only, until you decide to write them.<br />Be careful before using the write command.<br /><br /><span style="color:#a80000">Device does not contain a recognized partition table.</span><br /><br /><span style="color:#fff">Created a new DOS disklabel with disk identifier 0x6706cc59.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (0 primary, 0 extended, 4 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />Partition number (1-4, default 1): <br />First sector (2048-134217727, default 2048): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (2048-134217727, default 134217727): +6G<br /><br /><span style="color:#fff">Created a new partition 1 of type 'Linux' and of size 8 GiB.</span><br /><br />Command (m for help): t<br />Selected partition 1<br />Hex code (type L to list all codes): 82<br /><span style="color:#fff">Changed type of partition 'Linux' to 'Linux swap / Solaris'.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (0 primary, 0 extended, 4 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />Partition number (2-4, default 2): <br />First sector (16779264-134217727, default 2048): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (16779264-134217727, default 134217727): +16G<br /><br /><span style="color:#fff">Created a new partition 2 of type 'Linux' and of size 16 GiB.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (0 primary, 0 extended, 4 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />Partition number (3-4, default 3): <br />First sector (50333696-134217727, default 2048): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (50333696-134217727, default 134217727): <br /><br /><span style="color:#fff">Created a new partition 1 of type 'Linux' and of size 40 GiB.</span><br /><br />Command (m for help): w<br /><br />The partition table has been altered.<br />Calling ioctl() to re-read partition table.<br />Syncing disks.}}
{{Console|1=<span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # fdisk /dev/sdb<br /><br /><span style="color:#00a800">Welcome to fdisk (util-linux 2.24.1).</span><br />Changes will remain in memory only, until you decide to write them.<br />Be careful before using the write command.<br /><br /><span style="color:#a80000">Device does not contain a recognized partition table.</span><br /><br /><span style="color:#fff">Created a new DOS disklabel with disk identifier 0x6706cc59.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (0 primary, 0 extended, 4 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />Partition number (1-4, default 1): <br />First sector (2048-134217727, default 2048): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (2048-134217727, default 134217727): +6G<br /><br /><span style="color:#fff">Created a new partition 1 of type 'Linux' and of size 8 GiB.</span><br /><br />Command (m for help): t<br />Selected partition 1<br />Hex code (type L to list all codes): 82<br /><span style="color:#fff">Changed type of partition 'Linux' to 'Linux swap / Solaris'.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (0 primary, 0 extended, 4 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />Partition number (2-4, default 2): <br />First sector (16779264-134217727, default 2048): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (16779264-134217727, default 134217727): +16G<br /><br /><span style="color:#fff">Created a new partition 2 of type 'Linux' and of size 16 GiB.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (0 primary, 0 extended, 4 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />Partition number (3-4, default 3): <br />First sector (50333696-134217727, default 2048): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (50333696-134217727, default 134217727): <br /><br /><span style="color:#fff">Created a new partition 1 of type 'Linux' and of size 40 GiB.</span><br /><br />Command (m for help): w<br /><br />The partition table has been altered.<br />Calling ioctl() to re-read partition table.<br />Syncing disks.}}


== SATA ==
== Single Disk ==
{| {{wikitable}}
|-
! align="left"| Filesystem
! align="center"| Mountpoint
! align="center"| Size
! Description
|-
| Linux
| align="center"| /boot
| align="center"| 512M
| align="center"| contains kernel and modules
|-
| Linux swap
| align="center"| swap
| align="center"| 8G
| align="center"| optional, use if RAM &lt; 16 GB
|-
| Linux
| align="center"| /
| align="center"| *
| align="center"| root partition
|}
If you are installing Arch onto a single disk or inside of VirtualBox feel free to use only the {{mono|root}}, {{mono|boot}}, and {{mono|swap}} partitions. Given that we have already located the disk we will be installing Arch to, issue the {{mono|fdisk}} command on the drive and setup its partitions according to the table.
 
{{Console|1=<span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # fdisk /dev/sda<br /><br /><span style="color:#00a800">Welcome to fdisk (util-linux 2.24.1).</span><br />Changes will remain in memory only, until you decide to write them.<br />Be careful before using the write command.<br /><br /><span style="color:#a80000">Device does not contain a recognized partition table.</span><br /><br /><span style="color:#fff">Created a new DOS disklabel with disk identifier 0x123abc45.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (0 primary, 0 extended, 4 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />Partition number (1-4, default 1): <br />First sector (2048-67108863, default 2048): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (2048-67108863, default 67108863): +512M<br /><br /><span style="color:#fff">Created a new partition 1 of type 'Linux' and of size 512 MiB.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (1 primary, 0 extended, 3 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />Partition number (1-4, default 1): <br />First sector (1050624-134217727, default 1050624): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (1050624-134217727, default 134217727): +8G<br /><br /><span style="color:#fff">Created a new partition 1 of type 'Linux' and of size 8 GiB.</span><br /><br />Command (m for help): t<br />Selected partition 1<br />Hex code (type L to list all codes): 82<br /><span style="color:#fff">Changed type of partition 'Linux' to 'Linux swap / Solaris'.</span><br /><br />Command (m for help): n<br /><br />Partition type:<br /> &nbsp; p &nbsp; primary (2 primary, 0 extended, 2 free)<br /> &nbsp; e &nbsp; extended<br />Select (default p): <br />First sector (17860608-67108863, default 17860608): <br />Last sector, +sectors or +size&#123;K,M,G,T,P&#125; (17860608-67108863, default 67108863): <br /><br /><span style="color:#fff">Created a new partition 2 of type 'Linux' and of size 23.5 GiB.</span><br /><br />Command (m for help): w<br />The partition table has been altered.<br />Calling ioctl() to re-read partition table.<br />Syncing disks.}}
 
== Formatting/Mounting ==
Now that the partition table(s) are setup, let us move on to formatting all of the partitions and get them mounted temporarily for installation of Arch. First create/enable the swap partition if you designated one.
 
{{Console|1=<span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mkswap /dev/sda2<br/><span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # swapon /dev/sda2}}
 
Next format all of the partitions that will be used for Arch with the {{mono|mkfs.ext4}} commmand. Then finally mount all of these partition to a temporary directory on the live filesystem.
 
{{Note|'''* Note'''<br />If you are using the multi-disk setup some of these device nodes will be different.}}<br/>
 
{{Console|1=<span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mkfs.ext4 /dev/sda1<br/><span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mkfs.ext4 /dev/sda3<br/><span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mount /dev/sda3 /mnt<br/><span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mkdir /mnt/{boot,home,var}<br/><span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mount /dev/sda1 /mnt/boot}}
 
In addition if you are using the multi-disk setup, also format and mount the {{mono|home}} and {{mono|var}} partitions.
 
{{Console|1=<span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mkfs.ext4 /dev/sdb2<br/><span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mkfs.ext4 /dev/sdb3<br/><span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mount /dev/sdb2 /mnt/var<br/><span style="color:#ff5757">root</span>@archiso <span style="color:#fff">~</span> # mount /dev/sdb3 /mnt/home}}


If you are installing Arch onto a single SATA disk or inside of VirtualBox feel free to use only the {{mono|root}}, {{mono|boot}}, and {{mono|swap}} partitions all on the same disk.


[[Category:Arch Linux]]
[[Category:Arch Linux]]

Revision as of 11:49, 12 October 2014

IconUNDER CONSTRUCTION: The document is currently being modified!

The following tutorial is a collection of notes on how to install the Arch Linux distribution. This guide is mainly suited for use with servers and embedded machines. This tutorial originally started as a YouTube video I had made in early 2012 called How to Install Arch Linux. I then remade this video in late 2012, due to major changes in the installation process, renamed as Arch Linux: System Installation. This tutorial is the spiritual successor to those videos and has been created via the recording notes from said videos.

Following the Arch Linux philosophy, these tutorials are geared at being simple and efficient.

Booting the Installation Media

Systeminstallation-1.png

For use in the creation of this tutorial I used the following environment:

IconIcon VirtualBox 4.3.12 r93733 Icon archlinux-2014.05.01-dual.iso

Place the copy of the Arch Linux image you burned to a disc in your machine and reboot. Enter BIOS if necessary to modify the boot device order in order to boot from the media.

You should be looking at the Arch Linux boot menu, pictured on the right. From this menu select the boot option that corresponds to your architecture type, x86_64 for 64-bit and i686 for 32-bit.

Your system will begin the boot up process, when finished you will be at the console. You may also notice you have been automatically logged into the root account.

Keyboard Keymap (Optional)

If you are using a non-US keymap, you will need to specify which keymap to load. Pull up a list of all the keymaps.

ls /usr/share/kbd/keymaps/

Organization is laid out in directories as Machine Type / Keyboard Type, if you take the name of the map.gz file without the path of extension you can then plug that into the command localectl.

Example for the United Kingdom:

localectl set-keymap uk

Install from SSH (Optional)

If you wish to install remotely from another computer you will simply need to execute two commands in order to get sshd up and running. First start the openssh service with systemd and then set the root password.

root@archiso ~ # systemctl start sshd
root@archiso ~ # passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

You should now be able to login remotely as the root account with the password you have setup. If you need to figure out the IP address assigned to the machine use the ip addr command.

Hard Drive Setup

Before you can begin the installation you must partition and format the hard drives that will be used in the installation. Pull up a list of all of the disks in your system.

root@archiso ~ # fdisk -l

Disk /dev/sda: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdb: 64 GiB, 68719476736 bytes, 134217728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/arch_root-image: 1.4 GiB, 1519386624 bytes, 2967552 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

root@archiso ~ #

You can safely ignore the one on the bottom that begins with /dev/mapper as this is mounted off of the live disc image you are using to install from.

Once you have located the drives you are using for Arch, mark down the device nodes the disks use. For simplicity I highlighted the device nodes I will be using with the pink dotted line.

Icon* Note
If you are installing Arch in conjunction with Windows, these partitions will be HPFS/NTFS/exFAT.

SSD

Filesystem Mountpoint SSD SATA Description
Linux /boot 512M contains kernel and modules
Linux / * root partition
Linux swap swap 8G optional, use if RAM < 16 GB
Linux /var 16G
Linux /home *

SSD being the way of the future will be the main basis for this article, notes included after this section will detail the changes you need to make when using only SATA disks.

As far as partition information goes, this tends to be one of those areas where everyone has their own opinion on how things should be laid out. I for one am a firm believer in using what you are comfortable with, so if you have a setup you typically like to use then by all means. That being said, let's begin setting up a couple baseline partitions.

We will create the root and boot partitions on the SSD. And then create the swap, var and home partitions on the SATA disk. The table to the right indicates how we will be laying out the partition table of all the disks.

Now that we have located the disks we will be installing Arch to, issue the fdisk command on the SSD and setup it's partitions according to the table.

root@archiso ~ # fdisk /dev/sda

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0x396edc53.

Command (m for help): n

Partition type:
  p   primary (0 primary, 0 extended, 4 free)
  e   extended
Select (default p):
Partition number (1-4, default 1):
First sector (2048-67108863, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-67108863, default 67108863): +512M

Created a new partition 1 of type 'Linux' and of size 512 MiB.

Command (m for help): n

Partition type:
  p   primary (0 primary, 0 extended, 4 free)
  e   extended
Select (default p):
First sector (1050624-67108863, default 1050624):
Last sector, +sectors or +size{K,M,G,T,P} (1050624-67108863, default 67108863):

Created a new partition 2 of type 'Linux' and of size 31.5 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Next we need to setup the SATA disk again using the table as a reference for the partition layout.

root@archiso ~ # fdisk /dev/sdb

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0x6706cc59.

Command (m for help): n

Partition type:
  p   primary (0 primary, 0 extended, 4 free)
  e   extended
Select (default p):
Partition number (1-4, default 1):
First sector (2048-134217727, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-134217727, default 134217727): +6G

Created a new partition 1 of type 'Linux' and of size 8 GiB.

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'.

Command (m for help): n

Partition type:
  p   primary (0 primary, 0 extended, 4 free)
  e   extended
Select (default p):
Partition number (2-4, default 2):
First sector (16779264-134217727, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (16779264-134217727, default 134217727): +16G

Created a new partition 2 of type 'Linux' and of size 16 GiB.

Command (m for help): n

Partition type:
  p   primary (0 primary, 0 extended, 4 free)
  e   extended
Select (default p):
Partition number (3-4, default 3):
First sector (50333696-134217727, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (50333696-134217727, default 134217727):

Created a new partition 1 of type 'Linux' and of size 40 GiB.

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Single Disk

Filesystem Mountpoint Size Description
Linux /boot 512M contains kernel and modules
Linux swap swap 8G optional, use if RAM < 16 GB
Linux / * root partition

If you are installing Arch onto a single disk or inside of VirtualBox feel free to use only the root, boot, and swap partitions. Given that we have already located the disk we will be installing Arch to, issue the fdisk command on the drive and setup its partitions according to the table.

root@archiso ~ # fdisk /dev/sda

Welcome to fdisk (util-linux 2.24.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0x123abc45.

Command (m for help): n

Partition type:
  p   primary (0 primary, 0 extended, 4 free)
  e   extended
Select (default p):
Partition number (1-4, default 1):
First sector (2048-67108863, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-67108863, default 67108863): +512M

Created a new partition 1 of type 'Linux' and of size 512 MiB.

Command (m for help): n

Partition type:
  p   primary (1 primary, 0 extended, 3 free)
  e   extended
Select (default p):
Partition number (1-4, default 1):
First sector (1050624-134217727, default 1050624):
Last sector, +sectors or +size{K,M,G,T,P} (1050624-134217727, default 134217727): +8G

Created a new partition 1 of type 'Linux' and of size 8 GiB.

Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 82
Changed type of partition 'Linux' to 'Linux swap / Solaris'.

Command (m for help): n

Partition type:
  p   primary (2 primary, 0 extended, 2 free)
  e   extended
Select (default p):
First sector (17860608-67108863, default 17860608):
Last sector, +sectors or +size{K,M,G,T,P} (17860608-67108863, default 67108863):

Created a new partition 2 of type 'Linux' and of size 23.5 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Formatting/Mounting

Now that the partition table(s) are setup, let us move on to formatting all of the partitions and get them mounted temporarily for installation of Arch. First create/enable the swap partition if you designated one.

root@archiso ~ # mkswap /dev/sda2
root@archiso ~ # swapon /dev/sda2

Next format all of the partitions that will be used for Arch with the mkfs.ext4 commmand. Then finally mount all of these partition to a temporary directory on the live filesystem.

Icon* Note
If you are using the multi-disk setup some of these device nodes will be different.


root@archiso ~ # mkfs.ext4 /dev/sda1
root@archiso ~ # mkfs.ext4 /dev/sda3
root@archiso ~ # mount /dev/sda3 /mnt
root@archiso ~ # mkdir /mnt/{boot,home,var}
root@archiso ~ # mount /dev/sda1 /mnt/boot

In addition if you are using the multi-disk setup, also format and mount the home and var partitions.

root@archiso ~ # mkfs.ext4 /dev/sdb2
root@archiso ~ # mkfs.ext4 /dev/sdb3
root@archiso ~ # mount /dev/sdb2 /mnt/var
root@archiso ~ # mount /dev/sdb3 /mnt/home