In the next few posts, i will be introducing you and myself to the Arch linux (using command line interface only) and will try to make it a very compact tutorial that concentrates on the basics... however ..
Some necessary introductionLinux is a beloved open-source OS that competes with both market monsters, Microsoft and Apple. There are 2 ways to operate a Linux OS; using a graphical user interface GUI (windows, icons, menus, etc ... the stuff you are familiar with in windows or osx) or using a command line interface CLI (shell). Due to its flexibility and configurability, linux variants include thousands of programs and applications and they are known as Distributions or distro (like Debian, Fedora, Ubuntu, ..etc ) to satisfy all kinds of needs and tastes.
Arch linux is one of these distributions (targets advanced users) that supports community involvement and consists predominantly of free and open-source software, and supports IA-32 and x86-64 architectures.
x86-32 or IA-32 stands for Intel Architecture - 32 bit, sometimes called i386. This refers to the instruction set architecture (ISA) that was first implemented in the intel 80386 microprocessors in the mid 80s.x86-64 on the other hand refers to the 64 bit version of the x86 architecture. By the way: an Instruction Set Architecture is a part of computer architecture that is related to the programing of a microprocessor (data types, registers, addressing modes, instructions , etc)
The 5 important steps: get and install Arch linux
1- Lets go to the archlinux download page and download the latest release in a form of an iso image (about 701 MB in size) then create an Arch linux USB installer drive (LiveUSB) for booting in BIOS and UEFI (another firmware interface for PCs designed to replace the BIOS ). Here is how you create the LiveUSB:
Under Windows: Use a programs like Rufus to create a bootable USB drives (Rufus has an easy and multilingual interface, please check their website for details).
Under OSX: - Insert the USB key and then OSX will mount it automatically.- Go to terminal and type: diskutil list to figure out the USB device name from a list of connected storage devices (usually appear as: disk1, disk2, ..) - Unmount the USB key by typing: diskutil unmountDisk /dev/disk#
- Navigate to the folder where you downloaded the iso image and then type: dd if=image.iso of=/dev/rdisk1 bs=1M
After booting the target computer from the USB key, you are automatically logged in as root.- Finally: diskutil eject /dev/disk# before physical removal of USB key from computer.
2- Now it's time to partition and format the hard drive and we do that using fdisk and/or cfdisk partitioning tools: fdisk -l to list all available storage devices, then: cfdisk /dev/sda to use the partition tool.
(note that cfdisk is similar to fdisk but has a different user interface. cfdisk has the advantage over fdisk in that it's possible to enlarge an extended partition when there is free space after it. )
I suggest that you delete all partitions on the target drive (To delete an existing partition, highlight it with the up and down keys, select the Delete command with the left and right arrow keys, and press Enter) then create a root partition (by selecting the new command.This partition will include most of the disk freespace) and make it of type bootable (by selecting the type command, and using the space bar to toggle between different types). Now create a second partition (a swap partition with 1/2 the size of installed RAM on the PC) and make it of type swap. Finally save/write (write command) and quit fdisk tool.
3- Create the file system on the root partition: mkfs.ext4 /dev/sda1 then mount: mount /dev/sda1 mnt
4- Make a swap file on the swap partition: mkswap /dev/sda2 then utilize it: swapon /dev/sda2
5- Type pcstrap -i /mnt base base-devel to instal arch linux base system and development base system a on the mounted root partition.
*sda1 stands for root partition and sda2 for swap partition.
*The root partition is the disk partition that contains the root file system and on which the root directory is located.
*Swap space in Linux is used if the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space.
Configuring the installation- Now to access the new installed system type: arch-chroot /mnt
- Create a password for the root account by typing: passwd then the actual password after being prompted to do so.
Important setup (locale)
locale in arch linux refere to regional monetary values, time and date formats and other regional standards.- To setup the system locale, type: nano /etc/locale.gen (nano is the name of the text editor tool we use to edit the locale.gen file).
- Uncomment the line referring to your region or country then use CTRL + o to save/write changes, press Enter then CTRL + x to quit.
... #en_SG ISO-8859-1 en_US.UTF-8 UTF-8 #en_US ISO-8859-1 ...- Type locale-gen to generate the locale
- Type : cd /usr/share/zoneinfo to navigate to the time zone settings. Type ls to list the different time zones.
- To confirm the chosen time zone setting type: ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime
- Now we would like to setup a hostname, we do that by typing: echo my_hostname> /etc/hostname
Here we need to have a wired internet connection (Ethernet cable) to our target computer.
Check internet connectivity by pinging google.com for example..
ping -c 3 www.google.com
Installing the Bootloader (grub)
GRUB = GRand Unified Bootloader, a very powerful newish BootLoader that can be used to boot most operating system on the intel platforms. Here think multiboot functionalities :-)
- First we download grub using the arch linux package manager (pacman)
pacman -S grub-bios
then we install it by typing: grub-install /dev/sda
- Now generate the so called INIT files (Initialization files used by grub to load linux).
do that by typing: mkinitcpio -p linux
- Create the grub configuration file: grub-mkconfig -o /boot/grub/grub.cfg
- Exit the current root session.
- Generate fstab file (a configuration file that controls with automating the mounting process of partitions): genfstab /mnt >> /mnt/etc/fstab
- Unmount the Hard drive: umount /mnt
- Reboot (make sure to remove the installation LiveUSB before rebooting)
Another necessary setup (Keyboard layout)
- Type localectl status to view the current keyboard configurations
System Locale: LANG=en_GB.utf8 LC_COLLATE=C VC Keymap: cz-qwertz X11 Layout: cz
- Type localectl list-keymaps | grep -i keyword ( the keyword here could be something like us for United states, ch for Switzerland or de for Germany)
- After finding the right keymap for your keyboard type: localectl set-keymap --no-convert your_keymap
- Finaly load the keymap: loadkeys keymap
Final step (user account)
To create a user account type: useradd -m -G wheel -s /bin/bash user_name
( -m = create a user home directory in /home, -G = introduce a list of groups a user is part of, -s = defines the path- and file-name of the login shell)
Finally secure the new account with a password: type passwd then create the actual password.
Now we are ready to start -linuxing- !