Skip to content

lightyen/arch

Repository files navigation

Arch Linux Installation Guide

Make liveCD

rufus etcher

Insert liveCD

Switch terminal font:

setfont ter-116n

Connect to the internet, if wireless, use iwctl:

iwctl

Update the system clock:

timedatectl set-ntp true

Partition

Check devices and create your partitions:

gdisk
cgdisk
fdisk -l

Format FAT32, format ext4 file system:

mkfs.fat -F32 $boot
mkfs.ext4 $root
mkfs.ext4 $home

Mount root and esp devices:

# boot=/dev/nvme0n1p1
# root=/dev/nvme0n1p3
# home=/dev/nvme0n1p4
mount $root /mnt
mkdir /mnt/{boot,home}
mount $boot /mnt/boot
mount $home /mnt/home

# swap=/dev/nvme0n1p2
# mkswap $swap
# swapon $swap

Install basic packages:

pacstrap -i /mnt base linux
pacstrap -i /mnt base-devel linux-firmware vim
# pacstrap -i /mnt intel-ucode
# pacstrap -i /mnt amd-ucode

Generate fstab:

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

Move to root directory:

arch-chroot /mnt

systemd-boot

Edit /boot/loader/loader.conf:

default arch
bootcfg=/boot/loader/entries/arch.conf
echo "title Arch Linux" > $bootcfg
echo "linux /vmlinuz-linux" >> $bootcfg
# echo "initrd /intel-ucode.img" >> $bootcfg
# echo "initrd /amd-ucode.img" >> $bootcfg
echo "initrd /initramfs-linux.img" >> $bootcfg
echo "options root=PARTUUID=$(blkid -s PARTUUID -o value $root) rw" >> $bootcfg

Install systemd-boot:

bootctl install

If there are old items in EFI, use efibootmgr to remove them.

Root password

passwd

Locale (always en_US)

sed -i '/^#\(en_US.UTF-8 UTF-8\)/\1/' /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf

Time

# timezone=Asia/Taipei
ln -sf /usr/share/zoneinfo/$timezone /etc/localtime
hwclock --systohc

Network

local

# hostname=lightyen-pc
echo $hostname > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 $hostname.localdomain $hostname" >> /etc/hosts

ssh

pacman -S openssh
systemctl enable sshd
systemctl start sshd

NetworkManager

pacman -S networkmanager
systemctl enable NetworkManager

buletooth

systemctl enable bluetooth

pacman

# mirrorlist=/etc/pacman.d/mirrorlist

pacman -S pacman-contrib
curl -fsS "https://archlinux.org/mirrorlist/?country=TW&protocol=https&ip_version=4&ip_version=6" -o $mirrorlist
sed -i 's/^#\(.*\)/\1/' $mirrorlist
cp $mirrorlist $mirrorlist.backup
rankmirrors -n 5 $mirrorlist.backup > $mirrorlist
rm $mirrorlist.backup
pacman -Sy

Add administrators

useradd -G wheel -m <username>
passwd <username>
EDITOR=vim visudo

Remove liveCD and reboot.


Shell

zsh

pacman -S zsh git

oh-my-zsh

Install oh-my-zsh:

sh -c "$(curl -fsS https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Change theme:

sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="agnoster"/1' ~/.zshrc

zsh-completions

Clone the repository inside your oh-my-zsh repo:

git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=$HOME/.oh-my-zsh/custom}/plugins/zsh-completions

Enable it in your .zshrc by adding it to your plugin list and reloading the completion:

plugins=(… zsh-completions)
autoload -U compinit && compinit

zsh-autosuggestions

git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:=$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

.zshrc

plugins=(… zsh-autosuggestions)

AUR

yay

pacman -S --needed base-devel
git clone https://aur.archlinux.org/yay-git.git
cd yay-git
makepkg -si

paru

pacman -S --needed base-devel
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si

Editor(Vim)

vundle

git clone https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim

Create .vimrc in $HOME:

set encoding=utf-8
set history=3000
set ttimeoutlen=50

set tabstop=4
set tabstop=4
set shiftwidth=4
set expandtab

set signcolumn=yes
syntax enable
syntax on
set hls
set termguicolors

filetype off
set nocompatible
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
Plugin 'maxmellon/vim-jsx-pretty'
Plugin 'prettier/vim-prettier', { 'do': 'yarn install', 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] }
Plugin 'scrooloose/nerdtree'
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-commentary'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'joshdick/onedark.vim'
call vundle#end()
filetype plugin indent on

if &term == "alacritty"
  let &term = "xterm-256color"
endif

let g:powerline_pycmd = 'py3'

" itchyny/lightline settings
set laststatus=2

let g:lightline = {
  \ 'colorscheme': 'onedark',
  \ }

let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1

colorscheme onedark


