Welcome to my Arch Linux post-installation tutorial! Here, I'm going to teach you how to setup and build your own personalized desktop with Arch Linux. And also, in this tutorial we are going to setup Arch Linux Core (on a desktop) with:
LXDE: A lightweight desktop environment for Linux. There are other DEs to choose from (e.g. Gnome, KDE, XFCE, etc.) but for this tutorial we are going to use LXDE.
Openbox: Openbox is an opensource and light-weight window manager for Unix/Linux system.
SLiM: Or Simple Login Manager, is also a lightweight login manager for Linux.
This is quite a long process so please bear with me. I've grouped the whole installation process into 3 stages, provided 1 stage for the configuration, and I've also provided some sample configuration files at the end of the tutorial.
STAGE 1: Modifying Mirrorlist and Installing Input Drivers
Before we go any further, first we need to make sure that we are connected to the Internet. To do that we are going to use the ping command. In TTY just type:
# ping -c 3 yahoo.com
This should return 3 ping results with 0% packet lost.
NOTE: In case ping did not return any result, you can fix this problem and make a connection by simply typing this command:
# dhcpcd eth0
After we've made sure that we are connected to the Internet, we will now refresh and sync our Arch repository and then update the system. To do that, just type this simple command:
# pacman -Syu
Initialize Pacman Keyring
Pacman-Key is a new tool available with pacman 4.0. Based on Arch Linux wiki, “Package signing in pacman uses the "web of trust" model to ensure that packages come from the developers and not from someone impersonating them. Package developers and TUs have individual PGP keys which they use to sign their packages. This signature means they vouch for the contents of the package. You also have a unique PGP key which is generated when you set up pacman-key.”
To initialize and setup pacman keyring, simply type:
# pacman-key --init
You may want to move to another TTY and run:
# cat /dev/urandom
This would help generate more random bytes for generating pacman keychain.
Modify Mirrorlist File
Now, we need to make some simple modifications with our mirrorlist file (/etc/pacman.d/mirrorlist). This is very important since a little misconfiguration on this file may slow down the entire installation process, or worst, keep us from installing anything.
Be default, the mirrorlist file consists of dozens of links to the mirrors available for Arch Linux repository. What we're going to do here is modify this list, select the fastest in terms of download speed and make it more cleaner, so to speak. Before we do that we need to install a very important tool for this job called reflector. In your TTY, just type:
# pacman -S reflector
After you have installed reflector, backup your mirrorlist file by running this command:
# cd /etc/pacman.d
# cp mirrorlist mirrorlist.backup
Then using reflector, modify your mirrorlist by typing:
# reflector -c %own% -f 6 > mirrorlist
The '-f 6' option means to get the 6 fastest mirrors close to your country (-c %own%). Again, don't forget to sync and update your system after you finished modifying your mirrorlist:
# pacman -Syu
I strongly suggest you reboot after this second update. Just type:
Now we are going to install important input drivers along with othe important tools. Please note that installing drivers varies from system to system. In case you are installing on a laptop, there may be some other different drivers that you need to install. Same is true for so many different types of hardware installed in your computer. And since we are installing Arch on a desktop, basically, these are the drivers that need to install – just all the simple stuff.
To install input drivers, just type:
# pacman -S xf86-input-evdev alsa-plugins alsa-utils pulseaudio mesa mesa-demos libgl dbus consolekit
Now here in the second stage of the installation process, we are going to create a sudoer or a regular user. This adds up to your security since running your system as root may cause some security risk. And by the end of this stage we are also going to install X.
Before we can start creating a sudoer, first we need to install sudo. By using the sudo command, a regular user can run programs that needs root priviledges as if he is root.
To install sudo, just type:
# pacman -S sudo
Creating A Sudoer
Creating a sudoer or regular user in Linux is very simple. We can do this by using the useradd command. Simply type:
# useradd -m -g users -G audio,lp,optical,storage,power,video,games, network,wheel -s /bin/bash pedro
After you're done creating a sudoer, in this case, the sudoer's username is 'pedro' we will now create a password for pedro. And we're going to do that using the passwd command. To add a password to pedro, just type:
# passwd pedro
(You will be asked to enter the password twice to confirm it)
After we have created a sudoer, we need to edit the sudoer file, so that a regular user would be able to run programs that needs root priviledge. If you did not edit the sudoer file, running programs as root, would be virtually impossible. And since the sudoer file is a very sensitive file. We are going to edit it using the visudo command, which would lock the sudoer file for simultaneous edit providing basic sanity check, and preventing parse error. This way we can edit the sudoer file in a safer way.
To use and run the command, just type:
# EDITOR=nano visudo
Now, we can edit the sudoer file – with the help of visudo – using the nano editor.
NOTE: As you can see with the useradd command above, we have also added our username pedro to the wheel group, which group we can see inside the sudoer file.
To enable regulars users to run programs as root using sudo, simply uncommenting the 'wheel' group would do the trick. After uncommenting, the line should now look like this:
%wheel ALL=(ALL) ALL
Optionally, you can also uncomment the line '# %wheel ALL=(ALL) NOPASSWD: ALL', if you don't want to enter you password everytime you use sudo. I personally prefer uncommenting this line as well :)
Installing X (Xorg Server)
Now, we are going to install X. For more information about X, please visit this link.
To install X, simply type and run this command:
# pacman -S xorg xorg-server xorg-xinit xorg-utils xorg-server-utils xorg-twm xterm xorg-xclock
When asked to enter a selection, just enter all for default.
After you have installed X, we can now run a simple test to see if we have installed it successfully. To do that just type in this simple command:
If you see something like the image below, then you have successfully installed X Server, which means we can now continue and install some graphical interface to our system. Just type 'exit' to the xterms you below to exit X.
STAGE 3: Installing A Graphical Environment (GUI) and Other Important Plugins
Now we've come to the fun part – installing graphical user interface such as LXDE or Linux X11 Desktop Environment.
Please note that by installing LXDE, we also install other programs that's part of the LXDE package such as, gpicview, lxappearance, lxpanel, lxtask, lxterminal, openbox, pcmanfm and some others. For more information about LXDE, you can visit their website at http://lxde.org/lxde.
To install LXDE, along with other tools that we needed to setup our desktop environment, simply type and run this command:
# pacman -S lxde tint2 nitrogen volwheel xcompmgr networkmanager network-manager-applet gvfs gfvs-afc autofs
After you have successfully installed the LXDE package and the other tools, it's time to test our new desktop environment, but first we need to switch form root to pedro, which is our regular user, to do that, just type:
# su – pedro
Since you are root before you switch to pedro, you dont have to enter you password to do this.
Now, to go to your LXDE desktop, just type:
$ xinit startlxde
If you have installed LXDE successfully, you should be able to see something like the image below:
The image above is currently the default LXDE interface. LXDE desktop itself is lightweight but there is one interface that's even more lightweight and fortunately, it's part of the LXDE package – the Openbox.
To see and experience the Openbox interface, you need to run the openbox-session, but first you need to logout from the LXDE desktop interface. Then in your TTY type:
$ xinit /usr/bin/openbox-session
You should be able to see the empty darkgray canvass-like Openbox desktop with nothing but a simple openbox menu template that you can see when you right-click on it.
Since our newly build openbox desktop is nothing but an empty canvas at the moment, we are going to perform some configuration to make it look more elegant. Just like an artist painting to a blank canvas. We are going install and automate some tools and we are also going to install a login manager called SLiM a little later at the end.
And since we are building for an Openbox desktop, we are going to install some tools that we need to properly configure openbox. In your empty desktop, right-click to open the default openbox menu. Most of the items listed on this menu could only take you to a dead end. But that's alright, for now, we're also going to fix that later.
Before we start our system configuration, we need to prepare some config files for openbox and for pcmanfm, which is the default file manager for LXDE. Right-click your Openbox desktop to see the menu, then click Terminals → Xterm to launch the Xterm terminal emulator.
For the Openbox configs, simply run the following commands (please note that the following command lines should be run as a regular user and NOT as root, or else you might end up experiencing some permission issues):
$ mkdir -p ~/.config/openbox
$ cp /etc/xdg/openbox/* ~/.config/openbox
And for the pcmanfm file manager config:
$ sudo mkdir -p /usr/share/lxde/pcmanfm
$ sudo cp -a /etc/xdg/pcmanfm/default/pcmanfm.conf /usr/share/lxde/pcmanfm/pcmanfm.conf
Now, we are going to install some openbox tools that we need. Just type:
$ sudo pacman -S obmenu obconf openbox-themes obtheme pyxdg
After you have installed these tools, we can now start by configuring your openbox menu. Again in Xterm, just type:
This would launch the openbox GUI menu editor (just like your see in the image below).
Now, what we're going to do here, is basically, remove all the default menu items listed in our menu.xml file, and then recreate menu items from scratch. This way we can create menu items, that's really needed for our setup - nothing more.
Here we have added one item in the openbox menu, and we named it Terminal, which would execute a more configurable terminal emulator that is also part of the LXDE package. So next time, instead of using Xterm, we are going to use LXDE's default terminal emulator – lxterminal.
Now right-click and open your very own openbox menu, then click Terminal to launch lxterminal. Here we are going to install some plugins and codecs for mp3, dvd, other multimedia, etc. To do that, just type:
$ sudo pacman -S alsa-oss libdvdread libdvdcss gecko-mediaplayer xine-lib xine-ui flashplugin java-runtime leafpad
$ sudo pacman -S ttf-dejavu ttf-ubuntu-font-family
tint2 is a very simple, very configurable and lightweight system panel for Linux. To enable tint2 via terminal, just type:
$ tint2 &
You can automatically run tint2 at startup by adding this line:
to your autostart (~/.config/openbox/autostart) file. Please refer below for the complete initial configuration for our openbox autostart file.
Nitrogen is a fast and lightweight desktop background browser and setter for X windows. To start nitrogen and place a good looking background for your desktop using your terminal just type:
For this, you may want to download some images first using a web browser. To install firefox browser, just type:
$ sudo pacman -S firefox
After you have created a desktop background, you can automatically run nitrogen at startup and restore your background image by adding this line to your autostart file:
nitrogen --restore &
VolWheel is a simple tool that place an icon in your system tray. It's used to adjust the sound of your default sound server. Before we can start volwheel, first we need to start alsa which is currently disable. To enable alsa, just type in your terminal:
$ sudo rc.d start alsa
Then include alsa in the daemons line of your rc.conf file (/etc/rc.conf) to automatically run alsa at startup.
Then setup your asound.state file using the alsactl command. To do that, just run this simple command:
$ sudo alsactl -f /var/lib/alsa/asound.start store
This command will generate a file called asound.state file, which will restore your previous sound settings at startup.
After that, we can now start and run volwheel in your system tray. In your terminal, just type:
$ volwheel &
You can also add this same line of command (without the $ sign of course) in your autostart file to automatically run volwheel at start-up.
nm-applet (Network Manager Applet)
nm-applet is the simple tray icon that indicates your network connections. Before we start nm-applet, first we need to start network manager. To do that just type:
$ sudo rc.d start networkmanager
You also need to include networkmanager right before network, in the daemons line of your rc.conf file.
Then you can start nm-applet by typing:
$ nm-applet &
Running this command my not run your network icon the way it should right away. It's alright, to fix that and to automate nm-applet at startup, simply add this line at the top of your autostart file:
(sleep 3 && /usr/bin/nm-applet --sm-disable) &
On your next startup, network manager icon should now run the way it should.
Xcompmgr is a simple composite manager, capable of rendering dropdown shadows and window transparency. You can start xcompmgr using the terminal by typing:
$ xcompmgr -CcfF &
or adding the exact same line (without the $ sign) to your autostart file to automate dropdown shadows and transparency at start up.
SLiM or Simple Login Manager is a simple and lightweight login manager for Linux. To install SLiM, along with some slim theme packages, just type:
$ sudo pacman -S slim archlinux-themes-slim slim-themes
Before you can run slim, you need to edit the slim.conf config file (/etc/slim.conf). Please refer to the final slim.conf file below. You can automate SLiM by adding it to your rc.conf's daemons line.
NOTE: Make sure the your login manager, such as SLiM, is located at the end of your daemons line, to prevent some unnecessary boot-up problems.
After you have finished configuring your slim.conf file and adding it to your rc.conf's daemons line – reboot!
After you reboot, you should be able to SLiM automatically.
SAMPLE CONFIGURATION FILES
(sleep 3 && /usr/bin/nm-applet --sm-disable) &
nitrogen --restore &
if which tint2 >/dev/null 2>&1; then
(sleep 2 && xcompmgr -CcfF) &
(sleep 2 && tint2) &
exec ck-launch-session dbus-launch
exec lxsession -e LXDE -d openbox-session -a
By default your rc.conf's file DAEMONS line looks like this:
DAEMONS=(hwclock syslog-ng network netfs crond)
After we have setup up everything, your DEAMONS line should now look exactly like this:
DAEMONS=(dbus hwclock syslog-ng networkmanager !network netfs crond autofs @alsa slim)
The apostrophe (!) before the network means it's been disabled, we do this because since we already have put networkmanager there which now would handle all the network stuff. The at-sign by the way before alsa means alsa would be run at the background.
The following is the configured slim.conf file. Highlighted in red are the lines I've edited and uncommented.
# Path, X server and arguments (if needed)
# Note: -xauth $authfile is automatically appended
xserver_arguments -nolisten tcp vt07
# Commands for halt, login, etc.
halt_cmd /sbin/shutdown -h 0
console_cmd /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -c "/bin/cat /etc/issue; exec /bin/login"
# Full path to the xauth binary
# Xauth file for server
# Activate numlock when slim starts. Valid values: on|off
# Hide the mouse cursor (note: does not work with some WMs).
# Valid values: true|false
# This command is executed after a succesful login.
# you can place the %session and %theme variables
# to handle launching of specific commands in .xinitrc
# depending of chosen session and slim theme
# NOTE: if your system does not have bash you need
# to adjust the command according to your preferred shell,
# i.e. for freebsd use:
# login_cmd exec /bin/sh - ~/.xinitrc %session
#login_cmd exec /bin/bash -login ~/.xinitrc %session
login_cmd exec ck-launch-session dbus-launch openbox-session
# Commands executed when starting and exiting a session.
# They can be used for registering a X11 session with
# sessreg. You can use the %user variable
# sessionstart_cmd some command
# sessionstop_cmd some command
# Start in daemon mode. Valid values: yes | no
# Note that this can be overriden by the command line
# options "-d" and "-nodaemon"
# Available sessions (first one is the default).
# The current chosen session name is replaced in the login_cmd
# above, so your login command can handle different sessions.
# see the xinitrc.sample file shipped with slim sources
# Executed when pressing F11 (requires imagemagick)
screenshot_cmd import -window root /slim.png
# welcome message. Available variables: %host, %domain
welcome_msg Welcome to %host
# Session message. Prepended to the session name when pressing F1
# session_msg Session:
# shutdown / reboot messages
shutdown_msg The system is halting...
reboot_msg The system is rebooting...
# default user, leave blank or remove this line
# for avoid pre-loading the username.
# Focus the password field on start when default_user is set
# Set to "yes" to enable this feature
# Automatically login the default user (without entering
# the password. Set to "yes" to enable this feature
# current theme, use comma separated list to specify a set to
# randomly choose from
# Lock file
# Log file
That's about it! If you have any questions about this tutorial, you can send me a message at goldenfinch.net(at)gmail(dot)com