Arch Linux Installation Tutorial

[Latest]Update Version 1.2.1205

Update Version 1.1.1110

Update Version 1.0.1108

<Preface>

While translating Arch Linux Installation Tutorials into Korean for Korean linux users, I felt this documentation will be good for foreigners as well when it comes with English. So, I made this Installation Tutorial English Version.

If you follow all steps in this tutorial, you will get the Latest Arch Linux, with Gnome Desktop Environment, wifi access and web browser such as firefox, chromium or Google-chrome.

Also I added some advice for starters, so don’t be afraid to follow this guide even if you are first time in linux environment.

 If I was wrong, or made any mistake, feel free to contact me.

logorealfinal


<Notification>

This guide doesn’t cover a step for making bootable USB device, but I am planning to update soon.

I will install arch linux on UEFI/GPT partition device. So your PC needs to be able to boot on UEFI mode.

I tried to minimize the numbers of packages when installing arch linux, so it came with only 6 packages(It can be 8 if you choose grub, and efibootmgr). That 6 packages are base base-devel xorg-server gnome gdm firefox or google-chrome.

RECOMMENDATION : If you accept second options everytime when you face choosable options and decided to install google-chrome, you can understand basic partition, boot process, Arch’s package manager, and even AUR(Arch User’s Repository).


7a9cb-13zj0sqjigkmcfohq0u2h5w

<1. Base Install>

Boot mode

$ls /sys/firmware/efi

You should be able to see “efivars” folder.

#this command means “list files and folders under ‘/sys/fimware/efi’ directory

Internet Connection

$ping -c 3 www.google.com

#this command means “ping 3 times to http://www.google.com&#8221;

Partition(1)-Plan

$lsblk

There will be a disk drive in name of ‘sda’ or ‘hda’. Check what is your device’s name.

We will make 3 partitions in this tutorial.(Assume that your device name is ‘sda’)

/dev/plan – File System / Code / Size / etc

/dev/sda1 – EFI System / EF00 / 512M / Boot Partition-ESP

/dev/sda2 – Linux Swap / 8200 / 4G / Swap Partition

/dev/sda3 – Linux FileSystem / 8300 / Free Space / Root Partition

UEFI mode bootloader needs ESP partition, and ESP partition means FAT32 filesystem device which is mounted on boot folder.(Efi System Partition)

Now, You can select one option between using ‘cfdisk’ and ‘gdisk’. cfdisk provides you a little table interface, so I recommend ‘cfdisk’ if you are new to partition or linux. But I recommend gdisk if you are not a new user, and also understanding partition scheme.

Partition(2)-1. cfdisk

$cfdisk /dev/sda

Your Label must be GPT

Delete every existing partition.

Let’s make our first partition(dev/sda1)

select ‘NEW’

Size : 512M

(If asks) Primary

move cursor to ‘TYPE’ and ENTER

select ‘EFI System’

move to new line with arrow key, and we will make second partition(/dev/sda2)

select ‘NEW’ again

Size : 4G

Primary

move cursor to ‘TYPE’ and ENTER

select ‘LINUX SWAP’

Finally, third partition(/dev/sda3)

select ‘NEW’

Size Enter with default(Computer will calculate last size for you)

check if the ‘TYPE’ is already set to ‘Linux File System’

You made all three partition! Check if we made it correctly. There should be /dev/sda1-512M-EFI System, /dev/sda2-4G-Linux Swap, /dev/sda3-very big size-Linux File System. If it is right,

select ‘WRITE’

select ‘QUIT’

Partition(2)-2. gdisk

$gdisk /dev/sda

type ‘?’ to see what commands are there.

$type 'o' to overwrite

$type 'n' for new

$type '1' for first partition
(you can also 'enter' if default is '1')

$'ENTER' for default fist sector

$type '+512M' for last sector of /dev/sda1 by its size

$type 'EF00' for EFI System

$type 'p' to print out the result

See if you’ve done right. There should be /dev/sda1 – 512M – EF00.

$type 'n' for new

$type '2'for second partition 
(you can also 'enter' if default is '2')

$'ENTER' for default second sector

$type '+4G' for last sector of /dev/sda2 by its size

$type '8200' for Linux Swap

$type 'p' for check

and our final partition /dev/sda3. Let’s make it!

$'n'

$type '3' or enter if default is '3'

$ENTER

$type '-1' to use every sector left

$type '8300' for Linux File System

$type 'p' for check

if the table shows right answer, you can

$type 'w' to write partition

$type 'y' for yes

$'q' to quit

Format

$mkfs.fat -F32 /dev/sda1

format /dev/sda1 as fat 32 type file system. fat32 file system is required for UEFI boot mode.

$mkfs.ext4 /dev/sda3

format /dev/sda3 as ext4 file system, and ext4 is most common filesystem on linux systems.

Swap

$mkswap /dev/sda2

#make swap

$swapon /dev/sda2

Mount

$mount /dev/sda3 /mnt

#ext4 linux filesystem to mnt folder

$mkdir /mnt/boot

#make directory under /mnt as ‘boot’

$mount /dev/sda1 /mnt/boot

Mirrorlist

You should check your mirrorlist. Uncomment your nearest mirror server by deleting ‘#’.

$nano /etc/pacman.d/mirrorlist

#You can exit from nano text editor by typing ‘ctrl+x’ and ‘y’ and then ‘ENTER’. They mean exit by ‘ctrl+x’, yes I will overwrite by ‘y’ and save as the original filename by ‘ENTER’.

Install BASE and BASE-DEVEL

$pacstrap /mnt base base-devel

Generating File System Table

$genfstab -U /mnt >> /mnt/etc/fstab

#genfstab = generate file system table

#You can also check what was written by $nano /mnt/etc/fstab. There will be a table which is same as our original partition scheme.


2. System Settings

change root

$arch-chroot /mnt

We are now in our arch system for system settings.

check internet connection again

$ping -c 3 www.google.com

Set Root password

$passwd

type password(It’s OK. You can’t see what you’re typing now)

type password again

Locale setting

$nano /etc/locale.gen

Find with arrow key and uncomment “en_US.UTF-8” by deleting ‘#’.

$locale-gen

Language setting

$echo LANG=en_US.UTF-8 > /etc/locale.conf

echo will write (or even make a file if it donsn’t exitst ) “LANG=en_US.UTF-8” in /etc/locale.conf file.

$export LANG=en_US.UTF-8

Hostname setting(PC’s name)

$echo pcname > /etc/hostname

From now on you can replace any name with underlined text.

Local Time setting

$ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

by typing $ls /usr/share/zoneinfo, you can check your location and change the name with underlined text. after the “New_York” word, there is a space before /etc/localtime.

#ln -sf means Link and symbolic, force.

Hardware Clock setting

$hwclock --systohc --utc

#hardwareclock setting. –systohc means setting the systemtime from the RTC and –utc means the RTC timescale is UTC.

Adding User

$useradd -m -G users,wheel -s /bin/bash anyname

and set a password for username.

power and sotrage groups are not used in these days. so avoid tutorials which provide you to have that option as well.

$passwd thatname

We will edit sudoers file

$EDITOR=nano visudo

make the file as same as below.(In the middle of the file)

##user privilege specification##

root ALL = (ALL)ALL

thatname ALL = (ALL)ALL

##uncomment to ~

%wheel ALL= ~

At the last line, you should delete ‘#’ for uncommenting “%wheel ~”.

 

 

Now you need to make choice again. The BOOTLOADER! Like partitioning tools, you can choose (1)’grub’ if you don’t know what the bootloader is. If you had experienced grub already, I recommend (2)systemd-boot because you don’t have to install additional packages, and I personally prefer systemd-boot.(Grub is used in various distros, so if you are planning to experience other distros as well, then you should probably go with grub.)

Bootloader(1).grub

$pacman -S grub efibootmgr

Install grub and efibootmgr

Pacman is arch’s Package Manager. and with upper ‘S’ option, you can install the packages you typed.

$grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch --recheck

Install grub bootloader on your system. With two ‘-‘sign you can set ‘target’, ‘efi-directory’, ‘bootloader-id’ and ‘recheck’option. You can replace ‘arch'(bootloader-id part), but now, just stick with default command.

$grub-mkconfig -o /boot/grub/grub.cfg

make configuration grubfile. you can also use this command when you fixed or added grub configuration for updating it.

Bootloader(2).Systemd-boot

$bootctl --path=/boot install

install bootctl

$nano /boot/loader/loader.conf

make the file look like below

default rememberthisname

editor 1

timeout 3

default : you can replace underlined text, but I recommend ‘arch’. I don’t care what you name it but important thing is that you must remember that name and make exact ‘thatname.conf’ file later.

editor : ‘1’ makes anyone can fix options while booting. I recommend ‘1’ for a while and when you sure the system works fine, come back to that file and change it to ‘0’

