Thursday, March 13, 2014

Arch Linux from Scratch to Compiz Standalone

Arch Linux from Scratch to Compiz Standalone

     In this technical tutorial, I will show you how to install and configure Arch Linux from scratch to use Compiz as a standalone window manager without any desktop environment. I have accomplished this both in VirtualBox and on actual hardware. This howto is assuming you have a basic knowledge of Arch Linux, the pacman package manager, and the AUR. All the commands and details of interest will be highlighted in blue. All commands should be run as root unless otherwise noted.

Let us get started!

Step 1. Install the Arch Linux base system

Pop in the latest Arch Linux disk or USB stick, and start Arch.

If you want to install over SSH, first create a password:

passwd

Then, enable SSH:

systemctl start sshd

And, look up your ip:

ip addr

You should now be able to SSH into the installation.

We'll begin by creating our partitions using cfdisk. Here I'll create the traditional three partitions of root, swap, and home.

Command:

cfdisk

Choose the dos partition table.

Partition your disk to your preferance, I'm using the traditional root/home/swap method.

Delete all existing partitions so there is one block of free space.

For root partition (sda1), select new, primary, size 10000MB, beginning, toggle bootable.

For swap partition (sda2), select new, primary, size 2048MB, end.

For home partition (sda3), select new, primary, size: whatever is left.

Select write, type yes, and quit. We are done creating our partitions.

Now we will make our file systems.

Format root and home to ext4:

mkfs.ext4 /dev/sda1

mkfs.ext4 /dev/sda3

Make a swap file and turn swap on:

mkswap /dev/sda2

swapon /dev/sda2

Now we will mount our root and home partitions:

mount /dev/sda1 /mnt

mkdir /mnt/home

mount /dev/sda3 /mnt/home

Optionally, edit pacman's mirrors with this command:

nano /etc/pacman.d/mirrorlist

And select a mirror from your region. I'm in the USA so I deleted all the mirrors outside my area and kept the top 3 from the US. Using the default mirrorlist without editing works fine too, but may be a little bit slower.

We will now download and install our base system:

pacstrap /mnt base base-devel

Create a file system table:

genfstab /mnt >> /mnt/etc/fstab

Check that fstab was created. We don't want to change anything here, just double checking.

nano /mnt/etc/fstab

We will now chroot into our new system to set it up:

arch-chroot /mnt

Create a root password:

passwd

Set up your time zone and locales:

nano /etc/locale.gen

Uncomment your desired locales, I uncommented these two for the US:

en_US.UTF-8 UTF-8
en_US ISO-8859-1

And now generate the locales:

locale-gen

For the time zone we will make a symbolic link to our zone file using something like this command:

ln -s /usr/share/zoneinfo/<Zone>/<SubZone> /etc/localtime

Replacing Zone and SubZone with your area

As an example, I'm in the US near Chicago so I used this command:

ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime

To see all the available zones, change directory into /usr/share/zoneinfo and have a look.

cd /usr/share/zoneinfo
ls

Set up a hostname:

echo hostname > /etc/hostname

We will now download and install grub:

pacman -S grub-bios

grub-install /dev/sda

Optionally create an initial ramdisk environment using this command:

mkinitcpio -p linux

Now we'll generate our grub configuration:

grub-mkconfig -o /boot/grub/grub.cfg

Type “exit” to leave chroot.

Unmount partitions:

umount /mnt/home

umount /mnt

Congratulations, you have now installed Arch Linux!

Reboot

Step 2. Post Install

Log in as root.

First we'll bring up the network using dhcpcd:

systemctl start dhcpcd

And to enable at boot:

systemctl enable dhcpcd

If you want to continue to work over SSH you'll have to install openssh:
pacman -S openssh

start the SSH server:

systemctl start sshd

And to enable it at every boot:

systemctl enable sshd

Check your ip address:

ip addr

Now we'll add a new user:

useradd -m -g users -G wheel -s /bin/bash username

Create a password for the new user:

passwd username

Now we will configure pacman to enable the multilib and archlinuxfr repositories:

nano /etc/pacman.conf

Uncomment these two lines:

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

