Support #410
Updated by Daniel Curtis over 10 years ago
Now that I have made the switch to Arch Linux more permanently, I decided to run through how I set my laptop up. The primary hard drive consists of 3 partitions:
* Windows XP (Dummy OS)
* Arch / (root)
* Arch /home (home)
The Windows partition installs its bootloader on the primary hard drive. The intention is to have the Arch boot off of a USB drive, but will only boot into Windows if the drive is not present.
The general software load out consists of:
* *VirtualBox w/ Guest Additions*: Virtual computing software
* *LibreOffice*: Office suite
* -*TrueCrypt*: High-grade encryption tool-
* *Tomb*: Modern open source encryption management tool, replaces TrueCrypt
* *Windows Network Browsing*: For connecting to Windows shares
* *Firefox*: Open Source Web browser
* *Chromium*: Open Source Chrome Web browser
* *Chrome*: Google Proprietary Chrome Web browser
* *Thunderbird*: Mail client
* *ownCloud Client*: Personal cloud client
* *Pidgin*: Instant messaging client
* *BleachBit*: Browser, mail, application cleaning application
* *GIMP*: Image editing
* *Filezilla*: FTP/SFTP Client
* *git*: Source code management
* *KeePass2*: Password management
* *VLC*: Media player
* *Flash*: Closed source media and content plugin
* *Arduino*: Arduino Integrated Development Environment
* *Fritzing*: Prototyping software
* *PlayOnLinux*: Front-end to Wine
* *Steam*: Digital gaming distributor
* *Komodo Edit*: Open Source IDE
* *HuluDesktop*: Hulu client
* *Wireshark* : Network traffic analysis tool
h2. Preparing the two partitions
I decided to use LUKS on both the root and home partitions.
* Format the partitions, if any custom options are wanted, this is where you would specify them.:
<pre>
cryptsetup luksFormat /dev/sdb5
cryptsetup luksFormat /dev/sdb6
</pre>
*# *NOTE*: This will prompt you for a passphrase to use for encrypting the partition. If I were truly paranoid I would use a keyfile with the @-d@ flag and generate a 1K random keyfile:
<pre>
dd if=/dev/urandom of=/path/to/keyfile bs=1K
</pre>
* Now map open the LUKS partition to tad them to the device mapper:
<pre>
cryptsetup luksOpen /dev/sdb5 root
cryptsetup luksOpen /dev/sdb6 home
</pre>
* Next, create the filesystem for the containers. I chose BTRFS, though the choice in filesystem is user-preferential; I would like to try ZFS at some point.
<pre>
mkfs.btrfs /dev/mapper/root
mkfs.btrfs /dev/mapper/home
</pre>
* Mount the new encrypted partitions:
<pre>
mount /dev/mapper/root /mnt
mkdir /mnt/home
mkdir /mnt/boot
mount /dev/mapper/home /mnt/home
</pre>
h2. Prepare the USB bootloader
This is one layer in my defense-in-depth, needing a USB with the bootloader installed onto. If I were a tad more paranoid, I would include the usage of a keyfile.
I usually add a 512MB ext4 partition to the beginning of a USB drive, this will be enough room for a few kernels. Using cfdisk will simplify the task:
<pre>
cfdisk /dev/sdc
</pre>
* Once the partition is created and formatted to the appropriate filesystem, mount the USB drive to the installation path /boot folder:
<pre>
mount /dev/sdc1 /mnt/boot
</pre>
h2. Install the base system
* Generate an fstab:
<pre>
genfstab -p /mnt >> /mnt/etc/fstab
</pre>
* Now its time to install the base system:
<pre>
pacstrap /mnt base grub openssh
</pre>
#* chroot into the newly installed system:
<pre>
arch-chroot /mnt
</pre>
#* Write your hostname to /etc/hostname:
<pre>
echo 'archdev' >> /etc/hostname
</pre>
#* Symlink /etc/localtime to /usr/share/zoneinfo/Zone/SubZone:
<pre>
ln -s /usr/share/zoneinfo/America/Los_angeles /etc/localtime
</pre>
#* Uncomment the selected locale in /etc/locale.gen and generate it with:
<pre>
vi /etc/locale.gen
:%s/#en_US.UTF-8/en_US.UTF-8
:wq
locale-gen
</pre>
#* Configure @/etc/mkinitcpio.conf@ as needed and create an initial RAM disk with:
<pre>
mkinitcpio -p linux
</pre>
*# *NOTE*: Make site to add the *_encrypt_* word to the mkinitcpio.conf +HOOKS+ section:
> HOOKS="... encrypt ... filesystems ..."
#* Set a root password:
<pre>
passwd
</pre>
#* Configure the network again for newly installed environment:
<pre>
cp /etc/netctl/examples/ethernet-dhcp /etc/netctl/wired
netctl enable wired.service
</pre>
#* Add the encrypted mapping to @/etc/crypttab@:
> home /dev/mapper/home
#* Enable SSH
<pre>
systemctl enable sshd.service
</pre>
h2. Install the bootloader
* Before installing the booloader to the USB drive, the bootloader must be configured for the encrypted root partition. This can be done by making the following modification to @/etc/default/grub@:
> GRUB_CMDLINE_LINUX_DEFAULT="root=/dev/mapper/root cryptdevice=/dev/sda5:root quiet"
* Now install GRUB onto the USB drive:
<pre>
grub-install --target=i386-pc --recheck --debug /dev/sdc
grub-mkconfig -o /boot/grub/grub.cfg
</pre>
h2. Exit the install environment and reboot
At this point the system will be bootable from the USB drive. Exit and reboot the out of the installation environment:
<pre>
exit
umount /mnt/home
umount /mnt/boot
umount /mnt
reboot
</pre>
h2. Install a desktop environment
There are many choices for desktop environments, I went through a few before I returned to my favorite (LXDE). Here are a few popular ones just for reference:
* GNOME
<pre>
pacman -S gnome
systemctl enable gdm.service
systemctl start gdm.service
</pre>
* KDE
<pre>
pacman -S kde
systemctl enable kdm.service
systemctl start kdm.sercice
</pre>
* XFCE
<pre>
pacman -S xfce4 xorg xorg-xinit
echo 'exec startxfce4' >> ~/.xinitrc
startx
</pre>
* LXDE
<pre>
pacman -S lxde xorg xorg-xinit dbus gvfs gvfs-smb
echo 'exec startlxde' >> ~/.xinitrc
startx
</pre>
h2. Add an administrator user
It is generally a good idea not to run command directly as root, but rather as an administrative user using the sudo wrapper command.
* First install sudo:
<pre>
pacman -S sudo
</pre>
And create a user:
* <pre>
useradd -m -g users -s /bin/bash bob
</pre>
* Add bob to the sudoers file:
<pre>
visudo
</pre>
> bob ALL=(ALL) ALL
h2. Install Wifi
* Since my laptop has a weird broadcom wifi card in it, I needed to use b43-fwcutter to install wireless drivers:
<pre>
curl -LO http://downloads.openwrt.org/sources/broadcom-wl-4.178.10.4.tar.bz2
tar xjf broadcom-wl-4.178.10.4.tar.bz2
cd broadcom-wl-4.178.10.4/linux
sudo b43-fwcutter -w /lib/firmware wl_apsta.o
</pre>
* Then install the @wpa_supplicant@ package:
<pre>
sudo pacman -S wpa_supplicant
</pre>
* And finally create the netctl configuration, start and enable the network profile:
<pre>
cp /etc/netctl/examples/wireless-wpa /etc/netctl/wireless-net
netctl enable wireless-net
netctl start wireless-net
</pre>
h2. Install the packages
* For the packages I require through the Arch repositories, I will just run with one command:
<pre>
sudo pacman -S chromium firefox filezilla keepass vlc base-devel wget bleachbit calibre cifs-utils epdfview flashplugin geany gimp git gparted gqrx leafpad libreoffice mpv nmap pidgin playonlinux remmina rsync steam thunderbird virtualbox virtualbox-host-modules virtualbox-guest-iso wpa_supplicant_gui wireshark-cli wireshark-gtk handbrake openshot kdenlive dvdauthor
</pre>
* For the packages I require through the AUR, I need to download the compressed PKGBUILD files and compile each package from source:
<pre>
mkdir ~/src && cd ~/src
</pre>
# Google Chome
<pre>
wget https://aur.archlinux.org/packages/go/google-chrome/google-chrome.tar.gz
tar google-chrome.tar.gz
cd google-chome
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
# Tomb
<pre>
wget https://aur.archlinux.org/packages/to/tomb/tomb.tar.gz
tar xzf tomb.tar.gz
cd tomb
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
# qtkeychain-git (This is a dependency for the ownCloud client)
<pre>
wget https://aur.archlinux.org/packages/qt/qtkeychain-git/qtkeychain-git.tar.gz
tar xzf qtkeychain-git.tar.gz
cd qtkeychain-git
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
# caffeine-systray
<pre>
wget https://aur.archlinux.org/packages/ca/caffeine-systray/caffeine-systray.tar.gz
tar xzf caffeine-systray.tar.gz
cd caffeine-systray
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
# owncloud-client
<pre>
wget https://aur.archlinux.org/packages/ow/owncloud-client/owncloud-client.tar.gz
tar xzf owncloud-client.tar.gz
cd owncloud-client
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
# fritzing
<pre>
wget https://aur.archlinux.org/packages/fr/fritzing/fritzing.tar.gz
tar xzf fritzing.tar.gz
cd fritzing
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
# arduino
<pre>
wget https://aur.archlinux.org/packages/ar/arduino/arduino.tar.gz
tar xzf arduino.tar.gz
cd fritzing
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
# komodo-edit
<pre>
wget https://aur.archlinux.org/packages/ko/komodo-edit/komodo-edit.tar.gz
tar xzf komodo-edit.tar.gz
cd komodo-edit
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
# huludesktop
<pre>
wget https://aur.archlinux.org/packages/hu/huludesktop/huludesktop.tar.gz
tar xzf huludesktop
cd huludesktop
makepkg -s PKGBUILD && makepkg -i PKGBUILD
</pre>
h2. Caveats & Notes
h3. Prepare VirtualBox host
* The vboxdrv kernel module needs to be loaded:
<pre>
sudo modprobe vboxdrv
</pre>
* Users also need to be added to the vboxusers group in order to use VirtualBox:
<pre>
gpasswd --add bob vboxusers
</pre>
h3. NOTE: Intel Galileo uses a different Arduino IDE
Since I am developing on the Intel Galileo, I needed to grab Intel's IDE from https://communities.intel.com/docs/DOC-22226
Building the above arduino package from the AUR may resolve issues if there are any problems installing the Intel version of the arduino IDE.
h3. NOTE: Arduino and Galileo users must be added to the lock and uucp groups
The arduino board communicates with the computer via a serial connection or a serial over USB connection. So the user needs read/write access to the serial device file. Udev creates files in @/dev/tts/@ owned by group uucp so adding the user to the uucp group gives the required read/write access:
<pre>
gpasswd -a $USER uucp
gpasswd -a $USER lock
</pre>
Note: You will have to logout and login again for this to take effect.
The arduino board appears as /dev/ttyACMx so if the above doesn't work try adding the user to the group tty:
<pre>
gpasswd -a $USER tty
</pre>
Before uploading to the Arduino, be sure to set the correct serial port, board, and processor from the Tools menu.
h3. Fix the corrupt text with Steam
Steam needs to have its own fonts, this can be installed by doing the following:
<pre>
mkdir ~/SteamFonts && cd ~/SteamFonts
wget https://support.steampowered.com/downloads/1974-YFKL-4947/SteamFonts.zip
unzip SteamFonts.zip
sudo cp * /usr/share/fonts/TTF/
sudo chown -R root.root /usr/share/fonts/TTF/
</pre>