Arch Linux Installation and Post-Install Customization
After using Fedora for 7 years it was time for a change, I wanted something light and fast that also gave me some geeky feeling. Then came Arch Linux, it has awesome installer, has no boaltware, and its all about DIY. So here goes my arch linux lnstallation and post-install customization procedure
Arch Linux Wiki has a good documentation on its installation. Found Here.
1. Pre-Installation Preparation
It all starts with downloading the ISO and creating a bootable media
sudo dd if=/path_to_arch_.iso of=/dev/sdX
Now that you have the media, you need working Ethernet connection, you can use wireless if you can configure WPA2 and connect from terminal. I just took the easy way with ethernet. Note: you can also download the files and use from USB, Check it in wiki Here. However without working internet connection, you won’t just feel the benifits of Arch Linux.
You can test your connection by running
ping -c 3 www.smjrifle.net
2. Get those Partitions Ready
Next Step is to prepare your partition, you can create partition from other linux distribution and use it here, however since I missed geekiness of connecting wireless connection, I had to do this.
Note: If you are booting from CD, your hard disk is sda, if your booting from USB, it can be sdb or sdc.
you can check your Partitions using
fdisk -l
or
cfdisk /dev/sda
which gives bit graphical outlook to select/create partitions.
Now once, you have the partitions ready lets format it. Remember the partition numbers, you want for root and swap. Run these commands individually,
$mkfs.ext4 /dev/sda1 mkswap /dev/sda2 swapon /dev/sda2
3. Time to install the base system
Lets mount your root partition,
mount /dev/sda1 /mnt
Lets install the base and developer’s packages now
pacstrap -i /mnt base base-devel
Important: Run the command below only once even if it gives error
genfstab -U -p /mnt >> /mnt/etc/fstab
Now check if the fstab has the correct partition, else you won’t boot. I ran into problems while using vi/vim so I am using nano. You can Save by pressing ctrl+x; Press Y to save or N to Discard then pres enter.
nano /mnt/etc/fstab
Finally, its time to login to your system eh! 😀
arch-chroot /mnt
4. Language and location settings
With Arch linux you do everything youself in geeky way.
Run
nano /etc/locale.gen
It will open huge list of locals, uncomment the one you need by removing ‘#’ infront, if your english uncomment [en_US.UTF-8 UTF-8]
Now set the locale, by running these commands.individuallyy,
locale-gen echo LANG=en_US.UTF-8 > /etc/locale.conf export LANG=en_US.UTF-8
Now configure the timezone, you can find zone and subzone by running
ls /usr/share/zoneinfo and
ls /usr/share/zoneinfo/YOUR_ZONE
mine was Asia/Kathmandu
Configure the clock by running
ln -s /usr/share/zoneinfo/{Zone}/{SubZone} /etc/localtime
Configure the hardware clock by running
hwclock –systohc –utc
Configuring the Repos
You can configure repos by editing pacman.conf to do so run
nano /etc/pacman.conf
If you are using 64 bit system you should go ahead and enable (un-comment) the ‘multilib’ repo:
[multilib] Include = /etc/pacman.d/mirrorlist
Update the repos by running
pacman -Sy
5. Create users and password
Root Password is empty by default, set the root password by running
passwd
Now create user to access the system by running
useradd -m -g users -G group_name,storage,power -s /bin/bash your_username
Add password for user by running
passwd your_username
Now we need to add the user to list of sudoer’s, that is allow it to perform administrative tasks.
First Install Sudo, yes you need to install that too 🙂
pacman -S sudo
pacman -Ss sudo
Now allowing user of group_name to perform administrative tasks
run
EDITOR=nano visudo
Uncomment
%wheel ALL=(ALL) ALL
by removing ‘#’
Bonus: Install Bash completion package to auto complete commands by running
$pacman -S bash-completion
6. Install boot loader
Run the following commands, individually
pacman -S grub-bios
grub-install --target=i386-pc --recheck /dev/sda
cp /usr/share/locale/en@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
If you are dual booting, have other os like other linux or crappy Wee-n-Dows you need OS Prober, run
pacman -S os-prober
Now Run the grub config to create grub Bootloader file
grub-mkconfig -o /boot/grub/grub.cfg
Finishing Installation
Now exit, run [$exit]
Unmount fs and reboot by running these
<
umount /mnt $reboot
7. Booting into your new Arch system
Now remove your USB/CD and the Arch Linux Boots into commandLine. You won’t have internet. So you need to connect to internet manually.
Run
ip link
to find out your network card name, it can be something like “enp4s0”
Enable and start your network by running
sudo systemctl enable dhcpcd@.service
sudo systemctl start dhcpcd@{interface}.service
where {interface} is your network card name;
Test your connection by running
ping -c 3 www.smjrifle.net
8. Installing X – “The graphical Display”
All you have seen till now is a black window with white font, now let’s bless those eyes with some GUI. To test if everything is working lets install the X by running
sudo pacman -S xorg-server xorg-xinit xorg-server-utils
Also install mesa for 3D support
pacman -S mesa
You need to Install your graphics driver, be careful what you select. You can refer to Arch Wiki Here.
All Almost done, now some input drivers, especially touchpad for Laptops
Run
pacman -S xf86-input-synaptics
Now for test default desktop environment
pacman -S xorg-twm xorg-xclock xterm
now boot into graphics by running
startx
If everything is fine you will see windows, you can type exit in terminal to exit the desktop and continue to install preferred Desktop Environment. If you get blank screen, reboot and run the following command.
grep EE /var/log/Xorg.0.log
It will show what errors have occured, check if it gives any graphics driver error if so remove what you installed and install the driver specified there and test again.
9. Getting your favourite Desktop Environment
I recommend you install Gamin first then you install the desktop environments.
pacman -S gamin
You can now install any desktop environment: Gnome, KDE, Cinnamon. I will install LXDE for me by running. You can install multiple too.
sudo pacman -S lxde
Here are the list of supported desktop environment. Click Me.
you can run
sudo pacman -S desktop_environment_code
The code are small case names in wiki to the right of URL’s of Desktop Environment.
Now install a display Server, GDM for Gnome Based, KDM for KDE Based I installed LXDM for me.
sudo -S lxdm
Then enable and start the service
systemctl enable lxdm.service
systemctl start lxdm.service
I had to run the following command to get my Display Server booted up at startup
echo 'exec ck-launch-session dbus-launch startlxde'> ~/.xinitrc
It consists of startlxde, different desktop environment might have different thing, however it might not be necessary for KDM or GDM.
Now reboot 🙂 You will be presented with login Screen. Login and get ready for Post Installation customization.
10. Post-Installation Customization
When you have booted to the desktop, you will notice it lacks many applications. Lets install them using pacman (<
Some apps are available from AUR. Bookmark this link Arch User Repository
Pacman options:
-S Sync/Install
-R Remove
-U Update
-Ss search
I recommend you start with wget
wget:
pacman -S wget
Git:
pacman -S git
Mercurial/hg:
pacman -S mercurial
Flash Plugin:
pacman -S flashplugin
Zip, 7z: pacman -S p7zip unrar zip
SSH:
pacman -S ssh
Archive Manager:
pacman -S file-roller
Filezilla:
pacman -S filezilla
Gparted:
pacman -S gparted
Gimp:
pacman -S gimp
VLC:
pacman -S vlc
mplayer:
pacman -S mplayer
RhythmBox:
pacman -S rhythmbox
Totem Video Player:
pacman -S totem
Firefox:
pacman -S firefox
ThunderBird:
pacman -S thunderbird
Opera:
pacman -S opera
Chromium:
pacman -S chromium
Transmission:
pacman -S transmission-gtk transmission-cli
Chrome:
wget https://aur.archlinux.org/packages/go/google-chrome/google-chrome.tar.gz tar -xvf google-chrome.tar.gz cd google-chrome makepkg -si -skipinteg
Gedit:
pacman -S gedit
Geany:
pacman -S geany
Sublime: [Go the download page of Sublime and download
tar -xvf "Sublime Text 2.0.2.tar.bz2" Note: the 2.0.2 maybe different in your case. mv Sublime Text 2 /opt ln -s /opt/Sublime Text 2/sublime_text /usr/bin/sublime sublime /usr/share/applications/sublime.desktop sublime /usr/share/applications/defaults.list sudo chown -R root:root "/root/.config/sublime-text-2"
Acrobat Reader:
wget https://aur.archlinux.org/packages/ac/acroread/acroread.tar.gz tar -xvf acroread.tar.gz $cd acroread/ $makepkg -s -i
Apache:
sudo pacman -S apache
Open config File
sudo gedit /etc/httpd/conf/httpd.conf Comment out this line #LoadModule unique_id_module modules/mod_unique_id.so
Mysql:
sudo pacman -S mysql sudo systemctl start mysqld sudo mysql_secure_installation sudo systemctl restart mysqld
PHP:
sudo pacman -S php php-apache
Add php to httpd conf open
sudo gedit /etc/httpd/conf/httpd.conf
Paste the following
# Use for PHP 5.x: LoadModule php5_module modules/libphp5.so AddHandler php5-script php Include conf/extra/php5_module.conf
sudo systemctl restart httpd
Uncomment mysql in php.ini, open php.ini
sudo gedit /etc/php/php.ini
Uncomment the following lines(remove ‘;’)
extension=mysql.so extension=mysql.so
Start php and mysql at startup, Run
sudo systemctl enable mysqld httpd
True Type Font:
pacman -S ttf-dejavu
11. Some Trouble Shooting
Network Manager
If you cannot connect to wirelessor find Network Manager, then
//Enable Wireless
pacman -S wireless_tools
For GNOME/Xfce/LXDE users:
If you’ve installed GNOME, Xfce or LXDE as your preferred desktop environment during the initial Arch Linux installation, you will have to execute the following commands in a Terminal, one by one, hitting Enter after each one:
sudo pacman -S network-manager-applet sudo systemctl enable NetworkManager $sudo systemctl start NetworkManager
If you’ve used another GNOME-based operating system before, you probably know that NetworkManager is the default and only network management application for the GNOME desktop environment.
It is installed by default in Arch Linux, but for some reason, it is not enabled. This is what we do with the above commands. That’s it! You’ll see the NetworkManager Applet icon in the tray area, from where you can connect to your wireless network.
For KDE users:
If you’ve installed KDE as your preferred desktop environment during the initial Arch Linux installation, you will have to execute the following commands in a Terminal, one by one, hitting Enter after each one:
[$sudo pacman -S kdeplasma-applets-networkmanagement]
[$sudo systemctl enable NetworkManager]
[$sudo systemctl start NetworkManager]
[$sudo systemctl disable dhcpd.service]
If you enabled or installed another service, in my case netctl make sure you uninstall it in order to use Network Manager.
Mounting NTFS
Install ntfs-3g by
pacman -S ntfs-3g
Then follow this post
Fix Heating Issues/Switchable Graphics
Follow this post