TechKeep

Tech tips, tutorials, and more

How to install ArchLinux in seconds

Using this script can save you a lot of time. It goes through all the initial steps automatically, so the only thing you need to do is launch the script and wait until it's done. Get the script, launch the script, done. Here's how.


Article image

Yes, I made an ArchLinux install script. Over time, I found myself having to install ArchLinux on various devices and Virtual Machines a lot for test purposes. Of course, I could've installed it once and then simply cloned it to new devices or VMs, but this was not always ideal. Sometimes, I needed fresh and up-to-date installs.

So, I recently re-made my personal install script which I made available over on TechKeep's GitHub repository and named it "ArchUn".

It only takes a few seconds to download and launch the script with its default settings. With it, performing a basic ArchLinux installation takes around 1 minute (depending on download speeds and hardware performance). The whole process (initial installation and installing a Desktop Environment) takes around 4 or 5 minutes in total. Here's a demo I uploaded to YouTube; it only took under 3 minutes to do a full installation.

A fair warning, however: this script will format and use the whole destination drive (in other words, erase everything), so it's not meant to be used to add ArchLinux as a dual-boot option. Of course, you can always install this first, and then install a dual-boot-friendly operating system afterwards.

Please note that this script is still in an experimental state and will be enhanced over time.

 

Preparing for installation

The first thing you need to do is to grab ArchLinux's latest .iso file from their download page. Once you have that, prepare the installation media of your choice using tools such as etcher or rufus (you do not need to use these tools if you are installing ArchLinux in a Virtual Machine; you only need the .iso file) and boot up the machine with the installation media.

Once you have booted into the installation media and are presented with a command prompt, you can start the process below.

 

Step 1 - Getting the script

     
  1. Type in the following and press ENTER (yes, you also need to include the https://):
  2. curl https://raw.githubusercontent.com/TechKeep/archun/main/archun.sh -o archun.sh
  3. ArchUn is now downloaded.

 

Step 1.2 - Installation Drive

/!\ WARNING: The default settings assume your installation drive is /dev/sda /!\

You can find out the name of the drive you want to use using the following command (the -l is a lowercase L): fdisk -l

Fdisk command output
The output of the fdisk command. I have highlighted what you want to know with a green rectangle.
  • If your drive's name is something other than /dev/sda, please follow the instructions below.
  • If your drive's name IS /dev/sda, you can move directly to "Step 2 - Launching ArchUn".

 

In order to change your installation drive, you must follow these steps:

  1. You can use nano (or any other text editor of your choice) to open the script in text mode:
  2. nano archun.sh
  3. Find the DEFAULTDISK variable within the "User-defined variables" section.
  4. Change /dev/sda to the name your drive uses (which you found out with the fdisk -l command).
  5. If you have an NVMe drive and its name is something like /dev/nvme0n1, pay attention to the comments around the variable.
  6. Once everything is set correctly, save and exit out of the text editor.
    With nano, you need to press CTRL+X, press Y and then press ENTER.

 

Step 2 - Launching ArchUn

(OPTIONAL) If you want to edit any settings, open the script with a text editor (more info at the bottom of the page).

If everything looks fine and you understand that this script will format and use the whole destination drive (which will overwrite and erase everything), you are ready to proceed.

  1. Launch the script:
  2. bash archun.sh
  3. Press 1 and then ENTER to select the option named "I understand".
  4. You will be presented with a detailed menu asking you in which mode you want to proceed. Choose carefully.
  5. You will once again get a few warnings about erasing the whole drive. Press ENTER a few times to accept and proceed.
  6. Once everything is over, you will be asked to create a password.
    This will be the password for the root account.
  7. If you chose to install extras at the beginning, this is when the menu will appear. If not, the script will exit.
  8. Installation complete!

 

Conclusion

The installation is complete. You can now eject your installation media and reboot the machine and be met with GRUB2 (a boot manager), which will allow you to boot into your ArchLinux installation.

If you installed a Desktop Environment, don't forget to select it in the Session Manager before logging in.

Screenshot of Neofetch output in command-line
NEOFETCH was used to display system information in command-line mode.
Desktop Environment selection form
With LXDM, this is located in the bottom left corner.
Screenshot of XFCE4's Desktop Environment
Screenshot of the final result when using XFCE as a Desktop Environment with its default configuration.

 

(OPTIONAL) Changing the default settings

 

  1. This is the list of settings you can edit:
  2. 
    			DEFAULTDISK="/dev/sda"
    			BOOTPARTNUM="1"
    			SWAPPARTNUM="2"
    			ROOTPARTNUM="3"
    			TIMEZONESTRING="America/Toronto"
    			LOCALEGEN="en_CA.UTF-8 UTF-8"
    			LOCALELANG="LANG=en_CA.UTF-8"
    			THEHOSTNAME="arch"
    			BOOTPART="300"
    			SWAPPART="4000"
    			ROOTPART="100"
    			ROOTPARTSIZETYPE="%"
    		
  3. If you want to edit any of these settings, open the script with a text editor:
  4. nano archun.sh
  5. Move to a value that you wish to change within the "User-defined variables" section.
  6. MAKE SURE TO READ THE NOTES AROUND THESE VARIABLES WITHIN THE FILE TO KNOW EXACTLY WHAT THEY DO.
    For this example, we will be changing the default LINUX SWAP value, named SWAPPART. The number is in MiB. The default value for this one is 4000, which is roughly 4GB of SWAP (around 4.19GB). If you want for example 8GB, you would replace this value with 8000, like so:
  7. 
    			# Swap partition size in MiB. Number only.
    			SWAPPART="8000"
    		
    The amount of SWAP you need depends heavily on your use case. A good rule of thumb is to use 4GB or to follow these guidelines:
    • 2x your amount of RAM when you have 2GB of RAM or less,
    • 1x your amount of RAM when you have between 2GB and 8GB of RAM,
    • 0.5x your amount of RAM (minimum 4GB of SWAP) when you have between 8GB and 64GB of RAM,
    • absolute minimum of 4GB of SWAP when you have over 64GB of RAM.
    This is why I used 4GB as a default. Please note that none of these choices have hibernation in mind.
  8. Once you are happy with your settings, save and exit out of the text editor.
    With nano, you need to press CTRL+X, press Y and then press ENTER.
  9. You can carry on with the installation by following "Step 2 - Launching ArchUn".

 

Last edited on April 30 2022