timeout : how long boot option stays. I recommend 3 for a while and like editor case, if everything looks fine, come back and change to 0 or whatever you want.

$cd /boot/loader/entries

change directory to entries folder

$nano thatname.conf

Here it comes. replace underlined text with the name you memorized.

write down below.

title archlinux

linux /vmlinuz-linux

initrd /initramfs-linux.img

options root=/dev/sda3 rw

title : show up while booting. so replace the underlined archlinux with recognizable name you want.

linux : watch out for ‘/’ and vmlinu‘z’

options : I also use ‘quiet’ option. If you want, you can write it after ‘rw’


options : you can set your device path which was mounted to root folder. well, arch wiki recommend you to use PARTUUID for safety issue. But, If you’re not familiar with terms like UUID, just use path. The safety issue occurs when user messed up path mapping or other things, but I don’t think you will do such things in near future.However, I’ll show you guys how to set PARTUUID options, below.(you can use vim and command like ‘:r !blkid’, but I think it is too much complicated for readers.)

$blkid

for check block IDs

write down or copy that /dev/sda3’s PARTUUID numbers-alphabets. It will look like 123abc456-789de012-345fg…

And put it as ‘options root=PARTUUID=123abc456-789de0123-345fg..’ and remove all quotation marks.(Of course, underlined text should be replaced by your PARTUUID.


 

exit from installation

$exit

Unmount every device

$umount -R /mnt

reboot

$reboot

#when PC starts again, remove your bootable USB!

 

Does your pc turn on? Does prompt shows “login: “? You succeeded installing Arch Linux. Some of you may happy with this, and some of you will be disappointed. I know, arch linux doesn’t bring you Desktop Environment as default. So Let’s install Gnome Desktop Environment!

 

 


ae31b-1kwtleazsar-loxjr0-h3tw

3. Desktop Environment Install

Log-in

Type your username and password to log in arch linux!

Internet connection

$sudo systemctl start dhcpcd

You can also enable dhcpcd to connect internet. But I recommend just start at this time, because gnome desktop uses networkmanager as default.

#sudo means “substitute user do“or known as “super user do“. It gives you temporary permission as root.

$ping -c 3 www.google.com

Pacman Setting

$sudo pacman-optimize

$sudo pacman -Syu

Pacman -Syu updates database and your packages up-to-date.

Installing packages

$sudo pacman xorg-server gnome gdm

Enable GDM

$sudo systemctl enable gdm

REBOOT

$reboot

 

Now, Does your pc boot up with Graphical Interface? Gnome welcomes You! You can login by clicking the can-man avatar picture, and type your password. You can have fun with your Arch Linux/Gnome Desktop!

But I have a few RECOMMENDATIONS!!

 


4. RECOMMENDATIONS

Network Manager

If you’re a pioneer-type person, you could have already noticed that your network isn’t working. And you can figure it out by reading past tutorials slowly. I just started DHCPCD service, not enabled. Gnome desktop uses network manager, and you can check it with Applications>Settings>Wifi. It doesn’t turn on and says networkmanager is not working. Now Let’s Fix that Problem

$pacman -Ss network manager

It’s not a typo! Upper ‘S’ and lower ‘s’ mean ‘search’. you can search network manager with that command. As you scroll up, you can see ‘extra / networkmanager version-numbers(gnome) [installed]‘.

(If you can’t find [installed], then you can simply install it with command $sudo pacman -S networkmanager)

So let’s turn on that service.

$sudo systemctl enable NetworkManager

Enable for every booting and then

$sudo systemctl start NetworkManager

Start right away. And watch out for the upper case ‘N’&’M’.

If you recheck your Applications>Settings>Wifi, it works! Who said Linux sucks with Wifi settings?

Web Browser

Now other problem occurs. I know, you have only ‘web’ application. You need something you are used to. If it is ‘firefox’, it’s easy. You can install with

$sudo pacman -S firefox

right away.

But if it is google-chrome, it’s not that simple.

(Note. There is also ‘Chromium’ on Arch Official Repository, and it’s almost same as google-chrome but open-source based. So if you care about open-source environment, install chromium with $sudo pacman -S chromium)

What you can download from ‘pacman -S’ is Arch Official Repository Packages. If you want ‘BlahBlah’, and searched with ‘$pacman -Ss blahblah’, and doesn’t exitst? You can use AUR(Arch User’s Repository). And I think AUR is one of the best feature of Arch Linux.

Let me show you how to use AUR.

First. Open that “WEB” Application

go to

aur.archlinux.org

and search “google-chrome”.

Click “Download Snapshot” on right side of webpage inside the “Package Actions” box.

Open terminal,

$cd Down(tab-key)

#tab can auto-complete your folder or file name.

$ls

See what’s inside Download folder.

You can see ‘google-chrome.tar.gz’. Let’s extract it.

$tar -xvzf goog(tab-key)

Let’s see what happened.

-x : extract

-v : verbose (to see what’s going on)

-z : when the file was compressed with gzip

-f : use archive file

(note. If you wonder what all options really mean, you can simply check by $tar –help command. Also, almost every commands provide you ‘man’ pages, or ‘info’, ‘-h’. So, just type ‘man something‘, ‘info something‘, ‘something -h’, or ‘something –help’ anytime, to see what those options mean.)

$ls

There is new ‘google-chrome’ FOLDER.

$cd goog(tab-key)
$makepkg -sic

If arch asks you sudo password, you can type the password. After a while when installation is finished, you can check Applications>All : google-chrome is there!Now you can delete files in Downloads folder.

Makepkg builds with pkgbuild file. After complete build, it install packages with pacman.

-s : install dependencies while install package

-i : install if build succeed

-c : clean unnecessary files after successfully build

 

Now you can navigate World Wide Web!

You can install more packages you want, You can watch Youtube videos, and anything!

 

Congratulations! Now you know how to install Arch-Linux!

logorealfinal


Appendix A

  1. Microcode :  Recommend 5/5
    1. grub users
      1. $sudo pacman -S intel-ucode (Assuming You use Intel CPU)
      2. $(sudo) grub-mkconfig -o /boot/grub/grub.cfg
    2. systemd-boot users
      1. $sudo pacman -S intel-ucode(Assuming You use Intel CPU)
      2. $sudo nano /boot/loader/entries/memorizedname.conf
      3. write down “initrd /intel-ucode.img” above “initrd /initramfs-linux.img”
      4. $sudo bootctl update
      5. $reboot
  2. Video Drivers : Recommend 4/5
    1. $lspci | grep -e VGS -e 3D
    2. Look at this arch wiki for finding appropriate drivers:HERE
    3. My laptop prints out “VGA compatible controller : Intel Corporation HD Graphics 520”
    4. Mine needs xf86-video-intel
    5. $sudo pacman -S xf86-video-intel
  3. System Check Methods : Recommend 5/5
    1. $sudo journalctl -p 3 -xb (Error list while booting process/Google it!)
    2. $sudo systemctl –failed (Failed systemd file, and not running)
  4. pci bus error : Recommend If you need : If you have trouble with infinite messages while booting such as “PCIe bus error : ~~”, you can fix it with below steps.
    1. grub users
      1. When bootloader shows OS list to choose, press ‘e’ key.
      2. move cursor next to “quiet”
      3. insert “pci=nomsi”, so it looks like “~ quiet pci=nomsi”
      4. ENTER to continue booting(If “pci=nomsi” dosn’t work, you can try with “pci=noaer”)
      5. when you booted correctly, open file with
      6. $sudo nano /etc/default/grub
      7. find line like
      8. GRUB_CMDLINE_LINUX_DEFAULT=”~blahblah~ quiet”
      9. and insert “pci=nomsi” there too.(If “pci=noaer” worked, you should put that instead of “pci=nomsi”)
      10. It should be look like ~blah_DEFAULT=”~blahblah~ quiet pci=nomsi”
      11. $(sudo)grub-mkconfig -o /boot/grub/grub.cfg
      12. $reboot
      13. check if it works
    2. systemd-boot users
      1. When bootloader shows OS list to choose, press ‘e’ key.
      2. move cursor options part
      3. add “pci=nomsi” after “rw quiet”
      4. If “pci=nomsi”doesn’t work, you can try with “pci=noaer”
      5. when you booted correctly, open file with
      6. $sudo nano /boot/loader/entries/rememberedname.conf
      7. find options part and move cursor to the end
      8. insert “pci=nomsi” (if “pci=noaer” worked, you should put that instead of “pci=nomsi”)
      9. It should be look like ~blahblah rw quiet pci=nomsi
      10. $sudo bootctl update
      11. $reboot
      12. check if it works

Appendix B – Package Recommnedations

  1. text editor
    1. nano
    2. vim
    3. emacs
  2. AUR wrapper
    1. yaourt
    2. pacaur
    3. cower
  3. Gnome-tweak-tool
  4. LibreOffice-fresh
  5. qbittorrent
  6. vlc
  7. foxitreader

 

 

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 )

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s