My Arch Linux setup
This is mostly just a reminder for myself - but I always learn new things when I read how other people set up their system. Leave a comment if you have a tip - that's how I learned about wicd-gtk :). Oh, and install my window manager (tiling, written in C++ and node.js, configurable using Javascript).
First steps
- do the basic arch setup first (or VMware, or Virtualbox)
dhcpcd eth0 #if you did not add "interface=eth0" in rc.conf during setup
pacman -Syu
Fixes:
http://www.archlinux.org/news/initscripts-update-manual-intervention-required/
rm /etc/profile.d/locale.sh
http://www.archlinux.org/news/filesystem-upgrade-manual-intervention-required/
pacman -S filesystem --force
pacman -S sudo
vim /etc/sudoers # add yourself to sudoers
sudo vim /etc/pacman.conf # set SigLevel = Never TrustAll
sudo shutdown-r now
Install X11:
pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils xterm
If virtualized in VirtualBox, make copy-paste work first:
pacman -S virtualbox-archlinux-additions
Create a new user
pacman -S zsh
useradd -m -g users -G audio,lp,optical,storage,video,games,power,scanner -s /bin/zsh USERNAME
su USERNAME
passwd
Add x11
pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils
Copy ssh keys over from old machine Useful packages
pacman -S base-devel sudo python2 git libev mlocate mercurial nitrogen
sakura wicd-gtk pcmanfm gnome-icon-theme htop unzip
openssl chromium flashplugin bash-completion xterm
epdfview mysql ruby tilda tmux wget redis xcursor-vanilla-dmz
xarchiver gzip bzip2 zip unzip unrar p7zip
meld ttf-ubuntu-font-family mpg123 alsa-utils redis mysql ruby libxslt
- base-devel and python2 for compiling node
- libev for nwm
- mlocate for locate command
- nitrogen is better than feh for multiple screens
- sakura is a nice terminal
- wicd-gtk is a simple wifi network gui
- pcmanfm gnome-icon-theme are for pcmanfm, a Nautilus alternative
Add ~/.Xresources:
Xcursor.theme: vanilla-dmz
Xcursor.size: 16 ! 32, 48 or 64 may also be good values
Configuring git
git config --global color.ui true
Configuring sakura
I want to use ctrl + Page_Up / Page_Down to switch tabs, so edit ~/.config/sakura/sakura.conf:
switch_tab_accelerator=4 # since <a>GDK_CONTROL_MASK</a> is 1 << 2, e.g. 4.
prev_tab_key=Page_Down
next_tab_key=Page_Up
Some basic niceties: whatprovides, service and chkconfig
pacman -S pkgtools
- pkgtools provides the pkgfile tool. It works like yum whatprovides (e.g. allows you to search for a particular command or dependency in all the pacman packages)
- "sudo pkgfile -u" to update the db
- "pgkfile zipinfo" to search for zipinfo
function service() {
sudo /etc/rc.d/$1 $2
}
alias chkconfig='cat /etc/rc.conf | grep DAEMONS && echo "cat + grep /etc/rc.conf"'
This makes service an alias for /etc/rc.d/ and prints out the enabled services from /etc/rc.conf. While we're editing .bashrc, might as well add:
PS1="[W]$ " # my preferred bash prompt (e.g. only the current dirname).
ulimit -s 16400 # higher stack limit
# ssh-agent
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
# Source SSH settings, if applicable
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
#ps ${SSH_AGENT_PID} doesn't work under cywgin
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
Installing Node and NPM
You can just do:
pacman -S nodejs
If you're OK with that version, which seems to track the Node releases pretty well.
Arch uses python3 as python. You need to change python to python2 (thanks Rob Searles!)
# node.js fix for arch (use python2)
mkdir /tmp/bin
ln -s /usr/bin/python2 /tmp/bin/python
export PATH=/tmp/bin:$PATH
You can then do a regular node install:
git clone git://github.com/joyent/node.git
git checkout v0.4.12
./configure
make
sudo make install
Remember to install npm as well:
curl http://npmjs.org/install.sh | sudo sh
Installing my window manager and personal config
git clone git://github.com/mixu/nwm.git
cd nwm
node-waf clean || true && node-waf configure build
sudo npm link # add a global npm symlink to this repository - so nwm-user can find it (man npm link)
cd ..
git clone git://github.com/mixu/nwm-user.git
cd nwm-user
npm link nwm # now make a symlink to the nwm installation
Add it to ~/.xinitrc (change paths!!):
exec /usr/local/bin/node ~/mnt/nwm-user/nwm-user.js 2>~/nwm.err.log 1>~/nwm.log
And while we're at it, lets add some other stuff:
VBoxClient-all &
export PATH=/tmp/bin:$PATH # for node-waf, too lazy to work on a better solution
xset +fp /usr/share/fonts/local
xset fp rehash
Run "startx" to start X11 with nwm.
Installing my mp3 player
First, we need to configure alsa (included by default):
pacman -S mpg123 alsa-utils
Run:
alsamixer
and turn on Master and PCM channels (by pressing m) as they are muted by default.
sudo alsactl store
Then continue:
git clone git://github.com/mixu/nplay.git
Run nplay with
node nplay.js
TODO: fix directory in source code and change backend from mpg321 to mpg123.
Switching the keyboard language in X11
I sometimes need to write emails in Finnish, so here is how to switch the layout:
<code>setxkbmap -layout fi # revert back </code><span class="Apple-style-span" style="font-family: monospace;">setxkbmap -layout us</span><span class="Apple-style-span" style="font-family: monospace;"> </span>
Install yaourt
Install dependencies
yaourt libpng12 gtk2-theme-dust
Install Sublime Text 2
Sublime Text needs libpng12, which you have to install from AUR:
wget http://aur.archlinux.org/packages/li/libpng12/libpng12.tar.gz
tar -xzvf libpng12.tar.gz
cd libpng12
makepkg
pacman -U ./libpng12-1.2.46-2-x86_64.pkg.tar.xz
Then download and run Sublime Text 2.
Also, you might want to ger http://aur.archlinux.org/packages/gt/gtk2-theme-dust/gtk2-theme-dust.tar.gz.
Configuring Sublime Text 2
locate Packages # returns ~/.config/sublime-text-2/Packages
cd ~/.config/sublime-text-2/Packages
git clone https://github.com/buymeasoda/soda-theme/ "Theme - Soda"
cd User
wget http://blog.mixu.net/files/2010/05/my_themes.zip # Install my themes
unzip my_themes
rm my_themes.zip
Base File settings
{ // FONTS and COLORS "color_scheme": "Packages/User/Mixu Espresso.tmTheme", "font_size": 11, "tab_size": 2, // WHITESPACE // Set to true to insert spaces when tab is pressedComments
Kenneth: What are the advantages of your window manager? I'm currently using awesome wm on arch. The javascript configuring sounds cool.
Mikito Takada: Mostly: configurability and the ability to customize things like layouts in JS. And you don't need any additional tech beyond Node + npm, so if you are already doing Node dev it's a lightweight option.
jiyinyiyong: As I failed to install Xmonad on Ubuntu 12.04 , I tried NWM, really concise WM. I was supposing to get a WM like
Xmonad with Gnome
whose fonts and menus look more beautiful(maybe get panels as well..). I've went through the docs on the site, but is there more detail about making NWM look better?Mikito Takada: nwm works with both Gnome and KDE apps, but it's a window manager, not a desktop environment.
http://en.wikipedia.org/wiki/Desktop_environment vs http://en.wikipedia.org/wiki/Window_manager
E.g.:
- Font rendering in X11 is done by libraries (e.g. freetype2 for TTF), not the window manager.
- Menu rendering in X11 is done by the window toolkit that the particular app is compiled against e.g. Gnome/KDE, not the window manager.
I'd love to write all that, but I'm just one dude. Writing a desktop environment is a bit too much for a for-fun project ;).
For better looking fonts, I use the Ubuntu font rendering patchset for Arch; for better menus I use a Gnome theme.
jiyinyiyong: (I'm late.. but didn't received e-mail about the reply.. ) OK, I'll make effort to get familiar about X11 and things like that. So far I just want to try cool stuffs writtern in Node. Really thanks.
jsc: You probably found a way by now, but if not, I would like to mention gtk-theme-switch. It's in the default repos of 12.04 and requires no logout to take effect.
It does what it says on the box: changes your gtk theme to any other one you have installed, which on 12.04 should be at least Ambiance and Radiance.