Skip to content

Instantly share code, notes, and snippets.

@aeswibon
Last active June 25, 2025 15:02
Show Gist options
  • Select an option

  • Save aeswibon/2ce2562d1e56412464fca70ed0323579 to your computer and use it in GitHub Desktop.

Select an option

Save aeswibon/2ce2562d1e56412464fca70ed0323579 to your computer and use it in GitHub Desktop.
Linux Installation and Uninstallation

Linux

Steps to dual-boot Arch Linux

Note: If you don't know about package settings, google it or simply accept defaults.

  1. Internet Configuration

    • Using WiFi

      # unblock the wifi
      rfkill unblock wifi
      
      # show all the wifi device list
      iwctl device list
      
      # assuming wifi device: wlan0
      # scan all the wifi networks
      iwctl station wlan0 scan
      
      # get a list of all wifi networks
      iwctl station wlan0 get-networks
      
      # connect to the network
      iwctl --passphrase <passphrase> station wlan0 connect SSID
    # check whether internet is active
    ping google.com
    
    # if there is output then press Ctrl + c to exit the command.

    Note: If the internet is connected then proceed to next step otherwise check the manual

  2. Disk Setup

    • Partitioning

      # list all the connected drives
      lsblk
      
      # go to partition table of your selected disk (let's assume selected disk is nvme0n1)
      cfdisk /dev/nvme0n1
      
      # memorize the EFI System partition device(here we will install grub)
      # if you want to install on exisiting partition then skip it
      # if there is free space then create a new partition by selecting [New] from keyboard and writing the partition size
      # then select [Write] option, type yes and then select [Quit]
      
    • Formatting

      # format the partition(assuming partition: nvme0n1p5) where you want to install Arch
      mkfs.ext4 /dev/nvme0n1p5
    • Mounting

      # mount the disk partition
      mount /dev/nvme0n1p5 /mnt
      
      # make a boot directory to install grub
      mkdir /mnt/boot
      
      # mount the EFI partition(assuming partition: nvme0n1p2) in the boot directory
      mount /dev/nvme0n1p2 /mnt/boot
  3. Base Install

    # install the base system
    pacstrap /mnt base linux linux-firmware vim
    
    # install nano if you don't know how to use vim and change vim to nano in coming  steps
  4. FSTAB file

    # create fstab file
    genfstab -U /mnt >> /mnt/etc/fstab
    
    # check if all the disks have been mounted
    cat /mnt/etc/fstab
  5. Enter install and SWAP File

    # enter in root mode
    arch-chroot /mnt
    
    # allocate space to swap file (assuming size: 2GB, name: swapfile)
    fallocate -l 2GB /swapfile
    
    # change the permission of swap file so it can be read
    chmod 600 /swapfile
    
    # create a swap file
    mkswap /swapfile
    
    # activate the swap file
    swapon swapfile
    
    # put the swap file in fstab file
    vim /etc/fstab
    
    # type this content
    /swapfile none swap defaults 0 0
    
    # save and exit the editor
  6. Time Zone

    # select your timezone(assuming timezone: Europe/Zurich)
    ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime
    
    # synchronise hardware clock to system clock
    hwclock --systohc
  7. Locales

    # select your locale
    vim /etc/locale.gen
    
    # uncomment your desired locale(assuming locale: en_US)
    # uncomment en_US.UTF-8 UTF-8
    
    # save and exit the editor
    
    # generate the locale
    locale-gen
    
    # edit the locale.conf
    vim /etc/locale.conf
    
    # type the locale that you uncommented
    LANG=en_US.UTF-8
    
    # save and exit the editor
  8. Hostname, Hosts file and Root password

    # open the hostname file
    vim /etc/hostname
    
    # type the hostname (assuming hostname: arch)
    arch
    # save and exit the editor
    
    # open the hosts file
    vim /etc/hosts
    
    # type the text
    # for spacing between words, use tabs(convention)
    # replace arch with your hostname
    127.0.0.1 localhost
    ::1 localhost
    127.0.1.1 arch.localdomain arch
    # save and exit the editor
    
    # create a root password
    passwd
    
    # now type the password and confirm the password
  9. Boot loader

    # install important pacakages
    pacman -S grub efibootmgr networkmanager network-manager-applet dialog wireless_tools wpa_supplicant os-prober mtools dosfstools base-devel linux-headers-$(uname -r) ntfs-3g
    # accept all the defaults value
    
    # install grub
    grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
    
    # create windows directory and mount here (assuming windows partition: nvme0n1p4)
    mkdir /mnt/windows
    mount /dev/nvme0n1p4 /mnt/windows
    
    # by default os-prober is disable. to enable it open the config file
    vim /etc/default/grub
    
    # add or uncomment GRUB_DISABLE_OS_PROBER=false
    # save and exit the editor
    
    # generate grub config file
    grub-mkconfig -o /boot/grub/grub.cfg

    Note: Choose which bootloader you need to install. Choose which linux headers to install

    # uname -r
    uname -r
    
    # make sure to install same headers as system's kernel headers
    # to check headers you installed
    pacman -Q | grep headers
  10. Exit install, Unmount and Reboot

    # exit the root partition
    exit
    
    # unmount all the partition
    umount -a
    uname -r
    
    reboot

    Note: After Reboot, we will be able to see the bootloader with option boot to arch linux and boot to windows. Boot into Arch linux and if there is some error then google the error from the log file which can be accessed through the command mentioned there.

  11. Activate Internet

    # start the newtwork manager
    systemctl start NetworkManager
    
    # open the newtork client
    nmtui
    # select the wifi network and connect to it
    
    # enable network manager by default on boot
    systemctl enable NetworkManager
  12. New user

    # create new user (assuming username: admin)
    useradd -m -G wheel admin
    
    # create a password for the user
    passwd admin
    # type and confirm the password
    
    # give user sudo powers
    EDITOR=vim visudo
    
    # uncomment the line  %wheel ALL=(ALL) ALL
    # save and exit the editor
  13. Graphics Driver, Display Manager

    # install graphics driver
    # for intel
    pacman -S xf86-video-intel
    
    # for amd
    pacman -S xf86-video-amdgpu
    
    # for nvidia
    pacman -S nvidia nvidia-utils
    
    # install display server (accpet default)
    pacman -S xorg
    
    # install display manager
    # for gnome
    pacman -S gdm
    systemctl enable gdm
    pacman -S gnome gnome-extra
    
    # for kde
    pacman -S sddm
    systemctl enable sddm
    pacman -S plasma kde-applications xdg-user-dirs packagekit-qt5

    Note: Select your own display manager

Steps to delete the firmware

# open the cmd in admin mode
# list all the firmware
bcdedit /enum firmware

# select the identifier of the linux which you want to delete and then delete the firmware
bcdedit /delete <identifier>

Warning: Make sure the identifier is selected properly because it will mess up the boot order if done wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment