Arch Linux Installation Guide Part 2

Jan 26, 2018


In this post, I will continue from my last post and set up my newly installed Arch Linux for daily use. I am going to install some applications that I use on a day to day basis. Some of these applications are required for my current dotfile configuration setup to work properly. The choice of applications is highly opinionated and your preferences might be different.

If you had gone for installation via SSH option, then I would suggest you to edit your sshd_configsshd_config file and disable rootroot login. It can be a security risk otherwise.

Install a terminal based browser

Terminal-based browsers are very handy in cases when you are required to login into a captive portal and you don't have access to a graphical browser. We will install two different browsers, elinkselinks and w3mw3m.

sudo pacman -S elinks w3m
sudo pacman -S elinks w3m

Install X server.

sudo pacman -S xorg
sudo pacman -S xorg

This will install minimal X desktop environment with fonts, in case, you want to test your system before installing any desktop environment.

Enable multilib repository for 32-bit package support

To enable multilib repository, uncomment the [multilib][multilib] section in /etc/pacman.conf/etc/pacman.conf.

[multilib]
Include = /etc/pacman.d/mirrorlist
[multilib]
Include = /etc/pacman.d/mirrorlist

Now upgrade your system.

sudo pacman -Syyu
sudo pacman -Syyu

Install video and touchpad drivers

sudo pacman -S xf86-video-intel xf86-input-synaptics
sudo pacman -S xf86-video-intel xf86-input-synaptics

Install pacaur to fetch and install packages from AUR

sudo pacman -S expac yajl --noconfirm
cd /tmp
gpg --recv-keys --keyserver hkp://pgp.mit.edu:80 1EB2638FF56C0C53
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower
makepkg -i PKGBUILD --noconfirm
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=pacaur
makepkg -i PKGBUILD --noconfirm
cd
sudo pacman -S expac yajl --noconfirm
cd /tmp
gpg --recv-keys --keyserver hkp://pgp.mit.edu:80 1EB2638FF56C0C53
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower
makepkg -i PKGBUILD --noconfirm
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=pacaur
makepkg -i PKGBUILD --noconfirm
cd

Install graphical browsers

pacaur -S firefox chromium
pacaur -S firefox chromium

Install code editors

pacaur -S sublime-text-dev atom-editor-git visual-studio-code-bin neovim neovim-drop-in leafpad
pacaur -S sublime-text-dev atom-editor-git visual-studio-code-bin neovim neovim-drop-in leafpad

Setup LAMP stack

Install Apache server

sudo pacman -S apache
 
# Make your user-directory available to apache server
mkdir ~/public_html
chmod o+x ~
chmod o+x ~/public_html
chmod -R o+r ~/public_html
sudo pacman -S apache
 
# Make your user-directory available to apache server
mkdir ~/public_html
chmod o+x ~
chmod o+x ~/public_html
chmod -R o+r ~/public_html
# To enable virtualhosts, uncomment the following line in `/etc/httpd/conf/httpd.conf`
Include conf/extra/httpd-vhosts.conf
# To enable virtualhosts, uncomment the following line in `/etc/httpd/conf/httpd.conf`
Include conf/extra/httpd-vhosts.conf

Add your virtualhost configuration in following file -

sudo vim /etc/httpd/conf/extra/httpd-vhosts.conf
sudo vim /etc/httpd/conf/extra/httpd-vhosts.conf

To test the virtual hosts on you local machine, add the virtual names to your /etc/hosts/etc/hosts file.

Install PHP

sudo pacman -S php php-apache
sudo pacman -S php php-apache

To use PHP with apache, open /etc/httpd/conf/httpd.conf/etc/httpd/conf/httpd.conf and uncomment following line -

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

and comment out the following line -

# LoadModule mpm_event_module modules/mod_mpm_event.so
# LoadModule mpm_event_module modules/mod_mpm_event.so

Now add these lines to /etc/httpd/conf/httpd.conf/etc/httpd/conf/httpd.conf:

# Add these at the end of `LoadModule` section.
LoadModule php7_module modules/libphp7.so
AddHandler php7-script .php
 
# Place this at the end of the `Include` section:
Include conf/extra/php7_module.conf
# Add these at the end of `LoadModule` section.
LoadModule php7_module modules/libphp7.so
AddHandler php7-script .php
 
