artix_install 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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. hspell \
  81. htop \
  82. hunspell \
  83. hunspell-en_us \
  84. i2pd \
  85. imagemagick \
  86. imlib2 \
  87. keepassxc \
  88. libexif \
  89. libimagequant \
  90. libpwquality \
  91. libraqm \
  92. libreoffice-fresh \
  93. librewolf \
  94. libvoikko \
  95. libwebp \
  96. libxft \
  97. libxinerama \
  98. libxrandr \
  99. linux-lts \
  100. linux-lts-headers \
  101. maim \
  102. man-db \
  103. man-pages \
  104. mpv \
  105. newsboat \
  106. nftables \
  107. nftables-runit \
  108. noto-fonts-cjk \
  109. nuspell \
  110. opendoas \
  111. openresolv \
  112. openssh \
  113. pacman-contrib \
  114. pacutils \
  115. pass \
  116. pipewire \
  117. pipewire-pulse \
  118. playerctl \
  119. polkit \
  120. poppler \
  121. qbittorrent \
  122. ranger \
  123. rsync \
  124. sane \
  125. shellcheck-bin \
  126. tlp \
  127. tlp-runit \
  128. tor \
  129. torsocks \
  130. tumbler \
  131. ttf-carlito \
  132. ttf-dejavu \
  133. unclutter \
  134. unzip \
  135. wget \
  136. wireguard-tools \
  137. wireguard-runit \
  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. ueberzugpp \
  166. xcompmgr &&
  167. # Installing Packages (Arch User Repository)
  168. sed -i 's/# %wheel ALL=(ALL:ALL) NOPASSWD: ALL$/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers &&
  169. echo "permit nopass user as root" >> /etc/doas.conf &&
  170. sudo -u user git clone https://aur.archlinux.org/yay-bin.git /home/user/yay-bin &&
  171. cd /home/user/yay-bin &&
  172. sudo -u user makepkg -si --noconfirm &&
  173. sudo -u user yay --sudo doas --save &&
  174. sudo -u user yay -S --noconfirm --disable-download-timeout \
  175. abook \
  176. cnijfilter2 \
  177. epub-thumbnailer-git \
  178. sc-im &&
  179. sed -i 's/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/# %wheel ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers &&
  180. cd /home/user &&
  181. rm -r /home/user/yay-bin &&
  182. su - user
  183. ##################################################
  184. # Re-Symlinkling /bin/sh to dash
  185. doas ln -sfT dash /bin/sh &&
  186. # Making Zsh the Default Shell
  187. doas chsh -s /bin/zsh user &&
  188. doas chsh -s /bin/zsh root &&
  189. # Configuring Pipewire
  190. doas cp -r /usr/share/pipewire/pipewire* /etc/pipewire &&
  191. 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 &&
  192. # Configuring Runit Services
  193. doas ln -s /etc/runit/sv/tlp /etc/runit/runsvdir/current &&
  194. doas ln -s /etc/runit/sv/cronie /etc/runit/runsvdir/current &&
  195. doas ln -s /etc/runit/sv/nftables /etc/runit/runsvdir/current &&
  196. doas rm /etc/runit/runsvdir/current/agetty-tty3 &&
  197. doas rm /etc/runit/runsvdir/current/agetty-tty4 &&
  198. doas rm /etc/runit/runsvdir/current/agetty-tty5 &&
  199. doas rm /etc/runit/runsvdir/current/agetty-tty6 &&
  200. # Creating Symlinks
  201. doas mkdir /root/.config && doas mkdir /root/.config/nvim &&
  202. doas ln -s $HOME/.config/nvim/init.vim /root/.config/nvim/init.vim &&
  203. doas ln -s $HOME/.config/zsh/.root/zsh /root/.config/ &&
  204. doas ln -s /usr/share/fontconfig/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/ &&
  205. # Setting Permissions
  206. doas chmod 777 /mnt &&
  207. doas chown -c root:root /etc/doas.conf &&
  208. doas chmod -c 0400 /etc/doas.conf &&
  209. doas chown -c root:root /etc/nftables.conf &&
  210. doas chmod -c 0400 /etc/nftables.conf &&
  211. # Creating Cronjobs
  212. echo "*/15 * * * * newsboat -x reload" | crontab - &&
  213. (echo "$(crontab -l)
  214. */15 * * * * /usr/local/bin/mainbackup") | crontab - &&
  215. echo "*/1 * * * * pacman -Sy" | doas crontab - &&
  216. (echo "$(doas crontab -l)
  217. @reboot dbus-uuidgen >| /etc/machine-id") | doas crontab - &&
  218. # Configuring Fstab
  219. doas sed -i 's/relatime/noatime/g' /etc/fstab &&
  220. # Pulling Dotfiles from Personal Repository
  221. git clone https://notabug.org/kato/dotfiles &&
  222. wget https://notabug.org/kato/installation_guides/raw/master/artix_install &&
  223. # Copying Dotfiles (Home & Root)
  224. yes | cp -rf dotfiles/home/user/. ~ &&
  225. yes | doas cp -rf dotfiles/root/. /root/ &&
  226. # Compiling Software
  227. cd .config/ && cd dwm && doas make clean install && cd - &&
  228. cd dwmblocks && doas make clean install && cd - &&
  229. cd st && doas make clean install && cd - &&
  230. cd dmenu && doas make clean install && cd - &&
  231. cd farbfeld && doas make clean install && cd - &&
  232. cd nsxiv && doas make clean install && cd - &&
  233. cd sent && doas make clean install && cd - &&
  234. cd slock && doas make clean install && cd &&
  235. # Installing ZSH (Plugins)
  236. doas git clone https://github.com/zdharma-continuum/fast-syntax-highlighting /usr/share/zsh/plugins/fast-syntax-highlighting &&
  237. # Installing Neovim (Plugins)
  238. doas sh -c 'curl -fLo /root/.local/share/nvim/site/autoload/plug.vim \
  239. https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' &&
  240. doas nvim +PlugInstall +qall &&
  241. sh -c 'curl -fLo ~/.local/share/nvim/site/autoload/plug.vim \
  242. https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' &&
  243. nvim +PlugInstall +qall &&
  244. # Copying Dotfiles (Configs)
  245. yes | doas cp -rf dotfiles/lib/* /lib/ &&
  246. yes | doas cp -rf dotfiles/usr/* /usr/ &&
  247. yes | doas cp -rf dotfiles/etc/* /etc/ &&
  248. mv ~/dotfiles/ ~/documents/ &&
  249. # Setting Desktop Background
  250. setbg pictures/wallpapers/something.jpg 2>/dev/null &&
  251. # Configuring Groups
  252. doas groupadd nogroup &&
  253. yes | doas grpck
  254. ##################################################
  255. # Cleaning Up After Reboot
  256. 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 &&
  257. doas rm /root/.config/nvim/README.md /root/.local/share/nvim/plugged/README.md /root/.local/share/nvim/site/autoload/README.md &&
  258. 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 &&
  259. rm .bash_history &&
  260. rm .bash_logout &&
  261. rm .bash_profile &&
  262. rm .bashrc &&
  263. # Enabling Autologin
  264. yes | doas cp -rf documents/dotfiles/run/runit/service/agetty-tty1/conf /run/runit/service/agetty-tty1/conf &&
  265. # Running Sysctl
  266. doas sysctl --system
  267. ##################################################
  268. # Setting Up Printer
  269. http://localhost:631/admin
  270. lpoptions -d Canon-TS3400-series_42-F8-DF-3B-B8-70