Fresh Install Arch Linux

sunu dioh
6 min readJan 1, 2021

Fresh installation of Arch Linux for beginner

After twice Arch installation in a couple days, I decide to write down an installation step in case I need it in next week.

Here you can find official guide from arch linux. wiki.https://wiki.archlinux.org/index.php/installation_guide

Ingredients:

1. Live Boot Arch Linux
2. MBR Partition
3. GRUB boot loader
4. NetworkManager
5. Xorg display server
6. LightDM display manager
7. KDE Desktop Environment
8. Plasma Desktop Session
9. WIFI ofc

Instructions :

First of all. I just gonna use the last ingredient.

1. Connect to Internet

Run the following command

# rfkill unblock wifi

Idk why my wireless lan is on rfkill list. Check to make sure wifi is unblocked

# rfkill list

see Soft Blocked under Wireless Lan. It should be ‘no’ and u good to go.

# iwctl --passphrase passphrase station device connect SSID

This command will connect you to SSID.

# eg
# iwctl --passphrase diohlicious446 station wlan0 connect studioh

OR

You can do it via IWD Shell by typing

# iwctl

Once in IWD Shell type “device list” to find your device

# device list

And “station wlan0 get-network“ to find your SSID

# station wlan0 get-networks

Connect to the network and enter passphrase

# station wlan0 connect Sitama_CSX

Quit IWD Shell and Check if connection soft and tasty

# ping studioh.id

2. Make Partition

This one is sweaty bc i have win10 and I dont want to format it by accident.

# cfdisk

Use this command. It’s really handy. Or if you have more than one this you should list it first.

# fdisk -l

Now find the correct one and run the previous command like this

# cfdisk /dev/nvme0nX

X for letter or number of device. Replace it with the correct one. Again, becareful.

Note: Disks name may varies such as /dev/sda, /dev/nvme0n1 or /dev/mmcblk0

cfdisk

After cfdisk opened select on free space and new.

  • Type partition size. please spare 1 to 2 times of ram size if you planning to make swap partition.
  • Primary or Extended I guess Linux dont really care. But remember that MBR only support up to 4 primary partition.
  • Dont forget to flag it as bootable.
  • Repeat step 1 to 3 for swap partition. Dont flag it as bootable but change the type insted to “Linux swap / Solaris”. Remember the size is between 1–2 times of Ram size. But if you are rich and can afford 16GB RAM ++ maybe you can go to next step.
  • Repeat step 1 to 3 for EFI partition. it is recommend to make it at least 300 MiB.
  • select “Write” and enter.
  • Type “yes” to confirm.

Format the Partition.

For Efi partition

# mkfs.fat -F 32 /dev/nvme0nXp1

For linux partition

# mkfs.ext4 /dev/nvme0nXp2

And the Swap Partition.

# mkswap /dev/nvme0nXp3

Dont forget to mount and activate swap.

# mount /dev/nvme0nXp2 /mnt
# swapon /dev/nvme0nXp3

