Linux Stuff
Here I will take a few of those things that I work with when doing daily chores with Arch Linux as my daily Operative System.
Items Needed
To be able to install ANY operative system with or without cd/dvd-rom you will need these few components. My choice of style will naturally be Arch Linux, but for the most part, any other will prompt you with a point an click type of installation.
USB/CD/DVD
- A working computer (laptop or desktop)
- Image of Operative system, if you don’t have that easily available
- A usb/External Harddrive/CD/DVD
- Wifi/Ethernet connection
- In the case of installing Arch Linux, we will need to download the image from their website here :
The startup and install of Arch Linux
Preliminary notes:
There are two ways to install a booting and working Arch Linux. In this line-up I will give you the clues for either the legacy or the uefi boot based on what you have to work with. In terms of partitioning the drive available we’ll use cfdisk, by running cfdisk /dev/sd(a,b,c,etc) or cfdisk /dev/mmcblk0 if you have an m.2 drive (usually for newer computers). Lsblk will give you the location of your own harddrive so you don’t accidentally mistype anything:
Legacy boot:
For a legacy boot install, I prefer to separate my boot drive from the root partition. If there is enough space, I add a home partiton as well as a swap if memory is low.
Size | Description |
---|---|
32GB | Example of our harddrive size |
100MB | /dev/sda1: This will be our boot partition. |
15G | dev/sda2: This will be our root directory. To make sure there is enough space for desktop enviroment and software it can be useful to have a minimum of 30 gigs to be on the safe side |
15G | /dev/sda3: This will be our home partition |
2G | /dev/sda4: This will be our swap partition |
UEFI boot:
For an uefi boot install, I prefer to separate my boot drive slightly from the legacy boot as well as the root partition. If there is enough space, I add a home partiton as well as a swap if memory is low.
Size | Description |
---|---|
32GB | Example of our harddrive size |
512MB | /dev/sda1: This will be our efi partition. |
15G | dev/sda2: This will be our root directory. To make sure there is enough space for desktop enviroment and software it can be useful to have a minimum of 30 gigs to be on the safe side |
15G | /dev/sda3: This will be our home partition |
2G | /dev/sda4: This will be our swap partition |
It’s time to make the filesystem for our installation
Legacy Boot
- mkfs.fat /dev/sda1
- mkfs.ext4 /dev/sda2
- mkfs.ext4 /dev/sda3
- mkswap /dev/sda4
- swapon /dev/sda4
UEFI boot:
- mkfs.vfat -F32 /dev/sda1
- mkfs.ext4 /dev/sda2
- mkfs.ext4 /dev/sda3
- mkswap /dev/sda4
- swapon /dev/sda4
Mounting our drive
This goes for both legacy as well as UEFI boot:
- mount /dev/sda2 /mnt
- mkdir /mnt/boot
- mount /dev/sda1 /mnt/boot
- mkdir /mnt/home
- mount /dev/sda3 /mnt/home
‘Now let’s check the mirror list by running nano /etc/pacman.d/mirrorlist
Usually everything in here looks as it should so we could easily run pacstrap -i /mnt base base-devel linux linux-firmware. In many cases you could get away with just installing the base linux linux-firmware, but there are cases where there are developers packages you need so base-devel could be a good idea to install as well
Next up is to create the fstab file for our mounted system so ur system knows where everything is at any time. Genfstab -U -p /mnt » /mnt/etc/fstab helps out the system with this and organizes it for us. To make sure that everything is correct run nano /mnt/etc/fstab.
It’s prepperation time!
Now we’ve reached about half-way through the installation, and we are past the hardest part of the installationg. Now we only need to make a few modifications before we can call it a day. Let us enter the system by typing arch-chroot /mnt and see what our final adjusments should be.
Let’s start off with the the locale’s. nano /etc/locale.gen and enable the suitable locale for you. An commented locale will look like #en_US.UTF-8 #UTF-8 and should be uncommented like en_US.UTF-8 UTF-8 . Now we need to update our locale’s by running locale-gen, and we can change the timezone by typing ln -s /etc/share/zoneinfo/yourtimezone/town /etc/localtime. Additional we’ll update our hardware clock in the same change by hwclock –systohc –utc.
So far, so good
Next up will be setting a hostname for our new system. Echo chosenhostname > /etc/hostname helps us out here, and gives our system it’s recongition it deserves. Now, when we reboot, our system needs to know what kind of boot options we wish to use. To give the hardware it’s pin-points we simply make an initcpio file it can read by typing mkinitcpio -p linux. Now let’s check that everything is fine within the configuration file by typing nano /etc/mkinitcpio. At the same time we can also set the password for root so the system isn’t vulnarable by typing passwd and make sure it is suitable strong
Now for the final stretch for the main installation part before we reboot into our fresh system. Now at this point we need seven additional software items for our legacy boot and eight additional software items for our uefi before we go. For our legacy boot we need to install grub, dialog, iw and wpa_supplicant by typing pacman -S grub dialog iw wpa_supplicant networkmanager nano netctl, and additional efibootmgr for our uefi system by typing pacman -S grub efibootmgr dialog iw wpa_supplicant networkmanager nano netctl. Enable networkmanager by typing systemctl enable networkmanager. Networkmanager is no longer automatically installed, therefore is a needed package to install if one needs to connect to ethernet or wifi. Wifi-menu is no longer automatically ready once everything is installed, so we’ll also need netctl.
Now for installing grub, so our system can boot up properly. For legacy you run the following command grub-install /dev/sda. For uefi you will need to specify more, so we type grub-install –target=x86_64-efi –efi-directory=/boot –bootloader-id=grub –boot-directory=/boot –recheck –debug.No we need to create a configure file for it by typing grub-mkconfig -o /boot/grub/grub.cfg. This goes for both of the systems. Now we exit by simply typing exit. We also need to unmount the paritions we mounted by typing umount /mnt/boot /mnt/home /mnt then restart by typing reboot.
Home stretch
We have now restarted a hopefully succesfull system and logged in as root. Keep in mind, we are only logging in as root temporary so we can add a user as well as giving our new user some root privileges. First off we need to add a new user useradd -m -g users -G wheel -s /bin/bash “username”, add password passwd “username”, before we can have a look at the sudoers file. EDITOR=nano visudo opens up /etc/sudoers.tmp file where we need to locate # %wheel ALL=(ALL) ALL. Uncomment, press ctrl+ to save and ctrl+x to exit. Now you can login as the new user and continue the saga of Arch Linux.
Welcome to the final part of our journey
To be able to have a usable desktop, we need something else then a terminal to look at. If you only have a wifi network available type in sudo wifi-menu and select your wifi with the password to connect to it. In this case we will be utilizing Xfce4, as it has been a desktop of choice for me. We will also need pulseaudio, networkmanager, xorg and lightdm to be able to make it even easier to use. We install it by the following command sudo pacman -S pavucontrol pulseaudio-alsa xorg xorg-xinit xorg-server mesa xfce4 xfce4-goodies lightdm-gtk-greeter lightm-gtk-greeter-settings network-manager-applet. Lightdm is not enabled upon install so we need to enable them by typing sudo systemctl enable lightdm.service. As a last note for this before you reboot, is to install some font’s for you to install two fonts that has worked great for me in my terminals. Type sudo pacman -S ttf-dejavu opendesktop-fonts into the terminal to get these. At this point you can reboot and se how everything falls neatly into place as you’ve done everything just a little bit harder for yourself. Happy “Arch’ing”.