# Place this at the end of the `Include` section:
Include conf/extra/php7_module.conf

Install MySQL server

sudo pacman -S mariadb
 
# Initialize the MariaDB data directory prior to starting the service. To do so, run:
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
 
# Then issue the commands to start the database server
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
 
# To apply recommended security settings to your database, run
sudo mysql_secure_installation
sudo pacman -S mariadb
 
# Initialize the MariaDB data directory prior to starting the service. To do so, run:
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
 
# Then issue the commands to start the database server
sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service
 
# To apply recommended security settings to your database, run
sudo mysql_secure_installation

Install PHPMyAdmin

sudo pacman -S phpmyadmin php-mcrypt
sudo pacman -S phpmyadmin php-mcrypt

Enable mysqlimysqli, mcryptmcrypt, zipzip and bz2bz2 extensions in /etc/php/php.ini/etc/php/php.ini.

Create the apache configuration file /etc/httpd/conf/extra/phpmyadmin.conf/etc/httpd/conf/extra/phpmyadmin.conf

Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>

Then include following in /etc/httpd/conf/httpd.conf/etc/httpd/conf/httpd.conf

# phpMyAdmin configuration
Include conf/extra/phpmyadmin.conf
# phpMyAdmin configuration
Include conf/extra/phpmyadmin.conf

Now restart httpdhttpd service to apply settings.

sudo systemctl restart httpd
sudo systemctl restart httpd

Once all these steps are done, your LAMP stack should be working.

Setup power management

Install tlptlp and some of its optional dependencies

sudo pacman -S tlp tlp-rdw bash-completion ethtool lsb-release smartmontools
sudo pacman -S tlp tlp-rdw bash-completion ethtool lsb-release smartmontools

Then enable tlptlp services

sudo systemctl enable tlp.service
sudo systemctl enable tlp-sleep.service
 
# mask some services for tlp to work properly
sudo systemctl mask systemd-rfkill.service
sudo systemctl mask systemd-rfkill.socket
sudo systemctl enable tlp.service
sudo systemctl enable tlp-sleep.service
 
# mask some services for tlp to work properly
sudo systemctl mask systemd-rfkill.service
sudo systemctl mask systemd-rfkill.socket

Install i3 and other tools

All these tools are part of my i3i3 config with exception of the theme related packages. So installing them here will help me later while setting up the i3i3 window manager.

pacaur -S i3 rofi polybar xautolock powerline-fonts-git i3lock-fancy-git compton scrot feh dunst unclutter xfce4-power-manager numlockx lxappearance adapta-gtk-theme gtk-engine-murrine gnome-themes-standard termite
pacaur -S i3 rofi polybar xautolock powerline-fonts-git i3lock-fancy-git compton scrot feh dunst unclutter xfce4-power-manager numlockx lxappearance adapta-gtk-theme gtk-engine-murrine gnome-themes-standard termite

Fix Ugly Fonts 1

Fonts rendering is one area where Linux still lags behind Windows and OSX. It can be a nightmare for users to setup fonts properly in Linux. In Arch Linux, this is even worse. I found some tricks to improve the quality of font rendering on Arch Linux. Though this is far from perfect, it is manageable. Follow these steps on Reddit to fix font rendering. I use Noto Sans, Adobe Source Code Pro, and Microsoft fonts. My apologies, but I can't help here. Some websites still use Microsoft fonts.

Setup Python Environment

I use Python extensively and virtual environments are a must for my development setup. I use pipenvpipenv to manage my virtual environments. To install pipenvpipenv, you need to install virtualenvvirtualenv first. To install it, run the following command.

sudo pacman -S python-virtualenv
sudo pacman -S python-virtualenv

Now you are ready to install pipenvpipenv. Follow here to install the tool.

Install some other common tools

sudo pacman -S vlc openssh npm imagemagick git la-capitaine-icon-theme-git
sudo pacman -S vlc openssh npm imagemagick git la-capitaine-icon-theme-git

Do not forget to setup npmnpm to install packages globally without requiring sudosudo.

That's all! Your system should be in working condition now. Do check out my dotfiles if you want to set up your system like mine.

Hope you enjoyed the article. Cheers 😄

Footnotes

  1. Make your Arch fonts beautiful easily!