User:Wizetek

From ArchWiki
Jump to navigation Jump to search

https://www.wizetek.com

Arch Linux 2020.03

Medium creation

dd if=archlinux.iso of=/dev/sdx bs=8M oflag=sync status=progress

Installation

timedatectl set-ntp true
fdisk /dev/sda
mkfs.ext4 /dev/sda1
mkswap /dev/sda2
swapon /dev/sda2
mount /dev/sda1 /mnt
vim /etc/pacman.d/mirrorlist
pacstrap /mnt base linux linux-firmware

genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
pacman -S networkmanager grub vim man

ln -sf /usr/share/zoneinfo/America/Toronto /etc/localtime
hwclock --systohc
vim /etc/locale.gen
	...
	#en_BW ISO-8859-1
	en_CA.UTF-8 UTF-8
	#en_CA ISO-8859-1
	en_GB.UTF-8 UTF-8
	...

locale-gen
vim /etc/locale.conf
	LANG="en_CA.UTF-8"
	LC_TIME="en_GB.UTF-8"

hostnamectl set-hostname myhostname
vim /etc/hosts
	127.0.0.1	localhost
	::1		localhost
	127.0.1.1	myhostname.localdomain	myhostname

mkinitcpio --allpresets
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
passwd
exit
umount /mnt

Eject installation medium. Reboot. Log in.

Enable network

via NetworkManager

systemctl --now enable NetworkManager.service

via systemd-networkd

networkctl list
vim /etc/systemd/network/20-wired.network
	[Match]
	Name=myadapter
	
	[Network]
	DHCP=ipv4

systemctl --now enable systemd-networkd.service
systemctl --now enable systemd-resolved.service
networkctl status

NTP via systemd-timesyncd

timedatectl set-ntp true

or

systemctl --now enable systemd-timesyncd.service

Swap file

fallocate -l 1G /swapfile
# or
dd of=/swapfile if=/dev/zero bs=1G count=1

chmod 600 /swapfile

mkswap /swapfile
# or (set label)
mkswap -L linux_swap /swapfile

vim /etc/fstab
	/swapfile none swap defaults 0 0

swapon /swapfile
# or (activate all in /fstab)
swapon -a

SSD optimizations: TRIM and swappiness

systemctl --now enable fstrim.timer
vim /etc/sysctl.d/99-swappiness.conf
	 vm.swappiness=1

sysctl -w vm.swappiness=1    # set immediately

Disable Ctrl-Alt-Delete in console

systemctl mask ctrl-alt-del.target

Enable reboot and more (REISUB) via Magic SysRq Key

vim /etc/sysctl.d/99-sysrq.conf
	kernel.sysrq=1

fstab mount NTFS and SMB

/dev/sda2		/mnt/windows	ntfs-3g		uid=myuser,gid=mygroup,dmask=022,fmask=133	0 0
//192.168.1.1/music	/mnt/openwrt	cifs		_netdev,guest,vers=1.0,uid=myuser,gid=mygroup,dir_mode=0555,file_mode=0444,nounix,iocharset=utf8	0 0

udisksctl mount/unmount device partition

Mount to /run/media/myusername/mydevicelabel

udisksctl mount -b /dev/sdb1

Umount

udisksctl unmount -b /dev/sdb1

locate and cron

pacman -S mlocate
updatedb
locate -S

pacman -S cronie
vim /etc/cron.daily/update_locate_db
	/usr/bin/updatedb

chmod +x /etc/cron.daily/update_locate_db

systemctl enable cronie.service
systemctl start cronie.service
systemctl status cronie.service

Share files via SMB

pacman -S samba
wget -O /etc/samba/smb.conf 'https://git.samba.org/samba.git/?p=samba.git;a=blob_plain;f=examples/smb.conf.default'
vim /etc/samba/smb.conf
	log file = /var/log/samba/%m.log
	workgroup = MYWORKGROUP
	[homes]
	comment = Home Directories
	browseable = no
	writable = yes

smbpasswd -a myuser
systemctl --now enable smb.service
systemctl --now enable nmb.service

