Sun, Apr 20, 2014

02:36:03 UTC: ARCH INSTALLATION / SETUP

[Media]

ISO available via Arch download page.

Installation Guide available there as well or as text file after booting up the ISO.

[Keyboard]

I found this optional but for completeness:

$ loadkeys us

[Partition]

I opted for simpler partitioning, keeping my home directory separate.

$ fdisk -l			# List parition tables
$ gdisk /dev/sda		# To partition /dev/sda
$ o				# Either new or start over
$ y				# Accept
$ n				# Create new partition
$ Enter				# Accept default partition number
$ Enter				# Accept default first sector
$ +100G				# Allocated 100GB for home partition
$ 8302				# Set type of partition or L to list

Similarly, repeat 5 to 8 to create the rest of the partitions. In my case, I’ve created /dev/sda2 for swap with 8200 and /dev/sda3 for / with 8300 using the remaining available.

$ w				# Write changes
$ y				# Accept

Alternatively, use cgdisk or cfdisk if dual boot with Windows.

[Format]

$ mkfs.ext4 /dev/sda1		# Format home partition
$ mkswap /dev/sda2		# Format swap partition
$ mkfs.ext4 /dev/sda3		# Format / partition

[Mount]

$ swapon /dev/sda2
$ mount /dev/sda3 /mnt
$ mkdir -pv /mnt/home
$ mount /dev/sda1 /mnt/home

[Wireless]

$ wifi-menu

[Install Base System]

Edit /etc/pacman.d/mirrorlist so that the preferred mirror is on top of the list.

$ pacstrap /mnt base

[Configure System]

$ genfstab -p /mnt >> /mnt/etc/fstab	# Generate fstab
$ arch-chroot /mnt			# chroot

Add hostname to /etc/hostname and /etc/hosts. For /etc/hosts, append it to the 127.0.0.1 line.

$ ln -s /usr/share/zoneinfo/Pacific/Auckland /etc/localtime

Uncomment the locale in /etc/locale.gen

$ locale-gen				# Generate locale 

Set locale preference by adding LANG="en_NZ.UTF-8" to /etc/locale.conf

$ mkinitcpio -p linux			# Create RAM disk
$ passwd				# Set root password

[Install Boot Loader]

$ pacman -S gdisk			# Prerequisite
$ pacman -S syslinux
$ syslinux-install_update -i -a -m

Or

$ pacman -S intel-ucode				# If it's an Intel CPU
$ pacman -S grub os-prober
$ grub-install --recheck /dev/sda		# Install bootloader
$ grub-mkconfig -o /boot/grub/grub.cfg		# Generate grub.cfg

Grub is for MBR only.

[Additional Install]

Wireless connection will be setup within Gnome later so in the interim, install the following to continue using wifi-menu after booting in to the new system.

$ pacman -S dialog wpa_supplicant		# Required by wifi-menu

[Umount and Reboot]

$ exit			# Exit from chroot environment
$ umount -R /mnt
$ reboot

[Create New User]

$ useradd -m -G wheel -s /bin/bash daniel
$ passwd daniel
$ usermod -a -G audio,network,power,scanner,storage,systemd-journal,video daniel

The above creates a new user with home directory, change password and add user to additional groups.

[Sudo]

$ pacman -S sudo

Run visudo, edit it to restrict sudo to specific group or user.

[Gnome]

$ sudo pacman -S gnome

For Nvidia GPU, choose nvidia-libgl when prompted. After that install the nvidia package as well.

$ sudo pacman -S nvidia
$ sudo systemctl enable gdm

Updated:

Since Gnome 3.14 update, I’ve replaced Nvidia proprietary driver with Nouveau open source driver for NVIDIA graphic cards instead due to compatibility issues.

Boot up Arch ISO then chroot to carry out the following:

$ pacman -Rdds nvidia nvidia-utils nvidia-libgl libvdpau libcl
$ rm /etc/X11/xorg.conf
$ pacman -Rdds xf86-input-evdev
$ pacman -S xorg-server mesa
$ pacman -S xf86-video-nouveau
$ pacman -S mesa-libgl

[Touchpad]

$ sudo pacman -S xf86-input-synaptics

Launch dconf editor, edit org.gnome.settings-daemon.peripherals.touchpad:
Set scroll-method to edge-scrolling.