And add the following three lines to the bottom of the same file. Save and close.

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

This will enable us to install yaourt, an AUR front end so we can easily install packages from the Arch User Repositories.

Sync pacman and the repositories:

pacman -Syy

And to install yaourt:

pacman -S yaourt

To enable sound we'll setup alsa:

pacman -S alsa-utils

The sound is muted by default so we will un-mute with this command:

alsamixer

Raise the master switch to full.

You may need to configure the sound settings specific to your preference or hardware.

Now we need to install the xorg-server and our video drivers:

pacman -S xorg-server xorg-server-utils xorg-xinit

Amd for 3D support:

pacman -S mesa

Install the video driver for your video card or chipset:

Intel:

Nvidia:

ATI:

Reboot after driver install.

If you are installing in virtualbox use the following commands to start x

sudo pacman -S virtualbox-guest-utils

Then edit this file:

sudo nano /etc/modules-load.d/virtualbox.conf

And add these three lines:

vboxguest
vboxsf
vboxvideo

And to get this to load at boot issue this command:

sudo systemctl enable vboxservice.service

Reboot after driver install.

If your using a laptop you'll want to install the following package to use your mousepad and other tools:

pacman -S xf86-input-synaptics

And finally, some fonts to get us started:

pacman -S ttf-dejavu

Step 3. Install and configure Compiz to work as a standalone window manager.

Here we will need a login manager and a panel with a system tray. I've chosen to use SLiM and the xfce4-panel. We will also install compiz as well as emerald for our window decorations. We will also briefly install the xfce desktop so that we can graphically configure compiz and emerald.

I chose SLiM as our login manager because it uses the ~/.xinitrc file for startup and execution, which is easy to configure.

Install SliM:

pacman -S slim

As a normal user, copy the ~/.xinitrc file to the home directory:

cp /etc/skel/.xinitrc ~

Make it executable:

chmod +x ~/.xinitrc

Enable SliM at boot, as root:

systemctl enable slim.service

Install xfce:

pacman -S xfce4

We will now edit our ~/.xinitrc file to start xfce at boot:
As normal user:

nano ~/.xinitrc

Uncomment: exec startxfce4
Save and close.

Reboot and login to the XFCE environment.

Using yaourt or your AUR frontend of choice, install compiz and it's dependencies from the AUR. Be sure to use yaourt as a normal user.

We will need the following packages from the AUR. Some will be pulled in automatically as dependencies to others. Just make sure you have everything on the list.

ccsm
compiz-bcop
compiz-core
compiz-fusion-plugins-extra
compiz-fusion-plugins-main-genie
compiz-fusion-plugins-unsupported
fusion-icon
libcompizconfig

At some point you may be prompted with this message:
"compiz-fusion-plugins-main-genie and compiz-fusion-plugins-main are in conflict. Remove compiz-fusion-plugins-main?" select yes.

Install emerald and emerald-themes from the AUR to get us started with some window borders.

emerald
emerald-themes

Now to configure compiz.

Open up ccsm (compiz-config-settings-manager) and at the minimum enable:

move windows
resize windows
window decorations

Select the window decorations settings and where it says “command” make sure it says:

emerald --replace

Open up the Emerald theme manager and select a window decoration, then close.

Launch fusion-icon, right click on it and make sure it is set to Compiz as the window manager and Emerald as the window decorator.

Now we will uninstall the XFCE desktop and reinstall just the panel.

pacman -Rsnc xfce4

pacman -S xfce4-panel

And we'll need a terminal:

pacman -S xterm

And finally, we will edit the ~/.xinitrc file to run our panel at boot to execute the fusion-icon, thus starting compiz.

As a normal user:

nano ~/.xinitrc

Comment out the entry: exec startxfce4

And add these two lines to the bottom of the file, in this order:

xfce4-panel &
exec fusion-icon

Save, close, and reboot into your new system.

You should now have compiz running as a standalone window manager. Configure and tweak to your liking!

Note: The background may look like the SliM login screen. You'll have to enable the wallpaper option in ccsm and choose an image.

Thanks for looking!


Comments are welcome