Xorg and Xfce desktop

pacman -S xorg-server
pacman -S xf86-video-amdgpu xf86-video-ati xf86-video-intel xf86-video-nouveau xf86-video-vesa

pacman -S xfce4 xfce4-goodies
pacman -S pulseaudio pulseaudio-alsa pavucontrol
pacman -S gvfs-smb ntfs-3g
pacman -S nm-applet

pacman -S xdg-user-dirs
xdg-user-dirs-update

pacman -S lightdm lightdm-gtk-greeter lightdm-gtk-greeter-settings
pacman -S accountsservice
cp /path/to/myavatar_96x96.png ~/.face
systemctl --now enable lightdm.service

Fonts

pacman -S ttf-dejavu

and/or

pacman -S ttf-liberation
cd /etc/fonts/conf.d
ln -s /etc/fonts/conf.avail/10-hinting-full.conf
ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf
ln -s /etc/fonts/conf.avail/11-lcdfilter-default.conf

BCI (Byte-Code Interpreter) hinting

vim /etc/profile.d/freetype2.sh
	#truetype:interpreter-version=35 (classic mode, emulates Windows 98; 2.6 default)
	#truetype:interpreter-version=36 (classic Windows ClearType style)
	#truetype:interpreter-version=38 ("Infinality" subpixel mode)
	truetype:interpreter-version=40 (minimal subpixel mode; 2.7 default)

DPI

Warning: !!! 96 DPI is not standard !!!

Calculate proper DPI for specific hardware at https://www.pxcalc.com/

Example: 27" 2560x1440 display

  • DPI: 108.79
  • Dot Pitch: 0.2335 mm
  • Size: 23.53" × 13.24" (59.77 cm × 33.62 cm)
pacman -S xorg-xrandr

Xresources for non-DE

vim ~/.Xresources
	Xft.dpi: 109
	Xft.autohint: 0
	Xft.lcdfilter: lcddefault
	Xft.hintstyle: hintfull
	Xft.hinting: 1
	Xft.antialias: 1
	Xft.rgba: rgb

LightDM (and other DMs)

vim /etc/xprofile
or
vim ~/.xprofile
	xrandr --dpi 109

vim /etc/lightdm/lightdm-gtk-greeter.conf
	xft-dpi = 109

Xfce

  • Session and Startup
    • Application Autostart
xrandr --dpi 109

Log in to Xfce and confirm:

xdpyinfo | grep dots
  • Appearance
    • Fonts
      • Rendering
        • Enable anti-aliasing
        • Hinting: Full
        • Sub-pixel order: RGB
      • DPI
        • Custom DPI setting: (not needed if already set via RandR)

Firefox

Note: Web pages appearance
  • Default DPI is 96. Change it in about:config by setting
layout.css.devPixelsPerPx = x

...where x = DPI / 96

Example: 27" 2560x1440 display, x = 108.79 / 96 = 1.133229167

Note: Application window and menus appearance
  • Default DPI is 96. System DPI is only used if system DPI > 96. Force using lower system DPI by setting in about:config layout.css.dpi = 0
  • Default font scale in about:config is font.size.systemFontScale = 100
  • Do not increase Default zoom in Preferences

Firefox touchpad scrolling sensitivity

about:config

mousewheel.acceleration.start = 1
mousewheel.acceleration.factor = 1

x11vnc

pacman -S x11vnc
vncpasswd
x11vnc -usepw -forever -shared -nolookup

xbindkeys

pacman -S xbindkeys
xbindkeys -d > ~/.xbindkeysrc
vim ~/.xbindkeysrc
	# Volume up/down via Super + mouse wheel
	"pamixer -i 5"
	  Mod2+Mod4 + b:4

	"pamixer -d 5"
	  Mod2+Mod4 + b:5

	# Volume up/down via Super + Keypad +/-
	"pamixer -i 5"
	  Mod2+Mod4 + KP_Add

	"pamixer -d 5"
	  Mod2+Mod4 + KP_Subtract

	# Toggle mute via Super + Keypad *
	"pamixer -t"
	  Mod2+Mod4 + KP_Multiply

	# Set volume to 50% via Super + Keypad /
	"pamixer --set-volume 50"
	  Mod2+Mod4 + KP_Divide

	# Toggle Play/Pause in active player via Super + Pause/Break
	"playerctl play-pause"
	  Mod2+Mod4 + Pause