[Wireless Network]

$ sudo pacman -S wireless_tools
$ sudo pacman -S networkmanager
$ sudo pacman -S network-manager-applet
$ sudo systemctl enable NetworkManager.service        # Enable Network Manager

Disable dhcpcd since Network Manager will be handling the dhcpcd instead.

$ sudo systemctl disable dhcpcd.service
$ sudo systemctl disable dhcpcd@.service

Alternatively, ip address to get the interface name and do dhcpcd <name> to enable it manually or sudo systemctl enable dhcpcd.service to enable it as a service. Especially in case of using ethernet during installation or not using/installing Network Manager.

$ sudo systemctl enable wpa_supplicant.service

[AUR and Yaourt]

These are required to install AUR and Yaourt packages.

$ sudo pacman -S --needed base-devel

To install AUR packages, extract tarball, run makepkg -s followed by pacman -U against the generated .pkg.tar.xz package to install it.

Yaourt Prerequisite:
package-query from AUR.

Install Yaourt:
yaourt from AUR.

[Fonts]

Add this to ~/.config/fontconfig/fonts.conf for better font rendering.

<match target="font">
  <edit mode="assign" name="autohint"><bool>true</bool></edit>
  <edit mode="assign" name="hinting"><bool>true</bool></edit>
  <edit mode="assign" name="hintstyle"><const>hintslight</const></edit>
</match>
$ sudo pacman -S gsfonts
$ yaourt -S ttf-dejavu ttf-droid ttf-bitstream-vera ttf-cheapskate \
> ttf-freefont ttf-inconsolata ttf-indic-otf ttf-junicode ttf-liberation \
> ttf-linux-libertine

From AUR:
ttf-ms-fonts

[Audio]

$ sudo pacman -S alsa-utils
$ amixer sset Master unmute        # ALSA comes muted by default.

[Multimedia]

$ sudo pacman -S gst-libav gst-plugins-ugly
$ sudo pacman -Sy --needed totem \
> gstreamer0.10-{{bad,good,ugly,base}{,-plugins},ffmpeg}
$ sudo pacman -S x264
$ sudo pacman -S ffmpeg

[Additional Install]

$ sudo pacman -S brasero
$ sudo pacman -S chromium
$ sudo pacman -S file-roller
$ sudo pacman -S gedit
$ sudo pacman -S gimp
$ sudo pacman -S git 
$ sudo pacman -S gnome-tweak-tool
$ sudo pacman -S gparted
$ sudo pacman -S gvfs-mtp
$ sudo pacman -S gvfs-smb
$ sudo pacman -S irssi
$ sudo pacman -S handbrake
$ sudo pacman -S libreoffice
$ sudo pacman -S mutt
$ sudo pacman -S msmtp
$ sudo pacman -S net-tools
$ sudo pacman -S networkmanager-openconnect openconnect        # VPN
$ sudo pacman -S offlineimap
$ sudo pacman -S openssh
$ sudo pacman -S pulseaudio-alsa
$ sudo pacman -S seahorse
$ sudo pacman -S rhythmbox
$ sudo pacman -S vim
$ sudo pacman -S vlc
$ sudo pacman -S xorg-xrandr                                   # Optional
$ sudo pacman -S xorg-server-utils                             # Optional

Updated:

xorg-server-utils has been replaced by xorg-apps

From AUR:
chromium-pepper-flash
chromium-libpdf
etherwake
realvnc-viewer

$ sudo systemctl enable sshd.service


Mon, Apr 21, 2014

03:56:59 UTC: ARCH CUSTOMISATION

[Numix Theme]

$ sudo pacman -S numix-themes

From AUR:
numix-icon-theme-git
numix-circle-icon-theme-git

[Gnome Dash to Dock]

From AUR:
gnome-shell-extension-dash-to-dock

[Gnome Tweak Tool]

Appearance->Theme:
Set Window and GTK+ to Numix
Set Icons to Numix-Circle

Extensions:
Enable Dash to Dock

Windows->Titlebar Buttons:
Enable Maximize and Minimize

[Gnome Terminal]

Clone default profile.

Customise General:
Deselect “Use the system fixed width font” and change the default monospace 12 to 10.
Decrease default terminal size from 80x24 to 80x20.

Customise Colors:
Deselect “Use colors from system theme”.
Use Green on Black scheme.