At my first installation i forgot to activate swapon and it shown error everytime i boot. :(

3. Install Linux

Finally the cooking part.

Edit /etc/pacman.d/mirrorlist using nano.

# nano /etc/pacman.d/mirrorlist

Add the closest server near you to the top of the list. I Pasted it from https://www.archlinux.org/mirrorlist/all/ ngl

Server = https://mirror.telkomuniversity.ac.id/archlinux/$repo/os/$arch
Server = http://mirror.labkom.id/archlinux/$repo/os/$arch
Server = http://suro.ubaya.ac.id/archlinux/$repo/os/$arch

Ctrl+X and Enter.

From here you can install all pacakage that you need for your os using pacstrap /mnt *package*. Or you can do it later after entering /mnt using pacman -S *package*.

# pacstrap /mnt base linux base-devel

Bake in preheated oven, for 10 minutes or until juices run clear.

4. Configure System

  • Generate fstab file.
# genfstab /mnt >> /mnt/etc/fstab

Taste it in case u put too much sugar.

# cat /mnt/etc/fstab

If no error shown, you are good.

  • Chroot
# arch-chroot /mnt

With this you are changing root and entering your new system. The bash would look deferent[root@archiso /]#

  • Set the Timezone
# ln -sf /usr/share/zoneinfo/Asia/Jakarta /etc/localtime

Here you can find yours using ls

ls /usr/share/zoneinfo

generate /etc/adjtime

# hwclock --systohc --utc
  • Localization
# nano /etc/locale.gen

Find en_US.UTF-8 UTF-8 and delete # to uncomment it.

# locale-gen

Now create file /etc/locale.conf

# nano /etc/locale.conf

Type LANG=en_US.UTF-8, hit ctrl+X and Enter.

/etc/locale.confLANG=en_US.UTF-8

Set the keyboard layout

# nano /etc/vconsole.conf

/etc/vconsole.confKEYMAP=de-latin1

or you can keep it default.

  • Network configuration Create hostname file with following command. and type your hostname.
# nano /etc/hostname

/etc/hostnamestudioh

Replace studioh with anything you want.

Add matching entries to hosts

# nano /etc/hosts

/etc/hosts127.0.0.1 localhost
::1 localhost
127.0.1.1 studioh.localdomain studioh

Again you can replace studioh with anything you want.

  • Root and User access
# passwd

Type the password you want.
At this point i also create user for me.

#useradd -m -g users -G wheel,storage,power -s /bin/bash diohlicious

You can replace diohlicious with your user name. And dont forget to set password for that user

# passwd diohlicious89

Install sudo so u can access root as user

# pacman -S sudo

Edit sudoers file and uncomment %wheel ALL=(ALL) ALL

# nano /etc/sudoers

/etc/sudoers%wheel ALL=(ALL) ALL

to save the file, hit ctrl+x, type y and Enter.

  • Install Network Manager
# pacman -S networkmanager

And enable service

# systemctl enable NetworkManager

5. Enable Microcode

# pacman -S intel-ucode

or

# pacman -S amd-ucode

I used intell but if you want to install both i dont mind.

CONFIG_BLK_DEV_INITRD=Y
CONFIG_MICROCODE=y
CONFIG_MICROCODE_INTEL=Y
CONFIG_MICROCODE_AMD=y

6. Boot Loader

Your system is good and tasty. Next step is to install boot loader, here is the step.
Oh wait, i remembered that i have Win10 installed in another partition so i also need os-prober to detect another os and ntfs-3g to detect ntfs.

# pacman -S grub os-prober ntfs-3g

Install GRUB on EFI Partition. But first you need to mount it.

# mkdir /boot/efi
# mount /dev/nvme0nXp1 /boot/efi
# grub-install --target=x86_64-efi --bootloader-id=Arch --efi-directory=/boot/efi

Sometimes it need to remount after install ntfs-3g to detect ntfs. But u can do it later Im just gonna put it here.

# os-prober

The result will identify Win10.
… or not. Depend on if you already remount.

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

Here what you should run everytime you make change on GRUB. For example if you decide to add another os, you run os-prober and then grub-mkconfig -o /boot/grub/grub.cfg. Get it?

Cake Decoration

Your Arch Linux is good and fresh from the oven. But becareful its still hot. Just prepare the decoration while its colling down.

1. Display Server

Install Xorg

# pacman -S xorg xorg-server

2. Desktop Environment

I choose plasma as my desktop environment. you can choose any desktop environment that familiar like GNOME. Chocholate or vanilla all good.

# pacman -S plasma-meta kde-applications

I add kde-applications that contain full set of KDE appliction.

3. Display Manager

# pacman -S lightdm lightdm-gtk-greeter

Enable lightdm at startup

# systemctl enable lightdm

You already installed lightdm-gtk-greeter now load it from /etc/lightdm/lightdm.conf

#nano /etc/lightdm/lightdm.conf

Find greeter-session and fill with lightdm-gtk-greeter. Uncomment and save.

/etc/lightdm/lightdm.confgreeter-session=lightdm-gtk-greeter

See here if you want to experience with lightdm greeter https://wiki.archlinux.org/index.php/LightDM and edit lightdm.conf.
For Example:

/etc/lightdm/lightdm.confgreeter-session= = lightdm-webkit2-greeter

Serve The Cake

The next step is…
Wait, there is no more step. That’s mean your Arch Linux is ready to serve.
Press Ctrl+d and type

# umount -R /mnt

Then you can reboot

# reboot

Voila. Finding the perfect vanilla cake recipe requires a celebration!

--

--