Sunday, 4 March 2012

Arch Linux 2011 - post installation

Every now and then I like to fiddle with a new Linux distro or a pre-release version of one o few distros I'm familiar with. After a quick look at http://distrowatch.com I've picked Arch Linux, because :

- I use openSuse at work
- tried Fedora some months ago
- Debian is overall outdated
- I hate *buntu
- I've used Mandriva at work and home for few years

I usually don't bother to read instructions/documentation on distros I want to play with, until thing go really wrong - where's the fun in doing things by the book, right :D

Instalation process went fast and smoove, so lets skip to what I had to do after that.
Everything done loged in to shell as root.

1. Get IP adress by dhcp
dhcpcd -b eth0

2. Select pacman repos
nano /etc/pacman.conf

and uncoment few lines like this

[core]
#SigLevel = PackageRequired
Include = /etc/pacman.d/mirrorlist

[extra]
#SigLevel = PackageOptional
Include = /etc/pacman.d/mirrorlist

[community]
#SigLevel = PackageOptional
Include = /etc/pacman.d/mirrorlist

- to save and exit from nano : Ctrl o , Enter , Ctrl x
- or : Ctrl x , y , Enter

3. Select pacman mirror
nano /etc/pacman.d/mirrorlist

and uncomment one link like so :

Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch

4. Update system
pacman -Syu

5. Install few usefull apps
- mc - midnightcommander - file manager working in shell
- xfce4 - light X Desktop Environment
- gnome-packagekit - package manager for X
- wpa_supplicant - for connecting to wireless networkes
- htop - manage runing processes

pacman -S mc xfce4 wpa_supplicant gnome-packagekit htop

After starting X
startxfce4
You can run graphical package manager with
Alt F2
gpk-application

6. Tweak few bash commands - for lazy ppl
mcedit /etc/bash.bashrc
and add this lines
alias ll="ls -al --color=yes"
alias grep="grep --color"
alias df="df -aTh"

Press F2 to save and F10 to exit mcedit
Try 'll' or other command after re-loging in to shell - some distros have this neat feature by default.

7. Picking boot runlevel 3
mcedit /etc/inittab
# Boot to console
id:3:initdefault:
# Boot to X11
#id:5:initdefault:

While editing inittab you can stop unnecessary terminals from starting at boot, I've rarely needed more than 2
#c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux
#c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux
#c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux

8. If you have wifi router (or can connect to one), here's a helpfull hints

a) make a backup of config file
cp  /etc/wpa_supplicant.conf  /etc/wpa_supplicant.conf~

b) generate psk from ssid and passphrase
wpa_passphrase yourSSIDhere
# reading passphrase from stdin
TypeYourPassphraseHere
copy the result - psk - will be needed for config file

c) I've removed all network examples from my conf (starting from then line : # Example blocks: )
mcedit /etc/wpa_supplicant.conf

and whipped out something like this - for most secure setup I can pick for my WRT160N, which is WPA2 with AES

network={
 id_str="MY"
 disabled=0
 mode=0
 ssid="yourSSIDhere"
 scan_ssid=1
 proto=WPA2
 key_mgmt=WPA-PSK
 auth_alg=OPEN
 pairwise=CCMP
 group=CCMP
 psk=d123456789e4ba9b3b34c8085d39ee5d6e69ff625c6198b726b1e1acabcdef
 priority=9
}

d) and here's a script to start and stop wifi connection
mcedit /wifi.sh
Paste in this code
#!/bin/bash

if [ -e /var/run/dhcpcd-wlan0.pid ];then
    if [ -e /var/run/wpa-wlan0.pid ];then
        PIDF=`cat /var/run/wpa-wlan0.pid`
        kill ${PIDF}
    fi
    dhcpcd -x wlan0
    ifconfig wlan0 down
else
    ifconfig wlan0 up
    wpa_supplicant -q -B -Dwext -iwlan0 -P/var/run/wpa-wlan0.pid -c/etc/wpa_supplicant.conf
    dhcpcd -b wlan0
fi

press F2 to save and F10 to exit mcedit

chmod 700 /wifi.sh
Run by
/wifi.sh
Will start necessary apps and create pid files for them, if pids already exist - will stop those apps.

It's been a week and so far I'm loving Arch Linux. I get latest software & kernel and it's all running smoking fast.

No comments:

Post a Comment