Monday, January 18, 2010

How to setup Arch Linux w/ OpenBox


    1) Boot CD & use cfdisk to create your partitions (#cfdisk /dev/sda)

    In my case with 4GB of physical memory and a HDD of 40GB I'll create 2 partitions: a primary bootable partition for root of 36GB (type linux 83) ->/dev/sda1 and a logical swap partiton of 4GB (type linux swap 82) -> /dev/sda5

    rule of thumb for swap space: if your pc has 1-2gb (swap=2x), 3gb(swap=1.5x) 4gb (swap=1x), above 4gb or server (swap=0.5x), for a dinosaur with less than 1GB of physical memory:swap=1GB


    2) Format your partitions

    in my case # mkfs.ext4 /dev/sda1 and # mkswap /dev/sda5 && swapon /dev/sda5


    3) Mount your partitions

    in my case # mount /dev/sda1 /mnt


    4) Check if you're connected to the internet (# ping www.google.com) & pick your closest mirror in mirror list (# nano /etc/pacman.d/mirrorlist)

    for wifi type # wifi-menu

    5) Install base system (# pacstrap /mnt base base-devel grub-bios os-prober sudo)

    base-devel if you want the extras later (required to install packer)


    os-prober (required if you have another OS installed on your machine and want grub to detect it)

    6) Generate fstab entries (# genfstab -p /mnt >> /mnt/etc/fstab)

    7) chroot in your new system (# arch-chroot /mnt)

    8) write your hostname (# nano /etc/hostname) & add it to /etc/hosts (127.0.0.1    localhost.localdomain    localhost    YourHostname)

    your hostname could be archlinux for example

    9) set your timezone (# ln -s /usr/share/zoneinfo/America/Montreal /etc/localtime && hwclock --systohc --utc)

    use tab to display all the possibilities

    10) Uncomment your locale (# nano /etc/locale.gen) and generate it (# locale-gen && locale > /etc/locale.conf)

    11) Remove base & udev and put systemd instead in hooks (# nano /etc/mkinitcpio.conf) & create an initial RAM disk (# mkinitcpio -p linux)

    12) Set root password (# passwd)

    13) Configure grub (# grub-install --target=i386-pc --recheck --debug /dev/sda && cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo && grub-mkconfig -o /boot/grub/grub.cfg)

    14) CTRL+D to exit chroot, reboot, login as root and bring your network back:
    -Check the name of your network device (# ip link)
    enp0s3 for me
    -# ip link set thenameofyournetworkdevice up
    -# dhcpcd thenameofyournetworkdevice
    -# ping www.google.com
    -optional: add the service to automatically connect to the internet (# systemctl enable dhcpcd@thenameofyournetworkdevice.service)

    15) Create your user: # useradd -m -g users -G audio,video,optical,storage,disk,lp,sys,network,power,wheel,rfkill,scanner,log,systemd-journal -s /bin/bash YourUserName && passwd YourUserName
    lp if you have printer, sys for admin rights in CUPS, rfkill if you have a wireless device, scanner if you have a scanner

    16) Give yourself sudo rights by uncommenting wheel line in sudoers (# nano /etc/sudoers), switch to your user (# su - YourUserName)

    17) Install sound ($ sudo pacman -S alsa-utils alsa-plugins) and then:
    -Set your volume ($ alsamixer)
    -Save your volume adjustment: ($ sudo alsactl store)
    -Disable beep ($ sudo nano /etc/modprobe.d/nobeep.conf) and add:blacklist pcspkr

    18) Install Xorg and your video driver ($ sudo pacman -S xorg-server xorg-xinit xorg-server-utils ttf-dejavu mesa arandr xf86-video-your_video_card xf86-input-synaptics)
    to know your video chipset type ($ lspci | grep VGA)
    mesa is for 3D support
    arandr is a utility to change your screen resolution/output
    xorg-xinit required to start X without a display manager :P
    xorg-server-utils which contains handy utilities (such as xbacklight, xrefresh, etc.)
    xf86-input-synaptics if you have a touchpad


    19) Install OpenBox ($ sudo pacman -S openbox obconf obmenu lxappearance) and run the following commands:
    -$ mkdir -p ~/.config/openbox/
    -$ cp /etc/xdg/openbox/rc.xml ~/.config/openbox/
    -$ cp /etc/xdg/openbox/menu.xml ~/.config/openbox/

    20) Make OpenBox start when you start X ($ nano ~/.xinitrc) and add:exec openbox-session

    21) YOU'RE DONE. Reboot, login with your user & type startx to access your empty desktop and customize your archbox to your tastes
      Now some useful things to get:
      -A network manager: pacman -S wicd
      -If you want to autologin
      or a login manager
      -Install common codecs:
      pacman -S gstreamer0.10-plugins
      -Install a midi player: pacman -S timidity rosegarden
      -Install a piano: pacman -S vmpk
      -Install java: pacman -S jre7-openjdk
      -Install a browser: packer -S firefox-nightly
      -A file manager: pacman -S spacefm
      -Install a text editor: pacman -S geany

      -NTFS write support:
      pacman -S ntfs-3g
      -An archive program: pacman -S file-roller
      -A searching tool: pacman -S catfish
      -A disk partitioner: pacman -S gparted (or gnome-disk-utility)-Media swiss knife: pacman -S vlc
      -Audio player: pacman -S deadbeef
      -CLI audio player: pacman -S moc
      -Conky: pacman -S conky
      -A taskbar: pacman -S tint2
      -A wallpaper manager: pacman -S nitrogen
      -An image viewer: pacman -S viewnior
      -A screenshot utility: pacman -S scrot
      -A volume manager: pacman -S volumeicon (note:alsa has a CLI mixer already "alsamixer")

      -eyecandy: pacman -S xcompmgr
      -A cd burner: pacman -S k3b

      -A pdf viewer: pacman -S evince
      -A splittable terminal: packer -S terminator
      -A run dialog box: pacman -S gmrun
      -Online storage: packer -S wuala
      -A clipboard manager: pacman -S clipit
      -YouTube: pacman -S smtube
      -Accurate net time: pacman -S ntp
      -Microsoft Office's equivalent: pacman -S libreoffice
      -Install e-mail manager: pacman -S thunderbird
      -For your sticky notes needs: pacman -S xpad
      -A calculator: pacman -S galculator
      -A simple calendar: pacman -S gsimplecal
      -A system monitor: pacman -S htop
      -install html editor: pacman -S bluefish
      -Install a p2p application: pacman -S frostwire
      -Install a torrent manager: pacman -S transmission-gtk

      -Install a network traffic listener: pacman -S wireshark tcpflow
      -Install an HEX editor: pacman -S ghex

      -Edit audio files: pacman -S audacity
      -Video editor: pacman -S openshot
      -A Professional Video editor: packer -S lwks
       -A dynamic menu launcher: pacman -S dmenu
      -A chat client: pacman -S pidgin (or xchat for IRC)
      -A photoshop-like program: pacman -S gimp
      -An ftp client: pacman -S filezilla
      -A network tool: pacman -S gnome-nettool

      -To put a video on CD/DVD: pacman -S devede
      -An audio cd extractor: pacman -S abcde
      -A sound converter: pacman -S soundconverter
      -A scanner utility: pacman -S xsane

      -A character map: pacman -S gucharmap
      -A screen locker: pacman -S i3lock
      -An X refresh utility: pacman -S xorg-xrefresh
      -A task terminator: pacman -S xorg-xkill
      -A chm viewer
      : pacman -S xchm
      -A WYSIWYG editor: pacman -S seamonkey (launch w/ seamonkey --edit)
      -For video conference: pacman -S skype

      -A little cleanup: pacman -S bleachbit
      -3D modeling: pacman -S blender
      -
      Virtualization - pacman -S virtualbox
      -maybe a windows program loader lol: pacman -S wine

      Here's some tips to setup OpenBox
      1) obmenu is a your best friend if you want a GUI to edit the menu. Open in a terminal obmenu and create a shortcut to obmenu itself :D. Now that you have a GUI to edit the menu, the rest is pretty straightforward. Create sub-menus and items to the categories you desire and to your applications. For a complete guide on openbox, check urukrama's guide. One of the most complete ones for OpenBox. You could also check the wiki about it :D
      2) create an empty file called autostart in ~/.config/openbox in which you'll autostart the applications you need to have a nice desktop. Here's my autostart for example:

      #to restore the last wallpaper used in nitrogen
      nitrogen --restore &
      #your taskbar
      tint2 &
      #conky system monitor
      conky -q &
      3) OpenBox is pretty light and needs extra applications to do the rest of the job. Like you saw in step 2, there's some applications you'll have to autostart to have a comfortable working environment but you could use other alternatives.
      • Nitrogen to handle wallpaper
      • tint2 as your task manager
      • Conky system monitor is so versatile and so lightweight since it's text-based but it's optional to use it
      4) It's a good idea to create a menu item to obconf to change your OpenBox theme and settings. note: put your saved OpenBox themes in /usr/share/themes/

      5) Another good menu item would be one to open lxappearance to change your window theme & icons. note: put your saved GTK themes in /usr/share/themes/ and your saved icons packs in /usr/share/icons/
        6) Here's my conky configuration in case you use it:
        background yes
        use_xft yes
        xftfont Sans:size=8
        xftalpha 1
        update_interval 1.0
        total_run_times 0
        own_window yes
        own_window_transparent yes
        own_window_type desktop
        own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
        double_buffer yes
        minimum_size 200 200
        maximum_width 200
        draw_shades no
        draw_outline no
        draw_borders no
        draw_graph_borders yes
        default_color c0c0c0
        default_shade_color blue
        default_outline_color white
        alignment top_left
        gap_x 30
        gap_y 12
        no_buffers yes
        uppercase no
        cpu_avg_samples 2
        override_utf8_locale no

        TEXT
        ${font sans-serif:bold:size=8}SYSTEM ${hr 2}
        ${font sans-serif:normal:size=8}$sysname $kernel $alignr $machine
        Host:$alignr$nodename
        Uptime:$alignr$uptime
        CPU: ${cpu cpu0}% ${cpubar cpu0}
        MEM: $membar

        ${font sans-serif:bold:size=8}TOP PROCESSES ${hr 2}
        ${font sans-serif:normal:size=8}${top_mem name 1}${alignr}${top mem 1} %
        ${top_mem name 2}${alignr}${top mem 2} %
        ${top_mem name 3}${alignr}${top mem 3} %
        ${top_mem name 4}${alignr}${top mem 4} %

        ${font sans-serif:bold:size=8}SHORTCUT KEYS ${hr 2}
        ${font sans-serif:normal:size=8}Super+t$alignr Terminal
        Super+f$alignr File Manager
        Super+e$alignr Editor
        Super+w$alignr Web Browser
        Super+m$alignr Media Player
        Super+g$alignr Character Map
        Super+u$alignr System Upgrade
        Super+q$alignr Force Quit

        7) If you use nitrogen as your wallpaper manager, don't forget to add in preferences the directory where your wallpapers are located.

          8) What would be OpenBox without keybindings! You can add/edit keybindings in rc.xml file placed in ~/.config/openbox/. You can use obkey to create keybinds more easily. Here's a keybind example (my favorite one lol):

          note:replace lxterminal with your favorite terminal (ex: terminator, urxvt, roxterm, xterm, yakuake)

          9) Packer is the best tool out there to get AUR packages. Here's 4 simple steps to install it:
          1. pacman -S base-devel (if not already done)
          2. get the PKGBUILD
          3. run makepkg where you saved PKGBUILD
          4. pacman -U packer-*.pkg.tar.xz AND YOU'RE DONE!
          packer -S ThePackageYouWant (whether it's from the main reps or the AUR)!

          10) Your arch setup is supposed to last until your machine falls apart lol. Just be sure to update your system at least once to twice per week (# pacman -Syu or $ packer -Syu if you have AUR packages installed) and follow arch linux news to know what's up. Finally, be sure to use the new configuration file provided when upgrading your system with pacman if there is one (*.pacnew file)

          Tuesday, December 15, 2009