ArchLinux Notes Revision as of Thursday, 18 February 2016 at 20:30 UTC
[TOC]
Notes from installing the awesome ArchLinux on VirtualBox to use as a development machine at work.
parted /dev/sda
# Make a GPT partition table
mklabel msdos
# Create 2GiB swap
mkpart primary linux-swap 1MiB 2GiB
# Use the rest for root
mkpart primary ext4 2GiB 100%
# Make root bootable
set 2 boot on
# Ctrl+D to quit
# Create swap
mkswap /dev/sda1
swapon /dev/sda1
# Create filesystem
mkfs.ext4 /dev/sda2
# Mount
mount /dev/sda2 /mnt
# Boostrap
pacstrap -i /mnt base base-devel
# Generate fstab
genfstab -U /mnt > /mnt/etc/fstab
# Switch to the new filesystem!
arch-chroot /mnt /bin/bash
Then do everything else the wiki asks you to do
Install VirtualBox Guest Additions
pacman -S virtualbox-guest-utils \
virtualbox-guest-modules \
virtualbox-guest-dkms
This is without an LTS kernel since I couldn’t be bothered. After installation, enable the service
systemctl enable vboxservice.service
Edit /etc/modules-load.d/virtualbox.conf
to add these
vboxguest
vboxsf
vboxvideo
Install X11 and Xfce4
pacman -S xorg-server xorg-xinit xfce4 xfce4-goodies
At this point, running startxfce4
should show you a desktop. Reboot.
Starting X
cp /etc/X11/xinit/xinitrc ~/.xinitrc
echo -e "exec startxfce4" >> ~/.xinitrc
Modify ~/.xinitrc
to remove all the xterm
, xclock
and exec
lines and add this
exec startxfce4
Now, startx
should work!
Install some extras
yaourt -S google-chrome numix-themes numix-circle-icon-theme-git ristretto evince2-light squeeze-git --noconfirm
Add a normal user
Who will be able to sudo
and do things and set a password
useradd -m -g wheel user
passwd user
Can always change the name of this user later with usermod
. Then use visudo
to enable the wheel
group. You’ll see a lot of artifacts if you don’t set EDITOR
first
EDITOR=vim visudo
Yoghurt
Edit /etc/pacman.conf
and add this
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
Then,
pacman -Sy yaourt
Compiz (Maybe)
For Compiz,
yaourt -S compiz
To run compiz,
compiz --replace ccp
To get the Numix theme,
gsettings set org.gnome.metacity theme theme-name
Add that to “Session and Startup”. I had to kill it, not save the session, and log out. The default window manager is xfwm4
.
The Trash Can
sudo pacman -S gvfs gamin
Sound
pacman -S alsa-firmware alsa-utils
alsactl init
Dock
Lots of options, but I like Docky and Plank. Went with Plank.
Dropbox
Install both the dropbox
and dropbox-cli
packages with yaourt
. Some useful commands
# Get to your folder
cd ~/Dropbox
# See the overall sync status
dropbox-cli status
# See file status
dropbox-cli filestatus
# Set a proxy
dropbox-cli proxy manual http jhproxy1.phibred.com 8080
NetworkManager
A bit ‘heavy’ compared to netctl
but I was tired of fighting with the corporate network.
pacman -S networkmanager network-manager-applet xfce4-notifyd
Enable the service (else you’ll get D-Bus errors when you run nm-applet
)
systemctl enable NetworkManager.service
systemctl start NetworkManager.service
Reboot and log back in. You’ll find the network manager in Applications -> Settings -> Network Connections
Verbose Boot
Modify GRUB_CMDLINE_LINUX_DEFAULT
in /etc/default/grub
CA Certificates
Copy certificates in PEM format and ending with a .pem
extension to /etc/ssl/certs
. Then, as root, run update-ca-trust
.
Google Chrome didn’t seem to depend on the system store.
Linode Notes
Separating out partitions
I had separate disks for /var
and /var/log
.
-
Create a minimal system
-
Boot into Rescue Mode (that uses Finnix)
-
Mount the minimal system some place
-
Modify
/etc/fstab
on the system/dev/sda / ext4 rw,relatime,data=ordered 0 1 /dev/sdb none swap defaults 0 0 /dev/sdc /var ext4 rw,relatime,data=ordered 0 1 /dev/sdd /var/log ext4 rw,relatime,data=ordered 0 1 tmpfs /tmp tmpfs nodev,nosuid 0 0
-
rsync
everything over from the minimal system’s folders to the new disk -
Delete folders from the minimal system
-
Shutdown the minimal system (
shutdown now
) -
Make sure that the mounts are correctly mapped in your Configuration Profile
-
Boot up the minimal system
Packages
- Run
pacman -Syu
first! - The
base-devel
collection isn’t installed. A simplepacman -S base- devel
will fix this.
Network
The pacman
update will break networking due a
bug that may have been fixed in
systemd
v228 (as of this writing). Oh well. The fix is easy. Create a file
like this
for the interface you see in ip link
(will start with “en
”)
# /etc/systemd/network/enp0s4.network
[Match]
Name=enp0s4
[Network]
DHCP=yes
Then enable the appropriate service and restart the node
systemctl enable systemd-networkd
reboot
Hostname
hostnamectl set-hostname nikhil.io
SSH
pacman -S openssh
Change default port in /etc/ssh/sshd_config
and disable root login. Then
enable the “spawn on demand” ssh.socket
service
and change the port to whatever you had earlier
# systemctl edit sshd.socket
[Socket]
ListenStream=12345
Enable the service and reboot to test if you can SSH
systemctl enable sshd.socket
reboot
Time and Date
timedatectl set-timezone America/Chicago
Installation
Downloaded the ISO (2015.12.01
) and
set up an “Other 64-bit” VM in VMWware Fusion 8 on OS X El Capitan. Wired
networking was working at bootup. The Arch beginner’s
guide was very clear
and helpful.
Chose to create a very simple GPT partition scheme using parted
.
parted /dev/sda
# Make a GPT partition table
mklabel gpt
# Create a 512GiB EPI System Partition (ESP)
mkpart ESP fat32 1MiB 513MiB
# Make it bootable
set 1 boot on
# Create 2GiB swap
mkpart primary linux-swap 513GiB 2513GiB
# Use the rest for root
mkpart primary ext4 2513GiB 100%
This did not work :( the VM was unable to boot up. Tried BIOS/MBR instead.
Created
parted /dev/sda
# Make a GPT partition table
mklabel msdos
# Create 2GiB swap
mkpart primary linux-swap 1MiB 2GiB
# Use the rest for root
mkpart primary ext4 2GiB 100%
# Make root bootable
set 2 boot on
Firewall
Adapted an old project
and things work as expected. Don’t forget to enable the service
systemctl enable iptables.service
Package Management
and other stuff
Official Repos
pacman
is meat and potatoes of package management from ‘official’ sources.
Like CentOS/Red Hat, here’s “base”, “extra”, and “community”. Packages get
here in a highly vetted way. The
wiki is a great handbook.
# Search for stuff
pacman -Ss node
# Install stuff
pacman -S nodejs
# Remove stuff and deps (if not needed by other stuff)
pacman -Rs nodejs
# Clean cache
pacman -Scc
# Upgrade whole system
pacman -Syu
Unofficial Repo
For everything else, there’s the Arch User Repository
(AUR) which has nearly 30,000 (!) packages. The
usual caveats of non-official sources apply here. To install anything, get a
PKGBUILD
file for the package, then
# Make the package with deps and remove them after successful build
makepkg -sr
# Generates a .tar.xz file. Install with pacman
pacman -U package.tar.xz
# Short form
makepkg -sri package.tar.xz
Important: You can’t run any makepkg
commands as root
!
And then there’s Yaourt which
provides a unified interface to pacman
and the AUR. Install it like any
other package
# Be clean
mkdir tmp && cd tmp
# Install package-query as a dep
curl -o package-query https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=package-query
makepkg -sri -p package-query
# Install yaourt
curl -o yaourt https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yaourt
makepkg -sri -p yaourt
All done!
$ yaourt -Ss pyenv
aur/pyenv 20151222-1 [installed] (3)
Simple Python version management
aur/pyenv-virtualenv 20151103-1 [installed] (0)
pyenv plugin to manage virtualenv (a.k.a. python-virtualenv)
Adding Mirrors
reflector
will fetch the latest mirrors based on some criteria you provide
it (e.g. I want HTTPS and IPv6 only.) You can do this
online as well.
Other Notes
- The Arch Wiki has pretty much everything I needed, written in a clear and
concise way. genfstab
won’t write the swap partition if you don’tswapon
!- Unset
GREP_OPTIONS
if you don’t want to go insane with warnings… - Export
$EDITOR
when usingvisudo
else you’ll see a screen full of
“EOF”
messages.
/tmp
size
This is set to a small, fixed size which is a good
thing. To install stuff, read the docs about
some way to set the temporary folder. For example, pyenv
allows you to
export $TMPDIR
before installation. I use /var/tmp
TMPDIR=/var/tmp pyenv install 3.5.1
However, this can be a little annoying. systemd
is the one that creates this
mount (since I couldn’t find it in /etc/fstab
… since I created it myself
with genfstab
!) with this
/usr/lib/systemd/system/tmp.mount
One option would be to rename. A better one would be to simply mask it
systemctl mask tmp.mount
Setting /tmp
to a fixed size is still good. But it seems to use half the
RAM; with my VPS box, this is untenable. Since I get tons of storage (and very
little memory), I resorted to creating a 5-10GiB partition just for /tmp
.
References
- Using
journalctl
- Linode/Arch issues 1, 2