Support #642
Updated by Daniel Curtis over 8 years ago
{{>toc}} This is a guide on how I have setup one of my desktops for developing defferent project. The primary hard drive consists of 2 partitions: * /dev/sda1 - Windows 10 (Dummy OS, installation not covered in this guide) * /dev/sda2 - Arch * /dev/sdb1 - USB Boot partition * I used cfdisk to partition the main hard drive: <pre> cfdisk /dev/sda </pre> 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 * *Wireshark* : Network traffic analysis tool h2. Preparing the two partitions I decided to use LUKS on the root partition. * Format the partitions, if any custom options are wanted, this is where you would specify them.: <pre> cryptsetup -i 15000 -c aes-xts-plain:sha512 -y -s 512 luksFormat /dev/sda2 </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/sda2 root </pre> * Next, create the filesystem for the containers. I chose ext4, though the choice in filesystem is user-preferential; I would like to try ZFS at some point. <pre> mkfs.ext4 /dev/mapper/root </pre> * Mount the new encrypted partitions: <pre> mount /dev/mapper/root /mnt mkdir /mnt/boot </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 end of a USB drive, this will be enough room for a few kernels. Using cfdisk will simplify the task: <pre> cfdisk /dev/sdb </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/sdb1 /mnt/boot </pre> h2. Install the base system * Generate an fstab: <pre> mkdir /mnt/etc genfstab -p /mnt >> /mnt/etc/fstab </pre> * Now its time to install the base system: <pre> pacstrap /mnt base base-devel 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> #* 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@: <pre> GRUB_CMDLINE_LINUX_DEFAULT="root=/dev/mapper/root cryptdevice=/dev/sda2:root quiet" </pre> * Now install GRUB onto the USB drive: <pre> grub-install --target=i386-pc --recheck --debug /dev/sdb 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/boot umount /mnt reboot </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> * Set a password for bob: <pre> passwd bob </pre> * Then create the sudo group and add the user bob to the sudo group: <pre> groupadd sudo usermod -aG sudo bob </pre> * Allow anyone part of the sudo group run sudo commands: <pre> visudo </pre> #* And add the following line to add bob to the sudo file: <pre> %sudo ALL=(ALL) ALL </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. 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 virtualbox-host-dkms linux-headers wpa_supplicant_gui wireshark-cli wireshark-gtk handbrake openshot kdenlive dvdauthor </pre> h3. Install yaourt * Install wget: <pre> pacman -S wget </pre> * Download the packages for yaourt: <pre> cd /tmp wget https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz && wget https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz tar xzf package-query.tar.gz tar xzf yaourt.tar.gz </pre> #* Install "yaourt":https://project.altservice.com/issues/509 package-query: <pre> cd package-query makepkg -csi </pre> #* Install yaourt <pre> cd ../yaourt makepkg -csi </pre> # Google Chome <pre> yaourt google-chrome </pre> # Tomb <pre> yaourt tomb </pre> # caffeine-systray <pre> yaourt caffeine-systray </pre> # owncloud-client <pre> yaourt owncloud-client </pre> # fritzing <pre> yaourt fritzing </pre> # arduino <pre> arduino </pre> # komodo-edit <pre> yaourt komodo-edit </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> * Build DKMS modules <pre> dkms install vboxhost/4.3.14 </pre> * Enable DKMS modules at boot <pre> systemctl enable dkms.service </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> h3. tmpfs * It is sometimes useful to offload the /tmp folder to RAM by using tmpfs: <pre> echo 'tmpfs /tmp tmpfs nodev,nosuid,size=2G 0 0' >> /etc/fstab </pre> h2. Resources * http://zfsonlinux.org/ * http://en.wikipedia.org/wiki/ZFS * http://www.zfsbuild.com/2010/05/26/zfs-raid-levels/ * http://nex7.blogspot.ch/2013/03/readme1st.html * http://wintelguy.com/raidcalc.pl * https://calomel.org/zfs_raid_speed_capacity.html * https://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/ * http://docs.oracle.com/cd/E19253-01/819-5461/