artix_install 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. ### Artix Linux Installation Guide ###
  2. ##################################################
  3. # Partitioning Drives
  4. fdisk /dev/sdb &&
  5. cryptsetup --batch-mode luksFormat --type luks1 /dev/sdb2 &&
  6. cryptsetup open /dev/sdb2 system &&
  7. mkfs.ext4 /dev/sdb1 &&
  8. mkfs.ext4 /dev/mapper/system &&
  9. # Mounting Drives
  10. mount /dev/mapper/system /mnt &&
  11. mkdir /mnt/boot &&
  12. mount /dev/sdb1 /mnt/boot/ &&
  13. # Base Installation
  14. basestrap /mnt base base-devel runit elogind-runit linux-hardened linux-hardened-headers linux-firmware grub dhcpcd dhcpcd-runit cryptsetup neovim --noconfirm --disable-download-timeout &&
  15. fstabgen -U /mnt >> /mnt/etc/fstab &&
  16. artix-chroot /mnt bash
  17. ##################################################
  18. # Setting Time Zone
  19. ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime &&
  20. hwclock --systohc &&
  21. # Configuring Localization
  22. echo KEYMAP=de > /etc/vconsole.conf &&
  23. sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen &&
  24. sed -i 's/#en_US ISO-8859-1/en_US ISO-8859-1/' /etc/locale.gen &&
  25. locale-gen &&
  26. echo 'export LANG="en_US.UTF-8"' >> /etc/locale.conf &&
  27. echo 'export LC_COLLATE="C"' >> /etc/locale.conf &&
  28. # Setting Hostname
  29. echo "system" > /etc/hostname &&
  30. echo "127.0.0.1 localhost" >> /etc/hosts &&
  31. echo "::1 localhost" >> /etc/hosts &&
  32. echo "127.0.1.1 system.localdomain system" >> /etc/hosts &&
  33. # Configuring Network
  34. ln -s /etc/runit/sv/dhcpcd /etc/runit/runsvdir/current &&
  35. # Adding Users
  36. echo "Enter root password:" &&
  37. passwd &&
  38. useradd -G wheel -m user &&
  39. echo "Enter user password:" &&
  40. passwd user &&
  41. usermod -a -G video,audio,input,power,storage,optical,lp,scanner,dbus,uucp user &&
  42. # Configuring Grub & Encrypting Drives
  43. sed -i 's/HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)$/HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block 'encrypt' filesystems fsck)/' /etc/mkinitcpio.conf &&
  44. mkinitcpio -p linux-hardened &&
  45. sed -i 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=1/' /etc/default/grub &&
  46. sed -i 's/GRUB_DISTRIBUTOR="Artix"/GRUB_DISTRIBUTOR=""/' /etc/default/grub &&
  47. sed -i '/GRUB_DISTRIBUTOR=""/a GRUB_TOP_LEVEL="/boot/vmlinuz-linux-hardened"' /etc/default/grub &&
  48. sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"/GRUB_CMDLINE_LINUX_DEFAULT="loglevel=0 quiet udev.log_level=0 vt.global_cursor_default=0 nowatchdog page_alloc.shuffle=1"/' /etc/default/grub &&
  49. sed -i 's/#GRUB_ENABLE_CRYPTODISK=y/GRUB_ENABLE_CRYPTODISK=y/' /etc/default/grub &&
  50. sed -i 's/#GRUB_TERMINAL_OUTPUT=console/GRUB_TERMINAL_OUTPUT=console/' /etc/default/grub &&
  51. sed -i 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="cryptdevice=UUID='"$(ls -l /dev/disk/by-uuid | grep "sdb2" | awk '{print $9}')"':cryptroot"/' /etc/default/grub &&
  52. grub-install /dev/sdb && grub-mkconfig -o /boot/grub/grub.cfg &&
  53. # Installing Packages (Artix Repository)
  54. pacman -Syu --noconfirm --disable-download-timeout \
  55. artix-archlinux-support \
  56. artools-base \
  57. aspell \
  58. aspell-en \
  59. audacity \
  60. bc \
  61. calcurse \
  62. clamav \
  63. cmus \
  64. cronie \
  65. cronie-runit \
  66. cups \
  67. cups-filters \
  68. dash \
  69. dbus-glib \
  70. docx2txt \
  71. dvd+rw-tools \
  72. exiv2 \
  73. ffmpegthumbnailer \
  74. fzf \
  75. giflib \
  76. gimp \
  77. git \
  78. gnome-themes-extra \
  79. gtk2 \
  80. gtk-engine-murrine \
  81. hspell \
  82. htop \
  83. hunspell \
  84. hunspell-en_us \
  85. i2pd \
  86. imagemagick \
  87. imlib2 \
  88. keepassxc \
  89. libexif \
  90. libimagequant \
  91. libpwquality \
  92. libraqm \
  93. libreoffice-fresh \
  94. librewolf \
  95. libvoikko \
  96. libwebp \
  97. libxft \
  98. libxinerama \
  99. libxrandr \
  100. linux-lts \
  101. linux-lts-headers \
  102. maim \
  103. man-db \
  104. man-pages \
  105. mpv \
  106. newsboat \
  107. nftables \
  108. nftables-runit \
  109. noto-fonts-cjk \
  110. nuspell \
  111. opendoas \
  112. openresolv \
  113. openssh \
  114. pacman-contrib \
  115. pacutils \
  116. pass \
  117. pipewire \
  118. pipewire-pulse \
  119. playerctl \
  120. polkit \
  121. poppler \
  122. qbittorrent \
  123. ranger \
  124. rsync \
  125. sane \
  126. shellcheck-bin \
  127. tlp \
  128. tlp-runit \
  129. tor \
  130. torsocks \
  131. tumbler \
  132. ttf-carlito \
  133. ttf-dejavu \
  134. unclutter \
  135. unzip \
  136. wget \
  137. wireguard-tools \
  138. xautolock \
  139. xclip \
  140. xdg-utils \
  141. xdotool \
  142. xf86-video-intel \
  143. xorg-server \
  144. xorg-xhost \
  145. xorg-xinit \
  146. xorg-xrandr \
  147. xorg-xset \
  148. xwallpaper \
  149. yt-dlp \
  150. zathura \
  151. zathura-pdf-mupdf \
  152. zsh &&
  153. # Installing Packages (Arch Repository)
  154. echo -e "\n# Arch\n[extra]\nInclude = /etc/pacman.d/mirrorlist-arch" >> /etc/pacman.conf &&
  155. pacman -Syu --noconfirm --disable-download-timeout \
  156. claws-mail \
  157. hugo \
  158. mpv-mpris \
  159. pamixer \
  160. pass-otp \
  161. pulsemixer \
  162. termdown \
  163. ttf-caladea \
  164. ttf-jetbrains-mono-nerd \
  165. xcompmgr &&
  166. # Installing Packages (Arch User Repository)
  167. sed -i 's/# %wheel ALL=(ALL:ALL) NOPASSWD: ALL$/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers &&
  168. echo "permit nopass user as root" >> /etc/doas.conf &&
  169. sudo -u user git clone https://aur.archlinux.org/yay-bin.git /home/user/yay-bin &&
  170. cd /home/user/yay-bin &&
  171. sudo -u user makepkg -si --noconfirm &&
  172. sudo -u user yay --sudo doas --save &&
  173. sudo -u user yay -S --noconfirm --disable-download-timeout \
  174. abook \
  175. cnijfilter2 \
  176. epub-thumbnailer-git \
  177. gruvbox-material-gtk-theme-git \
  178. gruvbox-material-icon-theme-git \
  179. neovim-gruvbox-material-git \
  180. sc-im \
  181. ueberzugpp &&
  182. sed -i 's/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers &&
  183. cd /home/user &&
  184. rm -r /home/user/yay-bin &&
  185. su - user
  186. ##################################################
  187. # Re-Symlinkling /bin/sh to dash
  188. doas ln -sfT dash /bin/sh &&
  189. # Making Zsh the Default Shell
  190. doas chsh -s /bin/zsh user &&
  191. doas chsh -s /bin/zsh root &&
  192. # Configuring Pipewire
  193. doas cp -r /usr/share/pipewire/pipewire* /etc/pipewire &&
  194. doas sed -i '/context.exec = \[/a \ { path = "/usr/bin/wireplumber" args = "" }\n { path = "/usr/bin/pipewire" args = "-c pipewire-pulse.conf" }' /etc/pipewire/pipewire.conf &&
  195. # Configuring Runit Services
  196. doas ln -s /etc/runit/sv/tlp /etc/runit/runsvdir/current &&
  197. doas ln -s /etc/runit/sv/cronie /etc/runit/runsvdir/current &&
  198. doas ln -s /etc/runit/sv/nftables /etc/runit/runsvdir/current &&
  199. doas rm /etc/runit/runsvdir/current/agetty-tty3 &&
  200. doas rm /etc/runit/runsvdir/current/agetty-tty4 &&
  201. doas rm /etc/runit/runsvdir/current/agetty-tty5 &&
  202. doas rm /etc/runit/runsvdir/current/agetty-tty6 &&
  203. # Creating Symlinks
  204. doas mkdir /root/.config && doas mkdir /root/.config/nvim &&
  205. doas ln -s $HOME/.config/nvim/init.vim /root/.config/nvim/init.vim &&
  206. doas ln -s $HOME/.config/zsh/.root/zsh /root/.config/ &&
  207. doas ln -s /usr/share/fontconfig/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/ &&
  208. # Setting Permissions
  209. doas chmod 777 /mnt &&
  210. doas chown -c root:root /etc/doas.conf &&
  211. doas chmod -c 0400 /etc/doas.conf &&
  212. doas chown -c root:root /etc/nftables.conf &&
  213. doas chmod -c 0400 /etc/nftables.conf &&
  214. # Creating Cronjobs
  215. echo "*/15 * * * * newsboat -x reload" | crontab - &&
  216. (echo "$(crontab -l)
  217. */15 * * * * /usr/local/bin/mainbackup") | crontab - &&
  218. echo "*/1 * * * * pacman -Sy" | doas crontab - &&
  219. (echo "$(doas crontab -l)
  220. @reboot dbus-uuidgen >| /etc/machine-id") | doas crontab - &&
  221. # Configuring Fstab
  222. doas sed -i 's/relatime/noatime/g' /etc/fstab &&
  223. # Pulling Dotfiles from Personal Repository
  224. git clone https://notabug.org/kato/dotfiles &&
  225. wget https://notabug.org/kato/installation_guides/raw/master/artix_install &&
  226. # Copying Dotfiles (Home & Root)
  227. yes | cp -rf dotfiles/home/user/. ~ &&
  228. yes | doas cp -rf dotfiles/root/. /root/ &&
  229. # Compiling Software
  230. cd .config/ && cd dwm && doas make clean install && cd - &&
  231. cd dwmblocks && doas make clean install && cd - &&
  232. cd st && doas make clean install && cd - &&
  233. cd dmenu && doas make clean install && cd - &&
  234. cd farbfeld && doas make clean install && cd - &&
  235. cd nsxiv && doas make clean install && cd - &&
  236. cd sent && doas make clean install && cd - &&
  237. cd slock && doas make clean install && cd &&
  238. # Installing ZSH (Plugins)
  239. doas git clone https://github.com/zdharma-continuum/fast-syntax-highlighting /usr/share/zsh/plugins/fast-syntax-highlighting &&
  240. # Installing Neovim (Plugins)
  241. doas sh -c 'curl -fLo /root/.local/share/nvim/site/autoload/plug.vim \
  242. https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' &&
  243. doas nvim +PlugInstall +qall &&
  244. sh -c 'curl -fLo ~/.local/share/nvim/site/autoload/plug.vim \
  245. https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' &&
  246. nvim +PlugInstall +qall &&
  247. # Copying Dotfiles (Configs)
  248. yes | doas cp -rf dotfiles/lib/* /lib/ &&
  249. yes | doas cp -rf dotfiles/usr/* /usr/ &&
  250. yes | doas cp -rf dotfiles/etc/* /etc/ &&
  251. mv ~/dotfiles/ ~/documents/ &&
  252. # Setting Desktop Background
  253. setbg pictures/wallpapers/something.jpg 2>/dev/null &&
  254. # Configuring Groups
  255. doas groupadd nogroup &&
  256. yes | doas grpck
  257. ##################################################
  258. # Cleaning Up After Reboot
  259. doas paccache -rvk2 && yay -Sc --aur --noconfirm && rm -f ~/.config/zsh/.zsh_history && find ~/.cache -mindepth 1 -maxdepth 1 -type d ! -name backups -exec rm -rf {} + && doas rm -f /root/.config/zsh/.zsh_history && doas find /var/log -name "*.log" -type f -mtime +7 -delete &&
  260. doas rm /root/.config/nvim/README.md /root/.local/share/nvim/plugged/README.md /root/.local/share/nvim/site/autoload/README.md &&
  261. rm ~/.cache/backups/README.md ~/.local/share/nvim/plugged/README.md ~/.local/share/nvim/site/autoload/README.md ~/artix_install ~/documents/README.md ~/downloads/README.md ~/music/audiobooks/README.md ~/music/timers/README.md ~/music/youtube/README.md ~/pictures/misc/README.md ~/pictures/screenshots/README.md ~/videos/README.md &&
  262. rm .bash_history &&
  263. rm .bash_logout &&
  264. rm .bash_profile &&
  265. rm .bashrc &&
  266. # Enabling Autologin
  267. yes | doas cp -rf documents/dotfiles/run/runit/service/agetty-tty1/conf /run/runit/service/agetty-tty1/conf &&
  268. # Running Sysctl
  269. doas sysctl --system
  270. ##################################################
  271. # Setting Up Printer
  272. http://localhost:631/admin
  273. lpoptions -d Canon-TS3400-series_42-F8-DF-3B-B8-70