Fri, Apr 25, 2014

00:15:20 UTC: DOTFILES

[Linux]

~/.bashrc

PS1='\u@\h:\w\$ '

HISTSIZE=8000
HISTFILESIZE=8000

PATH=$PATH:$HOME/Documents/bin

source "$HOME/.rvm/scripts/rvm"

~/.vimrc

filetype plugin indent on

set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab
set textwidth=80
set formatoptions+=t

syntax on

set spelllang=en_nz
set ruler laststatus=2 number title hlsearch

[Mac]

~/.bashrc

HISTSIZE=8000
HISTFILESIZE=8000

PATH=$PATH:$HOME/Documents/bin

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

export PS1='\u@\h:\w\$ '

export PROMPT_COMMAND='echo -ne "\033]0;$PWD\007"'

The RVM line is actually auto added as part of Octopress install but included here for completeness.

~/.bash_profile

source ~/.bashrc

~/.vimrc

filetype plugin indent on

set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab
set textwidth=80
set formatoptions+=t

syntax on

set spelllang=en_nz
set ruler laststatus=2 number title hlsearch
 
set background=dark
colorscheme solarized

let &titleold=getcwd()

~/.vim/ftplugin/html.vim

setlocal shiftwidth=2

[Solarized Theme]

Download theme and copy vim’s colors folder to ~/.vim

09:27:27 UTC: EMAIL SETUP

[msmtp]

~/.msmtprc

account First
host smtp.gmail.com
port 587
protocol smtp
auth on
from email-address
user email-address
password password
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account Second
host smtp.gmail.com
port 587
protocol smtp
auth on
from email-address
user email-address
password password
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt

account default : First

[Offlineimap]

~/.offlineimaprc

[general]
ui = ttyui
accounts = First, Second

[Account First]
localrepository = First-Local
remoterepository = First-Remote

[Repository First-Local]
type = Maildir
localfolders = ~/Mail/First

[Repository First-Remote]
type = Gmail
remoteuser = email-address
remotepass = password
realdelete = no
maxconnections = 3
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

[Account Second]
localrepository = Second-Local
remoterepository = Second-Remote

[Repository Second-Local]
type = Maildir
localfolders = ~/Mail/Second

[Repository Second-Remote]
type = Gmail
remoteuser = email-address
remotepass = password
realdelete = no
maxconnections = 3
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

Mac:
For both ~/.msmtprc and ~/.offlineimaprc, change certificate path to /usr/local/opt/curl-ca-bundle/share/ca-bundle.crt instead.

[Mutt]

~/.muttrc

source ~/.mutt/accounts/First

