среда, 26 июня 2013 г.

Arch Linux with Awesome wm

Weeks ago i've switched from Ubuntu to Arch Linux. Why? I don't want to depend from some commercialized way of Ubuntu, also close to me Arch principles "... elegance, code correctness, minimalism, and simplicity ..." (see https://en.wikipedia.org/wiki/Arch_Linux and https://en.wikipedia.org/wiki/KISS_principle). Why not gentoo? ha,ha, it is to hardcore for me. Arch has a very useful wiki. You could start from this guide.

Let's try to install Arch with Awesome window manager.

WARN: Please try it on Virtual machine first.

Installing base system

1. Create bootable USB (https://wiki.archlinux.org/index.php/USB_Installation_Media)



wget http://mirror.yandex.ru/archlinux/iso/2013.06.01/archlinux-2013.06.01-dual.iso
dd bs=4M if=archlinux-2013.06.01-dual.iso of=/dev/sdx

Where "/dev/sdx" NOT mounted USB stick.

2. Boot from this stick. It prompts you into root console.

3. Partitioning with LVM.

Use "lsblk" to find target block device (i.e. /dev/sda). I prefer fdisk for partitioning. Command below will create two partitions (200M and all remain space).

echo -e "o\nn\n\n\n\n+200M\nn\n\n\n\n\nw\n"|fdisk /dev/sda

mkfs.ext2 /dev/sda1
pvcreate /dev/sda2
vgcreate vgroot /dev/sda2
lvcreate -n root -L 10G vgroot
lvcreate -n swap -L 1G vgroot
lvcreate -n home -L 5G vgroot
mkfs.ext4 /dev/vgroot/root
mkfs.ext4 /dev/vgroot/home
mkswap /dev/vgroot/swap
mount /dev/vgroot/root /mnt
mkdir /mnt/{boot,home}
mount /dev/vgroot/home /mnt/home
mount /dev/sda1 /mnt/boot
swapon /dev/vgroot/swap

4. Connect to the Internet. 

By default DHCP service is enabled, but if you need some other network settings (i.e. static or wireless) read this. To check Internet:

ping -c 3 www.google.com


5. Install base system.

Enable preferred mirror in /etc/pacman.d/mirrorlist and

pacstrap /mnt base base-devel


6. Configure system.

genfstab -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt
echo "myhostname" > /etc/hostname
ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime
sed -i -e 's/#ru_RU.UTF-8/ru_RU.UTF-8/' -e 's/#en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
locale-gen
echo 'LANG="en_US.UTF-8"' > /etc/locale.conf

Edit /etc/mkinitcpio.conf. Add "lvm2" hook between "block" and "filesystems".

...
HOOKS="base udev autodetect modconf block lvm2 filesystems keyboard fsck"
...

mkinitcpio -p linux

Set root password with "passwd" and create regular user:

useradd -m -s /bin/bash user1
passwd user1

Enable DHCP service:

systemctl enable dhcpcd.service


7. Installing GRUB.

See also https://wiki.archlinux.org/index.php/GRUB

grub-install --recheck /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg


8. Umount and reboot

exit
umount /mnt/{boot,home,}

Installing Awesome wm

This is cool tiling window manager. Official page http://awesome.naquadah.org/.

Execute commands below from root.

1. Install video driver.

Detailed instruction here.

pacman -S xf86-video-vesa

For nvidia "xf86-video-nv", ATI "xf86-video-ati"

2. Install X server, awesome wm and slim dm.

pacman -S xorg-server xorg-server-utils xorg-xinit xterm awesome slim
systemctl enable slim.service

3. Configure xinitrc.

su - user1
echo "exec awesome" > .xinitrc
mkdir -p .config/awesome
cp /etc/xdg/awesome/rc.lua .config/awesome/
reboot

4. Using awesome.

For advanced usage should read official wiki

Keys:

win+{1, 2, 3,.., left, right} - switch between tags (like screens in gnome)
win+r - execute command (i.e. "firefox")
win+enter - open terminal
win+{j, k} - switch between windows
win+tab - switch to prev. window
win+w - open awesome menu

rc.lua:

In internet a lot of info about customizing rc.lua. Here is only simple example. This will set capslock key to switch keyboard layout.

echo 'awful.util.spawn_with_shell("setxkbmap -layout 'us,ru' -option 'grp:caps_toggle,grp_led:scroll'")' >> .config/awesome/rc.lua

Check syntax:

awesome -k .config/awesome/rc.lua

Then type "ctrl+win+r" to restart awesome.

Now you are free to install necessary software with "pacman", customize awesome with "rc.lua", etc. ,etc. ,etc.

1 комментарий:

  1. Have been using Awesome for 2 years, recently switched to I3 WM cause it's easier to maintain configs (no rc.lua to screw up)

    ОтветитьУдалить