set numberwidth=4
set runtimepath+=$HOME/.vim/plugins/vim-gitgutter
let g:gitgutter_async = 0
let g:gitgutter_enabled = 0
set autochdir
let NERDTreeChDirMode=2
au VimEnter NERD_tree_1 enew | execute 'NERDTree '.argv()[0]


" NERDTree
let g:NERDTreeIndicatorMapCustom = {
    \ "Modified"  : "",
    \ "Staged"    : "",
    \ "Untracked" : "",
    \ "Renamed"   : "",
    \ "Unmerged"  : "",
    \ "Deleted"   : "",
    \ "Dirty"     : "",
    \ "Clean"     : "✔︎",
    \ 'Ignored'   : '',
    \ "Unknown"   : "?"
    \ }


" YouCompleteMe
let g:ycm_use_clangd = 0

" Prettier
let g:prettier#autoformat = 1

highlight LineNr guifg=#BD93F9 guibg=#303030

set listchars=tab:→\ ,space:\ ,extends:⟩,precedes:set list

set noerrorbells             " No beeps
set number                   " Show line numbers
set noswapfile               " Don't use swapfile
set showcmd                  " Show me what I'm typing
set nobackup                 " Don't create annoying backup files
set splitright               " Split vertical windows right to the current windows
set splitbelow               " Split horizontal windows below to the current windows
set autowrite                " Automatically save before :next, :make etc.
set hidden
set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats
set noshowmatch              " Do not show matching brackets by flickering
set noshowmode               " We show the mode with airline or lightline
set ignorecase               " Search case insensitive...
set smartcase                " ... but not it begins with upper case
set completeopt=menu,menuone
set nocursorcolumn           " speed up syntax highlighting
set cursorline               " show the focus line
set updatetime=500
set pumheight=10             " Completion window max size
set conceallevel=2           " Concealed text is completely hidden
set nowrap
set autoread
set clipboard=unnamedplus

" Keyboard mapping
nnoremap <C-c> "+yy
nnoremap <C-v> "+p
nnoremap <A-Down> :m+<CR>==
nnoremap <A-Up> :m .-2<CR>==
nnoremap <ESC>j :m+<CR>==
nnoremap <ESC>k :m .-2<CR>==
nnoremap <F2> :set nu!<CR>
nnoremap <F4> :set list!<CR>
nnoremap <F5> :set rnu!<CR>
nnoremap <F3> :set hlsearch!<CR>
nnoremap <F9> :NERDTreeToggle<CR>
nnoremap <leader>n :NERDTree .<CR>

" Output the current syntax group
nnoremap <f10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<cr>

Then run :PluginInstall


Archlinux window environment

Fonts

https://wiki.archlinux.org/title/Font

Software

SDDM

pacman -Syu

pacman -S sddm sddm-kcm
systemctl enable sddm

GVim

pacman -S gvim

Input Method(fcitx)

pacman -S fcitx kcm-fcitx fcitx-chewing fcitx-configtool
echo "INPUT_METHOD=fcitx"  >> /etc/environment
echo "GTK_IM_MODULE=fcitx" >> /etc/environment
echo "QT_IM_MODULE=fcitx" >> /etc/environment
echo "XMODIFIERS=@im=fcitx" >> /etc/environment

VirtualBox

pacman -S virtualbox-host-modules-arch

Edge

git clone https://aur.archlinux.org/microsoft-edge-stable-bin.git
makepkg -si

VScode

git clone https://aur.archlinux.org/visual-studio-code-bin.git
makepkg -si

KDE

pacman -S plasma kde-applications

bspwm

https://wiki.archlinux.org/title/bspwm

pacman -S xorg bspwm sxhkd picom dmenu nitrogen alacritty lxappearance nautilus file-roller
echo "xrandr --dpi 120 &" >> ~/.xprofile
echo "picom --experimental-backends &" >> ~/.xprofile
echo "fcitx &" >> ~/.xprofile
echo "nitrogen --restore &" >> ~/.xprofile
# /etc/xdg/picom.conf

...

backend = "glx";

sxhkdrc:

super + Return
    alacritty

ctrl + alt + t
    alacritty

super + {r}
    bspc node @/ -R 180

super + shift + {r}
    bspc node @/ -R 90

Change DPI to 1.25:

# ~/.Xresources
Xft.dpi: 120

xrandr --dpi 120

titlebar

polybar

Hardware

Audio

pacman -S alsa-utils
alsactl init
alsamixer

Video

# optional
# pacman -S xf86-video-[intel/nvidia/amdgpu/ati/vesa/nouveau]

Network problem

related: /etc/NetworkManager/system-connections/wired1.nmconnection

nmcli connection modify <conn> ipv4.dns "8.8.8.8,1.1.1.1"
nmcli connection modify <conn> ipv4.ignore-auto-dns yes
nmcli connection modify <conn> connection.autoconnect yes
nmcli connection down <conn>
nmcli connection up <conn>

About

personal configuration on ArchLinux

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published