joplin-notes/joplin notion extension/linux/Arch/Installation.md
2026-11-04 00:33:23 +05:30

351 lines
No EOL
12 KiB
Markdown

Installation
https://wiki.archlinux.org/title/installation_guide
offline installation : https://medium.com/@elohash/how-to-install-arch-linux-without-internet-no-pacman-9314836949de
https://docs345.surge.sh/arch_installation/
This video is used for the following steps: https://www.youtube.com/watch?v=DPLnBPM4DhI
https://files.catbox.moe/u3tkye.mp4
- `iwctl`
- https://m.youtube.com/watch?v=3czrHtFHteY
`device list`
`station wlan0 scan` then `station wlan0 get-networks`
then connect to internet using
`station <device_name> connect <ssid>`
Eg: `station wlan0 connect Comcast-50`
and `quit`. then ping it by to check if internet is working
`ping x.org`.
- Update time with `timedatectl`
- Partitioning disk
- Check partition using `fdisk -l` or `lsblk` or `cfdisk`
- Then `fdisk <partition>`
eg: `fdisk /dev/sda`
- Type these commands in sequence:
`p` to print information
`o` to create new label
`n` to add new partition. So many prompts will come just press enter to select default.
- Press `t` and Choose lvm by typing `8E` then type `a` to make partition active.
- Finalize change type `w` then enter
- Then create physical volume using
`pvcreate --dataalignment 1m /dev/sda1`
- Now create volume group
`vgcreate volgroup0 /dev/sda1` . Here `volgroup0` is a group name.
- Now create 2 logical volumes ie lv_root and lv_home
`lvcreate -L 30GB volgroup0 -n lv_root`
and
`lvcreate -l 100%FREE volgroup0 -n lv_home`
- Load new volume group into memory
`modprobe dm_mod`
- Scan system for volume groups
`vgscan` and activate it
`vgchange -ay`
- Formatting volumes
- Now format these parttions. For root one , format it with ext4 and for swap one format with swap
Ext4 formatting
`mkfs.ext4 /dev/volgroup0/lv_root`
Mounting
`mount /dev/volgroup0/lv_root /mnt`
&nbsp;
Now format 2nd logical volume and mount it
`mkfs.ext4 /dev/volgroup0/lv_home`
Mounting
`mkdir /mnt/home`
`mount /dev/volgroup0/lv_home /mnt/home`
&nbsp;
If there r swap partitions then
Format the Swap Partition (if created): If you created a swap partition, format it as swap:
`mkswap /dev/sdX2` # Replace /dev/sdX2 with your swap partition
`swapon /dev/sdX2` # Activate the swap partition
&nbsp;
`mkdir /mnt/etc`
Saving partition layout by:
`genfstab -U -p /mnt >> /mnt/etc/fstab`
- For UEFI
Difference here is that we need to create efi partition
After typing `fdisk /dev/sda` type these commands:
`p` and `g`(for new GPT) , `n` then
- Partition number and First sector is default but for last sector we need to change it So type `+500M` as 500mb is enough for efi
&nbsp;
Now type `t` and and partition type is `1` which means efi
- Now one more partition for rest
So type `n` and just select defaults and set the type with `t` and set to lvm
- Partition number would be 2 which is default
- Type `30` for lvm
- Finally verify it by `p` and type `w` to make changes
&nbsp;
For parttion 1 ie efi , it have to be formatted with fat32
`mkfs.fat -F32 /dev/sda1`
Here `-F32` represents fat32
Now instead of creating and volume and setting other steps for lvm use sda2 instead of sda1 .
- For UEFI with encryption
![arch_ueqfi_encryption_part_scheme.png](../../../_resources/arch_ueqfi_encryption_part_scheme.png)
this should be. 1st to efi,2nd to linux filesystem and 3rd to linux lvm
&nbsp;
Do same for efi and set ext4 for partition 2 but before formatting 4rd we need to encrypt it
- Setting encryption
`cryptsetup luksFormat /dev/sda3`
Now u need to type passphrase. This passphrase should be available else all data will remain encrypted and inaccessible. After typing passphrase it will get locked so type
`cryptsetup open --type luks /dev/sda3 lvm`
Now just create volume , format and mount
`pvcreate --dataalignment 1m /dev/mapper/lvm`
&nbsp;
- Installing components
- Using pacstrap command
`pacstrap -i /mnt base`
There mey be a error related to keyring hell so to fix it use
https://wiki.archlinux.org/title/Pacman/Package_signing#Resetting_all_the_keys
In `/etc/pacman.conf`
```text
SigLevel = Never
#LocalFileSigLevel = Optional
#RemoteFileSigLevel = Required
```
- Configure our installation
`arch-chroot /mnt` Using in chroot environment. arch-chroot is like a fake-root which change to new directory so that u can make changes af if they r live but all those changes will take place in future.
- Inside chroot, install 4 packages ie linux, linux-headers and linux-lts, linux-lts-headers. 2 versions bcz if one dont work then other may work. lts means here 'long term support' hence stable. Use
`pacman -S linux linux-headers linux-lts linux-lts-headers linux-firmware`
Then few more packages like nano, base-devel(basic development tools), openssh(remote access)
To use openssh make sure to enable sshd
`systemctl enable sshd`
&nbsp;
Install packages for network working
`pacman -S networkmanager wpa_supplicant wireless_tools netctl`
&nbsp;
installing dialog if gui network interface not working
`pacman -S dialog`
Then finally enable NetworkManager so it will be started when booted
`systemctl enable NetworkManager`
&nbsp;
Installing lvm support
`pacman -S lvm2`
&nbsp;
To ensure boot process support our configuration, we have to modify a config file
`nano /etc/mkinitcpio.conf`
now using Ctrl+W find the `HOOKS` which is not commented. Between block and filesystems word,
add `lvm2` . if used encryption then add `encrypt lvm2`.
- Resizing partition
`lvdisplay` and `vgdisplay`
&nbsp;
Shrink LV
If something goes wrong with length of partition then u need to resize it
`umount /dev/VG_NAME/lv_home` # Unmount the LV (replace VG_NAME with your volume group)
`e2fsck -f /dev/volgroup0/lv_home` # to check file system consistency and check for errors,bad block.
`resize2fs /dev/VG_NAME/lv_home NEW_SIZE` # Shrink the filesystem
`lvreduce -L NEW_SIZE /dev/VG_NAME/lv_home` # Shrink the logical volume
&nbsp;
Extend LV
`lvextend -L +NEW_SIZE /dev/VG_NAME/lv_root` # Extend the logical volume
or
`lvextend -l +100%FREE /dev/VG_NAME/lv_root`
`e2fsck -f /dev/volgroup0/lv_root`
`resize2fs /dev/VG_NAME/lv_root` # Resize the filesystem to use the new space
- Initramfs
To take all these setups and option take effect use this
`mkinitcpio -p linux`
`mkinitcpio -p linux-lts`(As this was also installed)
Then set the locale by
`nano /etc/locale.gen`
Then choose en us and uncomment it
`locale-gen`
&nbsp;
Updating password
`passwd` then type password to set it
&nbsp;
Creating standard user
`useradd -m -g users -G wheel hvm`
`-m` means creating home directory for the user, `-g` represents initial login group, `-G` are other supplementary groups. `hvm` is user name.
Then set password for this user
`passwd hvm` and set password.
After this we dont have to use root account always, instead we can use sudo
&nbsp;
Now we need to associate wheel group with sudo
`EDITOR=nano visudo`
`visudo` is a dedicated command to modify sudo priviledges
Scroll down and search for `%wheel ALL=(ALL:ALL) ALL` and uncomment it and save the file.
Now user can use sudo to run administrative task.
- Installing GRUB
Its purpose is to boot the OS without bootable media like USB or CD.
- For non-UEFI(BIOS)
Install this:
`pacman -S grub dosfstools os-prober mtools`
and finally
`grub-install --target=i386-pc --recheck /dev/sda`
&nbsp;
- For UEFI install these
`pacman -S grub efibootmgr dosfstools os-prober mtools`
&nbsp;
`mkdir /boot/EFI`
`mount /dev/sda1 /boot/EFI`
and finally
`grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck`
&nbsp;
Check if grub exists by this:
`ls -l /boot/grub`
&nbsp;
- Others
`cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo`
- With encryption
`nano /etc.default/grub` then uncomment `GRUB_ENABLE_CRYPTODISK=y`
and edit the line
#add this GRUB_CMDLINE_LINUX_DEFAULT="cryptodevice=/dev/sda3:volgroup0:allow-discards loglevel=3 quiet"
&nbsp;
- Generate grub config file
`grub-mkconfig -o /boot/grub/grub.cfg`
Finally
`exit` and `umount -a` (to unmount everything)
Finally `reboot`
&nbsp;
### Post install tweeks
- Creating swap file(not partition)
`su`
`cd /root`
The dd command in Linux is a versatile utility used for copying and converting files, including data from files, devices, partitions, or even raw disk images. The command's name, "dd," stands for "data duplicator."
`dd if=/dev/zero of=/swapfile bs=1M count=1024 status=progress`
Changing permissions of swapfile
`chmod 600 /swapfile`
Formatting it to swap
`mkswap /swapfile`
Backing up copy of fstab file as we going to edit it
`cp /etc/fstab /etc/fstab.bak`
Editing it
`echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab`
It will add the line
&nbsp;
`free -m` to check is swap is there
`mount -a`(if it runs means no error)
To activate swap
`swapon -a` and check it with `free -m`
&nbsp;
- Setting time zone
Listing it
`timedatectl list-timezones`
Setting it
`timedatectl set-timezone <from_list>`
Enabling it
`systemctl enable systemd-timesyncd`
&nbsp;
Setting host name
`hostnamectl set-hostname archhost` here 'archhost' is host name
Editing hosts file
`nano /etc/hosts`
and add
```
127.0.0.1 localhost
127.0.1.1 archhost
```
and save it
To check it
`hostnamectl`
This image will be the output
![arch vm_outhostnamectl.png](../../../_resources/arch%20vm_outhostnamectl.png)
&nbsp;
**Installing micro code for CPU**(optional)
AMD CPU
`pacman -S amd-ucode`
or
Intel CPU
`pacman -S intel-ucode`
&nbsp;
- **GUI**
- Installing xorg
`pacman -S xorg-server`
- Installing video driver
For Intel or AMD GPU
`pacman -S mesa`
For NVIDIA GPU
`pacman -S nvidia-lts nvidia`
For VBox
`pacman -S virtualbox-guest-utils xf86-video-vmware`
and enable vbox extension
`systemctl enable vboxservice`
For QEMU, this might improve performance
`sudo pacman -S xf86-video-qxl
`
And configure it too
`sudo mkdir -p /etc/X11/xorg.conf.d`
`sudo nano /etc/X11/xorg.conf.d/20-qxl.conf
`
Type this
```
Section "Device"
Identifier "qxl"
Driver "qxl"
Option "AccelMethod" "glamor"
EndSection
```
and save it
- Installing Desktop Environment
- GNOME
`pacman -S GNOME`
it will store many dependencies as its a package group
Some other optional
`pacman -S gnome-tweaks` this will give more control over the environment
&nbsp;
Enable display manager
`systemctl enable gdm`
This will enable login screen
Specify the language in Region and Language section else terminal wont open
- Plasma
`pacman -S plasma-meta kde-applications`
Enable display manager
`systemctl enable sddm`
- Xfce
`pacman -S xfce4 xfce4-goodies`
Install display manager
`pacman -S lightdm lightdm-gtk-greeter`
Enabling it
`systemctl enable lightdm`
- Packages in xfce
: There are 15 members in group xfce4:
:: Repository extra
```
1) exo 2) garcon 3) thunar 4) thunar-volman 5) tumbler
6) xfce4-appfinder 7) xfce4-panel 8) xfce4-power-manager 9) xfce4-session
10) xfce4-settings 11) xfce4-terminal 12) xfconf 13) xfdesktop 14) xfwm4
15) xfwm4-themes
Enter a selection (default=all):
:: There are 36 members in group xfce4-goodies:
:: Repository extra
1) mousepad 2) parole 3) ristretto 4) thunar-archive-plugin
5) thunar-media-tags-plugin 6) xfburn 7) xfce4-artwork
8) xfce4-battery-plugin 9) xfce4-clipman-plugin 10) xfce4-cpufreq-plugin
11) xfce4-cpugraph-plugin 12) xfce4-dict 13) xfce4-diskperf-plugin
14) xfce4-eyes-plugin 15) xfce4-fsguard-plugin 16) xfce4-genmon-plugin
17) xfce4-mailwatch-plugin 18) xfce4-mount-plugin 19) xfce4-mpc-plugin
20) xfce4-netload-plugin 21) xfce4-notes-plugin 22) xfce4-notifyd
23) xfce4-pulseaudio-plugin 24) xfce4-screensaver 25) xfce4-screenshooter
26) xfce4-sensors-plugin 27) xfce4-smartbookmark-plugin
28) xfce4-systemload-plugin 29) xfce4-taskmanager
30) xfce4-time-out-plugin 31) xfce4-timer-plugin 32) xfce4-verve-plugin
33) xfce4-wavelan-plugin 34) xfce4-weather-plugin
35) xfce4-whiskermenu-plugin 36) xfce4-xkb-plugin
```
as