User:PeterSR

From ArchWiki

Real name: Peter Severin Rasmussen


GitHub: PeterSR

BitBucket: PeterSR


Arch level: Have been running Arch Linux, then later Manjaro, since 2015.


Personal setup

Here my personal setup will be explained.


Storage

Using a GPT partition table, the partitions are as follows: [1]

Every storage device reference below will be corresponding to this layout.

Note: Use GParted live-USB if in doubt. [2]


Installation

Set the keyboard to the Danish Dvorak keyboard layout:

# loadkeys no-dvorak
Note: There is currently no Danish Dvorak built in, so we use the Norwegian as it is almost identical

Don't bother setting up locale on the live system.

Also use a wired connection with DHCP, and the internet will most likely just work. Wireless connection can always be configured when the system is installed.


Activate swap partition

# mkswap /dev/sda3
# swapon /dev/sda3


Mount partitions

# mount /dev/sda1 /mnt

# mkdir -p /mnt/boot
# mount /dev/sda2 /mnt/boot

# mkdir -p /mnt/boot/efi
# mount /dev/sda5 /mnt/boot/efi

# mkdir -p /mnt/home
# mount /dev/sda4 /mnt/home


Edit /etc/pacman.conf

# vi /etc/pacman.conf

Find the line with #Color and uncomment it


Edit the mirrorlist

# vi /etc/pacman.d/mirrorlist

Find first occurrence of Denmark and move it to the top.


Install the base system

# pacstrap -i /mnt base base-devel


Generate fstab file

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

Comment the line with the swap partition

Note: Remember to verify the correctness of the generated file using the second line in the code above

Configuration

Chroot into the system

# arch-chroot /mnt /bin/bash


Configure wired connection using DHCP:

# ip link

# systemctl enable dhcpcd@interface_name.service

Here, read the output of ip link and find the ethernet interface name, properly enp3s0 or something similar.


And then install preliminary packages

# pacman -S polkit
Note: Without polkit you might encounter "Failed to execute operation: The name org.freedesktop.PolicyKit1 was not provided by any .service files"

Locale

Edit /etc/locale.gen

# vi /etc/locale.gen

and uncomment da_DK.UTF-8 UTF-8 as well as en_US.UTF-8 UTF-8.

Note: The recommended way is to search for DK using vi's search /. Remove the #. Search for US. Remove the #.


Run

# locale-gen

and edit the file /etc/locale.conf (which does not exist)

# vi /etc/locale.conf

and write

LANG=da_DK.UTF-8
LC_MESSAGES=en_US.UTF-8

This will use the Danish locale in terms of dates, currency etc., but keep the system language in English.


Setup Danish Dvorak permanently for VC (virtual console):

# localectl --no-convert set-keymap no-dvorak 
Note: This keyboard layout should match the one in the installation. This only affects the virtual console which is used when no GUI is present. To change keyboard layout etc. in GUI, edit X configuration (see later)
Note: To do it manually, edit the file /etc/vconsole.conf:
# vi /etc/vconsole.conf

and write KEYMAP=no-dvorak. If another font is desired, use FONT= here as well.


Set timezone and hardware clock:

# pacman -S ntp
# timedatectl set-timezone Europe/Copenhagen
# ntpd -qg
# hwclock --systohc
# systemctl enable ntpd.service

Computer

Add hostname pc to /etc/hostname:

# echo pc > /etc/hostname

and edit /etc/hosts accordingly:

# vi /etc/hosts

#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost pc
::1   localhost.localdomain localhost pc


Remove PC case speaker beep:

# echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf

User

Install zsh and change the default shell of the root:

# pacman -S zsh
# chsh
Changing shell for root.
New shell [/bin/bash]: /bin/zsh


Create new user called user:

# useradd -m -g users -G wheel,storage,power -s /bin/zsh user
# passwd user


Allow the wheel group to perform sudo by editing /etc/sudoers:

# visudo

Go to the line # %wheel ALL=(ALL) ALL and uncomment it.


Lock the root user:

# passwd -l root
Warning: Do not lock the root user before you are sure that another user can use sudo. Also make sure that you have set the password of that other user.
Note: Restore root user with sudo passwd -u root.

Boot loader

The currently used boot loader is GRUB with UEFI. First install the packages:

# pacman -S grub efibootmgr

Install GRUB to the ESP partition:

# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub_uefi --recheck

Create the configuration file

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


Further reading: GRUB#Installation_2, Unified_Extensible_Firmware_Interface#EFI_System_Partition


The moment of truth

Exit the chroot

# exit

and reboot

# reboot

Now, in BIOS edit the default boot device to grub_uefi and cross your fingers.

Post-installation

Here we set up the system as we actually want it to be. First login as the newly created user:

pc login: user
Password: 

If you are presented with a Z Shell screen, simply press q. You should now see a command prompt.


First and foremost, update the system

# sudo pacman -Syu


Next, install preliminary packages

# sudo pacman -S vim git openssh upower


