Last active
April 28, 2023 23:51
-
-
Save class101/d33d9b086163d33a034c2aa9cdcbc5b9 to your computer and use it in GitHub Desktop.
Arch Linux Installation w/ or w/o Encryption w/ Cinnamon and Nemo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Arch Linux Installation with | |
# - UEFI Bios | |
# - w/ or w/o Disk encryption | |
# - GRUB, LightDM, cinnamon/Nemo | |
# | |
# https://wiki.archlinux.org/index.php/Installation_Guide | |
# https://wiki.archlinux.org/index.php/Dm-crypt/Encrypting_an_entire_system | |
# [OPTIONAL] Creating a bootable usb disk (sha1sum /home/arno/archlinux-2020.02.01-x86_64.iso to verify iso integrity) | |
dd bs=4M if=/home/arno/archlinux-2021.04.01-x86_64.iso of=/dev/sde status=progress oflag=sync # (Linux) | |
# [INFO] If usb boot fails, check the 'secure boot' bios setting and that you booted in UEFI USB mode | |
# keyboard to French | |
loadkeys fr | |
# Get disk informations /dev/sdX | |
fdisk -l | |
# Partitionning | |
fdisk /dev/sdX | |
g # Create a new empty GPT partition table | |
n # Add a new partition | |
l # List known partition types | |
t # Change a partition type | |
p # Print the partition table | |
w # Save (use with caution, everything deleted on disk) | |
q # Quit without save | |
1 2G EFI System | |
2 100% Linux root (x86-64) # (to be encrypted) | |
3 4G Linux swap # !!! ONLY IF [NO_ENCRYPTION] !!! | |
# Formatting | |
mkfs.fat -F32 /dev/sdX1 | |
# [NO_ENCRYPTION] Formatting | |
mkfs.ext4 /dev/sdX2 | |
mkswap /dev/sdX3 | |
# [ENCRYPTION] Formatting | |
cryptsetup -c aes-xts-plain64 -y -v luksFormat /dev/sdX2 # Setup the encryption of the system, optional: --use-random | |
cryptsetup --allow-discards --perf-no_read_workqueue --perf-no_write_workqueue --persistent open /dev/sdX2 cryptroot # Open the container | |
# SSD TRIM performance | |
# OR cryptsetup --allow-discards --perf-no_read_workqueue --perf-no_write_workqueue --persistent refresh cryptroot | |
mkfs.ext4 /dev/mapper/cryptroot # If you encrypt a simple USB key, you can stop after this step | |
pvcreate /dev/mapper/cryptroot # Create a physical volume on top of the opened LUKS container | |
vgcreate vg0 /dev/mapper/cryptroot # Create the volume group vg0, adding the previously created physical volume to it | |
lvcreate -L 4G vg0 -n swap | |
lvcreate -l 100%FREE vg0 -n root | |
mkfs.ext4 /dev/vg0/root # Or mkfs.ext4 /dev/mapper/vg0-root | |
mkswap /dev/vg0/swap # Or mkswap /dev/mapper/vg0-swap | |
# [NO_ENCRYPTION] Mounting | |
mount /dev/sdX2 /mnt | |
mkdir /mnt/boot && mount /dev/sdX1 /mnt/boot | |
swapon /dev/sdX3 | |
# [ENCRYPTION] Mounting | |
mount /dev/vg0/root /mnt # Or mount /dev/mapper/vg0-root /mnt | |
mkdir /mnt/boot && mount /dev/sdX1 /mnt/boot | |
swapon /dev/vg0/swap # Or swapon /dev/mapper/vg0-swap | |
# [OPTIONAL IF NO DHCP NETWORKING] Set static ip address | |
ip link # To know the interface identifier as 'eno1', 'eth1', etc... and state UP/DOWN | |
ip link set eno1 up | |
ip address add 192.168.1.101/24 broadcast + dev eno1 # Set ip and mask 192.168.1.101/24 (255.255.255.0)nemo-terminal | |
ip route replace default via 192.168.1.1 # Set default gateway 192.168.1.1 | |
echo 'nameserver 192.168.1.1' > /etc/resolv.conf # Set DNS1 | |
echo 'nameserver 8.8.8.8' >> /etc/resolv.conf # Set DNS2 | |
# Arch Linux System Installation | |
pacstrap /mnt base base-devel linux linux-firmware linux-headers lvm2 grub efibootmgr os-prober sudo man man-db man-pages texinfo openssh \ | |
xorg-server nvidia nvidia-utils nvidia-settings nvidia-dkms mesa net-tools netctl nano vi vim git mlocate libgtop gtop htop gnu-free-fonts syslog-ng logrotate \ | |
lightdm lightdm-webkit2-greeter lightdm-webkit-theme-litarvan cinnamon nemo nemo-terminal guake cups avahi system-config-printer intel-ucode | |
# Saving mount table | |
genfstab -U /mnt >> /mnt/etc/fstab | |
# Enter the new system | |
arch-chroot /mnt | |
# [OPTIONAL IF NO DHCP NETWORKING] Set static ip address as previously explained | |
# System clock | |
timedatectl set-timezone Europe/Paris | |
timedatectl set-ntp true | |
# System variables [archlinux as sample computername] | |
echo archlinux >> /etc/hostname # Computer name | |
echo KEYMAP=fr >> /etc/vconsole.conf # Persistent keymap read by systemd on start-up | |
echo '127.0.0.1 localhost' >> /etc/hosts | |
echo '::1 localhost' >> /etc/hosts | |
echo '192.168.1.101 archlinux.localdomain archlinux' >> /etc/hosts # Use 127.0.1.1 if you don't have a static ip address | |
# System locales | |
nano /etc/locale.gen # Uncomment desired languages en_US, fr_FR | |
locale-gen | |
echo LANG=en_US.UTF-8 >> /etc/locale.conf # Default system language | |
echo LC_ADDRESS=fr_FR.UTF-8 >> /etc/locale.conf # Change settings that describe the formats (e.g., postal | |
# addresses) used to describe locations and geography- | |
# related items | |
echo LC_ALL= >> /etc/locale.conf # Troubleshooting : The locale set for this variable will | |
# always override LANG and all the other LC_* variables, | |
# whether they are set or not. | |
echo LC_COLLATE=C >> /etc/locale.conf # This category governs the collation rules used for | |
# sorting and regular expressions, including character | |
# equivalence classes and multicharacter collating | |
# elements. Setting the value to C can for example | |
# make the ls command sort dotfiles first, followed | |
# by uppercase and lowercase filenames | |
echo LC_IDENTIFICATION=fr_FR.UTF-8 >> /etc/locale.conf # Change settings that relate to the metadata for the locale | |
echo LC_MEASUREMENT=fr_FR.UTF-8 >> /etc/locale.conf # Change the settings relating to the measurement system | |
# in the locale (i.e., metric versus US customary units) | |
echo LC_MESSAGES=en_US.UTF-8 >> /etc/locale.conf # This category affects the language in which messages are | |
# displayed and what an affirmative or negative answer | |
# looks like | |
echo LC_MONETARY=fr_FR.ISO-8859-15@euro >> /etc/locale.conf # This category determines the formatting used for | |
# monetary-related numeric values | |
echo LC_NAME=fr_FR.UTF-8 >> /etc/locale.conf # Change settings that describe the formats used to address | |
# persons | |
echo LC_NUMERIC=en_US.UTF-8 >> /etc/locale.conf # This category determines the formatting rules used for | |
# nonmonetary numeric values—for example, the thousands | |
# separator and the radix character (a period in most | |
# English-speaking countries, but a comma in many other | |
# regions) | |
echo LC_PAPER=fr_FR.UTF-8 >> /etc/locale.conf # Change the settings relating to the dimensions of the | |
# standard paper size (e.g., US letter versus A4) | |
echo LC_TELEPHONE=fr_FR.UTF-8 >> /etc/locale.conf # Change settings that describe the formats | |
# (e.g., postal addresses) used to describe locations | |
# and geography-related items | |
echo LC_TIME=fr_FR.UTF-8 >> /etc/locale.conf # This category governs the formatting used for date | |
# and time values | |
# Root account setup | |
passwd | |
# User account setup with home dir creation and skeleton files copy | |
useradd -m -G wheel arno | |
passwd arno | |
sed -e "s|# %wheel ALL=(ALL) ALL|%wheel ALL=(ALL) ALL|" -i /etc/sudoers # Give the wheel group the rights to use sudo | |
# [ENCRYPTION] Configure mkinitcpio with modules needed for the initrd image | |
sed -e "s|MODULES=()|MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm ext4)|" -i /etc/mkinitcpio.conf | |
sed -e "s|HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)| \ | |
HOOKS=(base udev autodetect keyboard keymap modconf block encrypt lvm2 filesystems fsck)|" -i /etc/mkinitcpio.conf | |
# [ENCRYPTION] Regenerate initrd image | |
mkinitcpio -P | |
# Setup grub | |
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB | |
# [ENCRYPTION] (Execute 'lsblk -f' to get devices UUID and replace <sdX2 UUID> by UUID) | |
sed -e 's|GRUB_CMDLINE_LINUX=""|GRUB_CMDLINE_LINUX="cryptdevice=UUID=<sdX2 UUID>:cryptroot:allow-discards root=/dev/vg0/root"|' -i /etc/default/grub | |
grub-mkconfig -o /boot/grub/grub.cfg | |
# Exit new system and go into the cd shell | |
exit | |
# Reboot | |
umount -R /mnt && swapoff -a && reboot | |
# Display - Xorg | |
localectl set-x11-keymap fr # Set X11 keyboard layout FR | |
#echo 'needs_root_rights=no' >> /etc/X11/Xwrapper.config # Kernel mode setting; implementations in proprietary display | |
# drivers fail auto-detection and require 'needs_root_rights=no' | |
# Display - LightDM | |
sed -e "s|#greeter-session=example-gtk-gnome|greeter-session=lightdm-webkit2-greeter|" -i /etc/lightdm/lightdm.conf | |
sed -e "s|time_language = auto|time_language = fr_FR|" -i /etc/lightdm/lightdm-webkit2-greeter.conf | |
# More system configurations | |
sed -e "s|weekly|daily|" -i /etc/logrotate.conf | |
#ln -s /usr/bin/xdg-open /usr/bin/gnome-open | |
# System services | |
#systemctl disable org.cups.cupsd.service | |
systemctl enable NetworkManager lightdm syslog-ng@default | |
# Reboot | |
reboot | |
# paru (better pacman with aur support) | |
cd /tmp && git clone http://aur.archlinux.org/paru.git && cd paru && makepkg -si | |
# Install MacOS Mojave theme | |
paru -S mojave-gtk-theme-git mcmojave-circle-icon-theme-git | |
# Install Sublime-Text/Merge | |
curl -O https://download.sublimetext.com/sublimehq-pub.gpg && sudo pacman-key --add sublimehq-pub.gpg && \ | |
sudo pacman-key --lsign-key 8A8F901A && rm sublimehq-pub.gpg | |
# Stable: echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/stable/x86_64" | sudo tee -a /etc/pacman.conf | |
# Dev: echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/dev/x86_64" | sudo tee -a /etc/pacman.conf | |
sudo yay -Syu sublime-text sublime-merge | |
# Cinnamon | |
# Disable service add Hidden=true to | |
# /etc/xdg/autostart/cinnamon-settings-daemon-wacom.desktop | |
# /etc/xdg/autostart/cinnamon-settings-daemon-smartcard.desktop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sharing my own install, customized after passing hours reading in ArchWiki.
(despite named *.sh, script is not designed to be executable, don't execute it)
Formatted to fit on a both sided A4 page (with SublimeText and Print as HTML plugin)
Tested on two different systems, home and work.