| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Cookbook for setting up a Linux development box.
Right now this assumes an arch linux system but my tastes change frequently.
Arch should be installed, and basics like disk encryption, boot loaders, network configs should be done. A non-privileged user should be created with sudo privileges, and the running of the Ansible playbooks should be done by that user.
Some reminders about the setup process:
Start with the install guide which covers things in some detail
If this is a HiDPI system the console fonts are painfully small. Run this command to temporarily fix: setfont latarcyrheb-sun32 -m 8859-2
Setting up wifi is not straightfoward:
Pro-tip: You can use Alt-RightArrow to switch to another virtual TTY and use elinks to view this guide in a text-based web browser for easy reference as you switch back and forth between it and the install console. Use g to go to a URL and vi navigation keys to move around.
Disk partitioning is tricky because we will use LUKS to encrypt the disk and LVM on top
Once the disks are configured it's time to install packages
arch-chroot /mnt to chroot into the new system and begin setting it up
pacman -Sy vim to get an editor installed right away
Set the time zone with ln -sf /usr/share/zoneinfo/Region/City /etc/localtime. Eastern is usually US/NewYork or some such.
Set the system clock to UTC. This is a Linux convention not Windows so be careful if you dual boot. hwclock --systohc
Ensure the system clock is synchronized with timedatectl set-ntp true
Edit /etc/locale.gen and uncomment the locales to use. I only ever use en_US.UTF-8 but maybe es_ES.UTF-8 and ru-RU.UTF-8 might come in handy.
Run locale-gen to generate those locales
Edit /etc/locale.conf to set LANG=en_US.UTF-8 to make sure US English is the default locale.
I never have to edit the keyboard layout since US English is the default, but that's in /etc/vconsole.conf
Choose a hostname and put it in /etc/hostname
Populate /etc/hosts accordingly with that new hostname:
127.0.0.1 localhost
::1 localhost
127.0.0.1 myhostname.localdomain myhostname
You'll need the wireless utilities you used in the LiveCD when you reboot in order to get the new system on the network. pacman -S iw wpa_supplicant networkmanager dialog at the least. I don't have to manually install firmware but that will depend upon the system.
pacman -S intel-ucode to install the latest Intel microcode updates
I also install zsh here with pacman -S zsh because I like my non-privileged user to run ZSH
Now it's time to configure the boot loader. I use systemd-boot:
Assuming not dual-booting windows:
bootctl --path=/boot install installs the boot loader into the UEFI system partition
edit /boot/loader/loader.conf to adjust the default entry to boot and the timeout. Normally the default entry is arch
Created or edit /boot/loader/entries/arch.conf to configure how arch is booted. In particular some changes are needed to support the encrypted filesystem. There's a sample at /usr/share/systemd/bootctl/arch.conf to use as a starting point:
Here's an example config:
title Arch Linux Encrypted LVM linux /vmlinuz-linux initrd /intel-ucode.img initrd /initramfs-linux.img options cryptdevice=UUID=device-UUID:cryptolvm root=/dev/mapper/MyVol-root quiet rw
Note the device-UUID is the UUID of the encrypted physical block device. The command to get this is blkid -s UUID -o value /dev/(partition). A fun trick in vi when editing this file if you want to insert this UUID is to put the cursor where you want the ID inserted and run an Ex command :r ! blkid -S .... filling out the entire blkid command listed earlier. Note also the /intel-ucode.img use this only on Intel systems and only if the intel_ucode package is installed.
Add keyboard, encrypt, and lvm2 HOOKS to /etc/mkinitcpio.conf. Be advised order is important. NOTE: technically Ansible will do this for you as part of the setup process, but you need to do encrypt and lvm2 here in order for the system to be able to boot, so you may as well do keyboard as well while you're in here, and if you're on an XPS system see the line below for some additional modules you should add at the same time.
For XPS systems: Add nvme i915 intel_agp MODULES to /etc/mkinitcpio.conf. NOTE: technically Ansible will do this for you as part of the setup process
Regenerate the initramfs with mkinitcpio -p linux
passwd to set a root password
Create an unprivileged user that can use sudo with useradd -m -G wheel -s /bin/zsh sumd00d
Set a password for that user with passwd sumd00d
Install the sudo package with pacman -S sudo
Run visudo and uncomment the line that allows all sudo commands for members of wheel
I like to su sumd00d at this point to log into the unprivileged user shell to make sure it works. Sometimes I forget something (often zsh).
Exit the chroot with exit and then reboot to boot into the live system.
On laptops some additional configuration is needed to support hibernating to disk.
The Arch wiki as usual is the definitive source of information. Some summary items based on my prefered config:
If this is a fresh system also make sure you have the minimal dependencies that are required to run ansible:
$ sudo pacman -S git git-lfs ansible python
To start with, clone this repo somewhere. IMPORTANT: make sure you remember to run the git submodule and git lfs steps also or the playbook won't work!
$ git clone https://github.com/anelson/linux_devbox . $ cd linux_devbox $ git submodule update --recursive --init $ git lfs pull
The ansible playbooks depend on some roles in Ansible Galaxy which need to be installed. Install them once with
$ ansible-galaxy install -r requirements.yml
run from the playbooks/ directory.
There are a few versions of the setup script:
As per Ansible convention, all of these are located in the playbooks/ directory.
NB: In this repo there is a playbooks directory containing the playbooks. You must cd into this directory before running ansible-playbook, because the ansible.cfg file must be in the current directory and must be relative to the library subdirectory due to a bug in Ansible module discovery logic as of version 2.4.
Ansible normally assumes it can SSH into the target host using SSH keys. If instead you want to run it on the local host, run it (as a non-privileged user with sudo permissions) as:
$ cd playbooks $ ansible-playbook -c local --inventory localhost, --ask-become-pass desktop-devbox.yml OR for XPS systems... $ ansible-playbook -c local --inventory localhost, --ask-become-pass xps-devbox.yml
After running this the first time, reboot the system. It should come up with GDM and prompt you to log in. i3 will be an option, and sway also. For now I'm sticking to Xorg so the Wayland-based configs are not tested as of now.
If you're setting up a remote system over SSH, there are some changes to the command line:
$ ansible-playbook --inventory <remote host>, --user <probably root> headless-devbox.yml
NOTE: Just because you're doing a remote setup doesn't mean you can ignore the pre-reqs that normally apply to a local install. Make sure you have at least these:
$ sudo pacman -S python sudo
If you're doing the user-specific setup also, you'll probably want to configure SSH certificate auth for that user. If you're still using the Yubikey-based auth approach, you'll need to do this:
$ ssh-copy-id -f -i ~/Dropbox/Documents/gpg/yubikey_auth_cert_for_ssh.pub username@hostname
Once the system-wide setup is completed, there's another playbook that runs as the non-privileged user you set up at install time, and configures that user's home directory the way I like. That runs the same way:
$ ansible-playbook -c local --inventory localhost, desktop-devuser.yml OR for XPS... $ ansible-playbook -c local --inventory localhost, xps-devuser.yml
As with the system setup, there are a few versions of the devuser script with the same prefixes we use for the system version.
Most of those install IntelliJ. If you haven't done an install lately, edit the playbooks/roles/user-intellij/vars/main.yml file and make sure the most recent version is downloaded. If you want to upgrade IntelliJ later, you can also update var and re-run the devuser.yml playbook.
Unfortunately there are some steps that it't not practical or possible to automate, or that I haven't figured out yet. They are recoreded here so I don't forget to do them:
When doing Arch system updates the /etc/fwupd/uefi.conf file can get overwritten which means fwupdmgr seems to work but no firmware actually gets upgraded on reboot. You must make the edit described in this article at the bottom of the page. This is what the line should look like:
# For fwupdate 10+ allow overriding # the compiled EFI system partition path OverrideESPMountPoint=/boot
Currently my dotfiles repo has a Git config that uses the built-in store helper, which stores credentials on the filesystem unencrypted. I use FDE so they're still encrypted before they hit the disk, but other user-land processes running under my account can read them. That's not ideal.
Long story short I tried to find a good solution here that works for headless and headed systems and it seems impossible. So instead I use Git certificate auth from a Yubikey. There's a page in the vimwiki about how to set this up. The dotfiles are already configured for it.
In general, you should never use pip or gem to install system packages. Installing them as user packages into your home directory is fine, but if you ever find yourself typing sudo pip... or sudo gem..., slap yourself on the wrist and see if there's an Arch official or AUR package for what you're trying to install. In almost all cases, you don't mean to install systemwide but for a specific user account or perhaps even a specific project. Always prefer that.
| Back | FazBrowse Home | New Git URL |