folder-hook First/* source ~/.mutt/accounts/First
folder-hook Second/* source ~/.mutt/accounts/Second

macro index \e1  "<change-folder> =First/INBOX<enter>"
macro index \e2  "<change-folder> =Second/INBOX<enter>"

set editor='vim'

~/.mutt/accounts/First

set sendmail="msmtp-enqueue.sh -a First"
set envelope_from=yes
set from="name <email-address>"
set use_from=yes
set edit_headers=yes

set mbox_type=Maildir
set folder=~/Mail
set spoolfile="+First/INBOX"
set mbox="+First/[Gmail].All Mail"
set postponed="+First/[Gmail].Drafts"
unset record
mailboxes +First/INBOX

macro index D \
    "<save-message>+First/[Gmail].Bin<enter>" \
    "move message to the trash"

macro index S \
    "<save-message>+First/[Gmail].Spam<enter>" \
    "mark message as spam"

set sort=threads
set sort_aux=last-date-received

source ~/.mutt/colour/mutt-scheme.muttrc

~/.mutt/accounts/Second

set sendmail="msmtp-enqueue.sh -a Second"
set envelope_from=yes
set from="name <email-address>"
set use_from=yes
set edit_headers=yes

set mbox_type=Maildir
set folder=~/Mail
set spoolfile="+Second/INBOX"
set mbox="+Second/[Gmail].All Mail"
set postponed="+Second/[Gmail].Drafts"
unset record
mailboxes +Second/INBOX

macro index D \
    "<save-message>+Second/[Gmail].Bin<enter>" \
    "move message to the trash"

macro index S \
    "<save-message>+Second/[Gmail].Spam<enter>" \
    "mark message as spam"

set sort=threads
set sort_aux=last-date-received

source ~/.mutt/colour/mutt-scheme.muttrc

~/.mutt/colour/mutt-scheme.muttrc

# header
color header cyan black "^from:"
color header cyan black "^to:"
color header cyan black "^cc:"
color header cyan black "^date:"
color header cyan black "^reply-to:"
color header cyan black "^subject:"
color header cyan black "^x-mailer:"

# Default color definitions
color signature brightmagenta black
color indicator black cyan
color attachment yellow black
color error red black
color message white black
color search brightwhite magenta
color status brightgreen blue
color tree red black
color normal white black
color tilde green black
color bold brightyellow black
color markers red black

[msmtpqueue]

Download and extract msmtpqueue to ~/bin

Wed, Apr 30, 2014

02:17:03 UTC: SERVER INSTALLATION

[Media]

ISO available via Ubuntu Server download page.

[Installation]

Select language.
Select location.

Configure keyboard:
Detect keyboard: No
Select origin and layout.

Enter hostname.
Enter full name and username for new user.
Enter password.
Choose whether to encrypt home directory.
Set time zone.
Partition disks.
Enter proxy if relevant, else leave blank and continue.
Choose how to manage updates.

Software Selection:
Basic Ubuntu server
OpenSSH server
Samba file server

Install boot loader.
Reboot.

[Static IP Address]

Ethernet:

/etc/network/interfaces

auto eth0
iface eth0 inet static
        address <ip-address>
        netmask <netmask>
        network <network>
        broadcast <broadcast>
        gateway <gateway>
        dns-nameservers <dns-nameservers>

Wireless:

/etc/network/interfaces

auto wlan0
iface wlan0 inet static
        address <ip-address>
        netmask <netmask>
        network <network>
        broadcast <broadcast>
        gateway <gateway>
        dns-nameservers <dns-nameservers>
        wpa-ssid <ssid>
        wpa-psk <passphrase>

Optional:
Comment out interfaces if not required.

[Update]

$ sudo apt-get update
$ sudo apt-get upgrades
$ sudo apt-get aptitude        # Useful if not already installed


04:12:54 UTC: SAMBA SETUP

[Directory Structure]

$ sudo mkdir -p /shares/data          # data directory
$ cd /shares/data
$ sudo mkdir daniel                   # home directory
$ sudo groupadd data
$ sudo chown daniel:data daniel
$ chmod o-rx daniel

[sysadmin]

$ sudo useradd -m -G data -s /bin/bash sysadmin
$ sudo passwd sysadmin

Config

/etc/samba/smb.conf

workgroup = <workgroup-name>
wins support = yes
name resolve order = lmhosts host wins bcast
security = user

[Data]
comment = Data
path = /shares/data
browseable = yes
read only = yes
valid users = sysadmin

[Daniel]
comment = Daniel
path = /shares/data/daniel
browseable = yes
read only = no
valid users = daniel

Sets Samba password. I think smbpasswd ties in with passwd but needed in this case since password was set prior to Samba installation.

$ smbpasswd -a daniel


20:38:17 UTC: DLNA

[PS3 Media Server]

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:happy-neko/ps3mediaserver
$ sudo apt-get update 
$ sudo apt-get install ps3mediaserver

[Directory Structure]

$ sudo mkdir -p /shares/stream        # stream directory
$ cd /shares
$ sudo groupadd stream
$ sudo chgrp stream stream
$ sudo chmod g+w,o-rx stream
$ sudo usermod -a -G stream daniel

[ps3]

$ sudo useradd -m -G stream -s /bin/bash ps3
$ sudo passwd ps3

[Daemon]

/etc/default/ps3mediaserver

PMS_START="yes"
PMS_USER="ps3"
PMS_PROFILE="/home/$PMS_USER/.config/ps3mediaserver"

[Config]

/etc/samba/smb.conf

[Stream]
comment = Stream
path = /shares/stream
browseable = yes
read only = no
valid users = daniel

/home/ps3/.config/ps3mediaserver/PMS.conf

usecache = false
hide_empty_folders = true
folders = /shares/stream

Remove /home/ps3/.config/ps3mediaserver/WEB.conf

Reboot

Needed sometimes if media not playing, especially newly added.

$ sudo service ps3mediaserver restart