xbindkeys --poll-rc

Intel hardware video acceleration

pacman -S intel-media-driver libva-intel-driver libvdpau-va-gl
pacman -S libva-utils vdpauinfo

MIDI & JACK

pacman -S jack2 realtime-privileges python-dbus qjackctl a2jmidid alsa-utils
gpasswd -a realtime myusername

QjackCtl

- Driver: alsa
- Realtime: ✓
- MIDI Driver: seq
- Output Device: myoutputdevice
- Enable D-Bus interface: ✓
- Enable JACK D-Bus interface: ✓

Softsynths

$ pacman -Sgq vst-plugins | pacman -Si -
$ pacman -Si $(pacman -Sgq lv2-plugins)
#    VST
surge
helm-synth
amsynth
zynaddsubfx

tunefish4
tal-plugins    # Noize Mak3r
uhe-podolski-vst
uhe-triplecheese-vst
xhip
dexed
ob-xd
digitsvst-git

#    LV2
yoshimi
bristol    # pybristol (GUI)

#    DAW
sunvox
tracktion-waveform
reaper-bin

http://www.linuxsynths.com/index.html


pacman

Sync refresh and update all (-w only download, don't install)

pacman -Syu
pacman -Syuw

Sync search for string (-q quiet)

pacman -Ss ttf font
pacman -Ssq ttf font

Sync install package

pacman -S ttf-dejavu

Install local package file

pacman -U redshifter-20200404-1-any.pkg.tar.xz

Sync display info about package

pacman -Si kodi

Sync display groups

pacman -Sg

Sync display members of group

pacman -Sg kodi-addons

Sync list packages in given repository

pacman -Sl core
pacman -Sl extra
pacman -Sl community
pacman -Sl multilib

Find package that will provide file

pacman -Fy
pacman -F lsusb
	core/usbutils 012-2
	    usr/bin/lsusb

Find list files that would be owned by package

pacman -Fl usbutils

Query search installed packages (all / by string)

pacman -Qs
pacman -Qs ttf

Query display explicitly installed packages

pacman -Qe

Query display installed packages not directly required and not optionally required

pacman -Qt

Query display installed packages optionally required but not directly required

pacman -Qtt

Query display installed native packages

pacman -Qn

Query display installed AUR / foreign packages

pacman -Qm

Query display info about installed package

pacman -Qi usbutils

Query list files owned by installed package

pacman -Ql usbutils

Query which installed package owns file

pacman -Qo /usr/bin/pactl
	/usr/bin/pactl is owned by libpulse 13.0-3

Query local package file (-i display info, -l list files)

pacman -Qp redshifter-20200404-1-any.pkg.tar.xz
pacman -Qip redshifter-20200404-1-any.pkg.tar.xz
pacman -Qlp redshifter-20200404-1-any.pkg.tar.xz

Remove package only

pacman -R usbutils

(Recursive) Remove package, dependencies (if not needed by other packages), and saved files (-ss force remove ALL dependencies)

pacman -Rsn usbutils
Warning: !!! DANGEROUS !!! Will break other packages
pacman -Rssn usbutils

(Cascade) Remove package and all packages that depend on it

Warning: !!! CAUTION !!! Will remove needed packages
pacman -Rc exo

Note: Maintenance

Clean up .pacorig, .pacnew, .pacsave. (Install first via pacman -S pacman-contrib)

pacdiff

Remove orphans (unused packages)

pacman -Rsn $(pacman -Qtdq)

Clean uninstalled packages cache and syncdb (-cc also installed packages cache)

pacman -Sc
pacman -Scc

Check integrity of installed packages (all / specific / filter by missing files)

pacman -Qk
pacman -Qk fontconfig
pacman -Qk | grep -v '0 missing'

Display modified files

pacman -Qii | awk '/^MODIFIED/ {print $2}'

IF EVER NEEDED, reinstall all native packages

pacman -S $(pacman -Qnq)

AUR helpers

$ vim /etc/makepkg.conf
	PACKAGER="Your Name <your@email.dom>"

aurget

$ pacman -S wget
$ cd /tmp
$ wget -O PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=aurget
$ makepkg -si

or

$ pacman -S git
$ git clone https://aur.archlinux.org/aurget.git
$ cd aurget
$ makepkg -si

also

$ cp /usr/share/doc/aurget/samples/aurgetrc ~/.config/aurgetrc
$ vim ~/.config/aurgetrc
	build_directory="$HOME/Builds"
	edit_pkgbuilds='never'    # or 'always'

yay

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

AUR make a package

$ pacman -S namcap    # optional validation tool
$ wget -O PKGBUILD https://git.archlinux.org/pacman.git/plain/proto/PKGBUILD.proto
$ vim PKGBUILD
$ makepkg -g >> PKGBUILD
$ namcap PKGBUILD    # for information messages in addition to warnings: namcap -i PKGBUILD
$ makepkg -s
$ namcap yourpackagename-1.0-1-x86_64.pkg.tar.xz
#    if needed:

$ makepkg -si    # build and install
$ makepkg -fs    # force rebuild
$ makepkg -fsi    # force rebuild and install

Upload to AUR

#    Generate keypair
$ ssh-keygen -f ~/.ssh/aur

#    Change/remove passphrase if needed
$ ssh-keygen -p -f ~/.ssh/aur

#    Change/remove comment if needed
$ ssh-keygen -c -f ~/.ssh/aur

#    Specify private key for AUR remote
$ vim ~/.ssh/config
	Host aur.archlinux.org
	  IdentityFile ~/.ssh/aur
	  User aur

==> Copy public key ~/.ssh/aur.pub to AURweb under My Account
#    Configure git

$ git config --global user.name "Your Name"
$ git config --global user.email "your@email.dom"
#    Method 1: clone empty git repo to create it

$ cd ~/Builds
$ git clone ssh://aur@aur.archlinux.org/redshifter.git
$ cd redshifter

$ vim PKGBUILD
$ makepkg --printsrcinfo > .SRCINFO

$ git add PKGBUILD .SRCINFO
$ git commit -m "your comment"
$ git push
#    Method 2: add empty remote repo to create it

$ cd ~/Builds/xhip
$ vim PKGBUILD
$ makepkg --printsrcinfo > .SRCINFO

$ git init
$ git add PKGBUILD .SRCINFO
$ git commit -m "your comment"

$ git remote add origin ssh://aur@aur.archlinux.org/xhip.git
$ git push -u origin master
#    Method 3a: pull from existing repo

$ cd ~/Builds/freepats-ydp-grand-piano
$ git init
$ git remote add origin ssh://aur@aur.archlinux.org/freepats-ydp-grand-piano.git
$ git pull origin master

$ vim PKGBUILD
$ makepkg --printsrcinfo > .SRCINFO

$ git add PKGBUILD .SRCINFO
$ git commit -m "your comment"
$ git push
#    Method 3b: fetch and branch from existing repo

$ cd ~/Builds/freepats-ydp-grand-piano
$ git init
$ git remote add origin ssh://aur@aur.archlinux.org/freepats-ydp-grand-piano.git
$ git fetch    # git fetch origin master
$ git checkout -tb master    # git checkout -tb master origin/master

$ vim PKGBUILD
$ makepkg --printsrcinfo > .SRCINFO

$ git add PKGBUILD .SRCINFO
$ git commit -m "your comment"
$ git push
#    More git commands

$ git remote -v    # See remotes
$ git branch -a    # See all branches (local and remote)
$ git branch -vv    # See hash and subject

$ git status
$ git log    # See commits log
$ git log -p    # See commits diffs (--patch)
$ git diff master origin/master
$ git diff master...origin/master

$ git commit -am "your comment"    # Commit all (-a) changed files

$ git reset    # Reset uncommitted changes
$ git revert HEAD    # Undo commits

Favorite essential packages

bash-completion
mc
screen
nmap
locate
wget
rsync
iftop
hdparm

redshift
xrandr
xbindkeys
pamixer
playerctl
x11vnc
remmina freerdp
networkmanager-applet networkmanager-openconnect

more



Note: old info below

[outdated] Arch Linux 2012.07.15 Installation Template

Keyboard layout

# ls /usr/share/kbd/keymaps/i386/qwerty
# loadkeys us


Network connection - now configured automatically via DHCP

# systemctl start dhcpcd.service
or
# dhclient eth0
or (for static address)
# ip link set dev eth0 up
# ip addr add 192.168.1.2/24 dev eth0
# ip route add default via 192.168.1.1
# echo "nameserver 8.8.8.8" >> /etc/resolv.conf


Current time setting

# ntpd -qg
# hwclock -w
or
# date MMDDhhmmYYYY
# hwclock --systohc
or
# hwclock --set --date="YYYY-MM-DD hh:mm:ss"
# hwclock --hctosys


Disk preparation

# fdisk /dev/sda
or
# cfdisk /dev/sda
or (for GPT)
# gdisk /dev/sda
or (GPT)
# cgdisk /dev/sda

# mkfs.ext4 /dev/sda1
# mkswap /dev/sda4

# mount /dev/sda1 /mnt
# mount /dev/sda2 /mnt/boot
# mount /dev/sda3 /mnt/home
# swapon /dev/sda4


Base system install

# vi /etc/pacman.d/mirrorlist
# pacstrap /mnt base
or
# pacstrap /mnt base base-devel


Bootloader install

# pacstrap /mnt syslinux
or
# pacstrap /mnt grub-bios
or
# pacstrap /mnt grub-efi-i386
or
# pacstrap /mnt grub-efi-x86_64


System configuration

# genfstab -p /mnt >> /mnt/etc/fstab
or
# genfstab -p -U /mnt >> /mnt/etc/fstab
or
# genfstab -p -L /mnt >> /mnt/etc/fstab

# echo "/dev/sda4   swap   swap   defaults   0   0" >> /mnt/etc/fstab

# arch-chroot /mnt
# man archlinux
# echo "archlinux" > /etc/hostname
# echo "KEYMAP=us" > /etc/vconsole.conf
# ln -s /usr/share/zoneinfo/Canada/Eastern /etc/localtime
# vi /etc/locale.gen
# locale-gen
# echo "LANG=en_US.UTF-8" > /etc/locale.conf
# vi /etc/mkinitcpio.conf
# mkinitcpio -p linux
# passwd


Bootloader setup

# syslinux-install_update -iam
# vi /boot/syslinux/syslinux.cfg
or (for GPT)
# pacman -Sy gptfdisk
# sgdisk /dev/sda -A N:set:2   # N=partition_number_of_/boot (example '7:set:2' for /dev/sda7)
# dd bs=440 conv=notrunc count=1 if=/usr/lib/syslinux/bios/gptmbr.bin of=/dev/sda
# vi /boot/syslinux/syslinux.cfg
or
# grub-install --target=i386-pc --recheck --debug /dev/sda
# grub-mkconfig -o /boot/grub/grub.cfg
or
# mkfs.vfat -F32 /dev/sda5
# mkdir -p /boot/efi
# mount -t vfat /dev/sda5 /boot/efi
# modprobe dm-mod
# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --recheck --debug
# mkdir -p /boot/grub/locale
# cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
# grub-mkconfig -o /boot/grub/grub.cfg


Finish up

# exit
# umount /mnt/{boot,home,}
# reboot

POST INSTALL

Persistent network connection

# cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/
# vi /etc/netctl/ethernet-dhcp
# netctl start ethernet-dhcp
# netctl enable ethernet-dhcp
or (for static address)
# cp /etc/netctl/examples/ethernet-static /etc/netctl/
# vi /etc/netctl/ethernet-static
# netctl start ethernet-static
# netctl enable ethernet-static


Install SSH and run on boot

# pacman -S openssh
# systemctl enable sshd.service