Now fetch the dotfiles using HTTPS (we will change this to SSH later):

# git clone https://PeterSR@bitbucket.org/PeterSR/dotfiles.git
# cd dotfiles
# git submodule init
# git submodule update --recursive
# ./install.sh symlink
Note: Using HTTPS requires authentication via password if the repo is private.


Audio

Install ALSA

# sudo pacman -S alsa-utils

Go inside the alsamixer and max the different volumes.

# alsamixer


GUI

Install Xorg packages

# sudo pacman -S xorg-xinit xorg-server xorg-server-utils numlockx

Setup keyboard

# sudo localectl --no-convert set-x11-keymap da "" dvorak
Note: Here we use the same keyboard layout as in the virtual console. And Danish Dvorak is actually a supported Xorg keyboard layout.

Further reading: Xorg

Note: Xorg might be replaced by Wayland in the future.


Install Nvidia packages

# sudo pacman -S nvidia

Further reading: NVIDIA

Note: If using another graphics card, find the appropriate package. Xorg requires libgl which can also come from mesa.

OR (in case of Intel graphics)

Install Intel packages

# sudo pacman -S xf86-video-intel mesa-libgl


Install i3 packages

# sudo pacman -S i3 py3status

Further reading: i3, [3]


Copy the .xinitrc and edit it

# cp /etc/skel/.xinitrc ~

# vim .xinitrc

Add the lines

#setxkbmap dk dvorak

numlockx &

exec i3

to the end of the file. Use startx to access i3.

Note: The .xinitrc might be included in the dotfiles in the future.


Install GDM:

# sudo pacman -S gdm
# sudo systemctl enable gdm.service

OR

Install LightDM:

# sudo pacman -S lightdm lightdm-gtk3-greeter
# sudo systemctl enable lightdm.service
Note: Currently the keyboard layout is incorrect on the login screen for some odd reason.


Fonts

# sudo pacman -S ttf-dejavu ttf-ubuntu-font-family ttf-liberation

Fix fonts in Firefox

# sudo ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/

Source: [4]

Applications

# sudo pacman -S firefox terminator nautilus nautilus-open-terminal librsvg gvim feh scrot imagemagick dmenu evince hexchat file-roller filezilla dunst
Note: Installing the gvim package will conflict with vim. But this is okay as the gvim package will also install vim.

Codecs (for Firefox H.264 playback etc.)

# sudo pacman -S gst-libav gst-plugins-good


Steam

Steam is currently only 32-bit, so enable Multilib and update the system:

# vim /etc/pacman.conf
(Uncomment multilib section)
 
# sudo pacman -Syu

Finally, install

# sudo pacman -S steam

Programming

Python, Java, JavaScript (NodeJS), Scala:

# sudo pacman -S python3 jdk8-openjdk nodejs scala

Haskell:

# sudo pacman -S ghc cabal-install haddock happy alex


Apache

# sudo pacman -S apache php php-cgi php-apache mariadb


Follow the instructions here, here and here.


Create a folder www in ~. From ~ run:

# chmod o+x .
# chmod -R o+rX www

Finally, edit /etc/httpd/conf/httpd.conf and change DocumentRoot to /home/user/www.

AUR

Install the AUR helper Yaourt using aur.sh:

# bash <(curl aur.sh) -si package-query yaourt


Spotify
# yaourt -Sa spotify


Dropbox
# yaourt -Sa dropbox dropbox-cli nautilus-dropbox

When asked, edit the dropbox PKGBUILD file and edit the version to 2.10.52 and the sha256sums[0] line to e61ef14cdf8bd4801ff2794c1178b2cac5c097ebffb3b24d061738006e76c23a. Download [5] and verify for yourself.


Pacmatic
# yaourt -Sa pacmatic-fork
# sudo pacmatic -Syu


Programming (AUR dependent)

https://github.com/git-ftp/git-ftp

# yaourt -Sa git-ftp

Update dotfiles

When having a GUI and a web browser working, change the dotfiles to SSH as follows:

First, generate a SSH key called git_rsa

# ssh-keygen -t rsa -C "<Git email>" -f ~/.ssh/git_rsa
# cat ~/.ssh/git_rsa.pub

Copy it and add it to https://bitbucket.org/account/ssh-keys/ with the following label format:

<Git email> | <PC name>

Also update the ~/.ssh/config file similar to this:

Host github.com
   IdentityFile ~/.ssh/git_rsa
Host bitbucket.org
   IdentityFile ~/.ssh/git_rsa

Next, delete the current folder and clone it with:

# rm -rf dotfiles
# git clone git@bitbucket.org:PeterSR/dotfiles.git

Finally, cd into the dotfiles folder and run the install script:

# cd dotfiles
# git submodule init
# git submodule update --recursive
# ./install.sh symlink


Cron and updates notifier

Install fcron

# sudo pacman -S fcron

Call

# fcrontab -e

and insert the line

0 * * * * ~/dotfiles/bin/arch-updates-notify.sh