Archlinux Installation From Installation Scripts

Finally after a long time (almost a year) Archlinux released the new and updated installation media. It came with some major changes, one is that there will be only one installation media for both the architectures (i686 and x86_64) and that will be a net-install image which means you need a working internet connection to setup and install Archlinux. And the biggest one is due to lack of maintenance and contribution support the AIF (Arch Installation Framework) is no longer included instead there are installation scripts to aid you further. That means that there will be no ncurses based, menu driven installation environment. It may not digest to some people but that is what Arch devs decided to do. So to help you understand the installation scripts and how to use them here is a small guide for your help.

Archlinux installation

Overview:

  • Download and burn the installation media.
  • Preparing Hard Disk
  • Configure Network
  • Installing Base system
  • Reboot

Getting the installation media:

You can download your installation media in your preferred way from the Archlinux download page. After that burn the image to disk or pendrive.

To create usb drive use the following method:

# dd if=path/to/archlinux.iso of=/dev/sdb bs=8M
(assuming /dev/sdb is your usb drive.)

Preparing the Hard Disk :

Default screen after booting from isoNow boot from media and choose “boot Archlinux (i686 or x86_64). The new installation media automatically detects your architecture. So you dont have to worry about that. Just choose your preferred one.

We will create some partitions now. Here is the partition tree we will be creating.

/dev/sda1          /boot           ext4
/dev/sda2          swap            82
/dev/sda3          / "(ROOT)"      ext4

Create partitions :

#fdisk /dev/sda

First we will create the /boot partition :


Command (m for help): n

Partition type:

p     primary

e     extended

Select (default p): "(press enter for default)"

Partition number (1-4, default 1):

First sector  (2048-42901503, default 2048):

Last sector, +sectors or +size {K,M,G,}  (2048-42901503, default 42901503): +100M

Command (m for help): a

Partition number (1-4): 1

The +100M in the “Last sector” line will create a 100MB “/boot” partition.

Swap partition :


Command (m for help): n

Partition type:

p     primary

e     extended

Select (default p):

Partition number (1-4, default 2): 2

First sector  (206848-42901503, default 2048):

Last sector, +sectors or +size {K,M,G,}  (206848-42901503, default 42901503): +2G

Command (m for help): t

Partition number (1-4, default 1): 2

Hex code (type L to list codes): 82

changed system type of partition 2 to 82 (Linux swap/solaris)

This will create a 2GB swap partition. Although in today’s systems there is plenty of memory to handle your tasks so a swap partition is generally unnecessary but if you plan to use “suspend to disk” a.k.a. “Hibernate” you’ll going to need one.

Root Partition :


Command (m for help): n

Partition type:

p     primary

e     extended

Select (default p):

Partition number (1-4, default 3): 3

First sector  (206848-42901503, default 2048):

Last sector, +sectors or +size {K,M,G,}  (4401152-42901503, default 42901503): ("pressing enter here will use the rest of the disk")

Partition table layout

At this point press “P” here to see your partition table and if you are satisfied, Press “W” to write changes to disk and exit fdisk. If you find yourself lost at any point, before writing changes to disk, pressing “Q” will quit all the operations and you can start again.

Format Partitions :

# mkfs.ext4 /dev/sda1

# mkswap /dev/sda2

# mkfs.ext4 /dev/sda3

Mounting Partitions :

# mount /dev/sda3 /mnt

# mkdir /mnt/boot

# mount /dev/sda1 /mnt/boot

# swapon /dev/sda2

Configuring Network :

Assuming you are using wired connection here, go to /etc/rc.conf  and type  interface=”eth0″  after the HOSTNAME and restart the network service. ( For more information on network configuration see ArchWiki: Network .)

# nano /etc/rc.conf

/etc/rc.conf

Restart network service :

# rc.d restart network
# ping -c 3 google.com (if you get the replies you are connected)

/etc/pacman.d/mirrorlist

Installing Base System :

Before installing base system you would also want to edit “/etc/pacman.d/mirrorlist” and choose the closest mirror to your geographical location.

Now install the base packages :

# pacstrap /mnt base base-devel grub-bios

This will take some time so go and grab something to eat. [I prefer mocha 🙂 ]

Generate fstab :

# genfstab -p /mnt >> /mnt/etc/fstab

Chroot :

# arch-chroot /mnt

Edit your /etc/hostname :

# nano /etc/hostname

(add your desired hostname and exit)

Edit TimeZone info :

# ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

Replace “Asia/Kolkata” with your “Zone/SubZone”.

Setting locale preferences :

# nano /etc/locale.gen

For most people uncommenting “en_US.UTF-8” locale should be enough. But if you know what you are doing and what locale is, you need to uncomment those as well.

now execute :

# locale-gen

Edit rc.conf :

# nano /etc/rc.conf

Here is my rc.conf for your reference. Configure yours according to this.

Make initramfs (RAM Disk) :

# mkinitcpio -p linux

Generate Grub2 configuration file and install Grub2 :

# grub-mkconfig -o /boot/grub/grub.cfg
# grub-install /dev/sda

Set ROOT password :

# passwd root

Type “exit” to exit the chroot environment.

Unmount Every mounted partition :

# umount /mnt/boot
# umount /mnt

Restart System :

# shutdown -r now

Your base ArchLinux System in now installed.

For more information see ArchWiki:Installation guide

Advertisements

About Gaurav Trivedi

Gaurav Trivedi is a Gnu/Linux user, geek and technology enthusiast. He loves to play FPS games and traveling.
This entry was posted in Archlinux and tagged , , , . Bookmark the permalink.

4 Responses to Archlinux Installation From Installation Scripts

  1. Sławek says:

    Hi Gaurav,
    Thank you for nice “how to”.
    Maybe you can find minute and write for us how to install Arch on encrypted disc on one partition only?
    I would like install Arch root and home on one partition because one which I installed before growing very fast (sda3 = 25GB, root=58%) after all update and even deleting packages command f.e. find /var/cache/pacman/pkg -not -mtime -1 | sudo xargs rm don’t help!
    Thanks, Slav

    • Sure I will as soon as I get some time. In the meantime can you tell me what problems you are having with the installation ?
      For the ever growing disk space, you may check your “/var/log” and systemd’s journal for any unusual size. Try ‘ncdu’ as root. It is advisable to keep your “/”, “/var”, “/home” on separate partitions. So incase of a reinstallation your configurations will be intact. But it is up to the user. Also the underlying filesystem plays a crucial role in disk space. Choose whatever pleases you.

  2. louei says:

    wow this should be added to arch wiki easy to understand

  3. joe says:

    Thanks, I couldn’t get grub setup properly from the arch’s website installation guide, but yours did it for me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s