Box

From Things and Stuff Wiki
Revision as of 15:20, 4 February 2016 by Milk (talk | contribs) (→‎Laptop)
Jump to navigation Jump to search


Quick setup snippets for my personal dotconfigs, etc.

See also Stack, *nix#Configuration_2

Arch Linux install

Arch Linux, bspwm, sxhkd, dmenu_run.pl, xfce4-panel, urxvt(c), zsh, vim

Setup, format, bootstrap, chroot

  1. arch linux install from archiso usb drive
  2. requires network connectivity, possibly wired, to be available
  1. set keyboard for UK qwerty

loadkeys /usr/share/kbd/keymaps/i386/qwerty/uk.map.gz

  1. check for potentially failed services (i.e. network dhcp)

systemctl --failed

  1. turn ntp time updates on

timedatectl set-ntp true

  1. create drive partitions

cfdisk

  1. see also https://wiki.archlinux.org/index.php/Partitioning
  2. there can be only 4 'primary' partitions
  3. make the fourth 'extended' so it can contain further 'logical' partitions
  4. only primary and logical partitions are formatted
  1. / - root partition, will contain /usr (includes installed programs) - 20/25Gb - Bootable - Type: linux (83)
  2. /boot - contains boot kernel images, 100Mb for no extra kernel images, 200Mb safer for additional images (linux-ck, linux-lts, etc.) - Type: linux (83)
  3. /var - contains misc. including spools, logs, packages downloaded for installation. separate to avoid running out of space. 10Gb
  4. /home - contains user home folders, where media will be stored - size: remainder Type: linux (83)
  5. [swap] - swap partition - 1Gb - Type: linux swap (82)
  1. check and format drive partitions

lsblk

mkfs.ext4 /dev/[partition]

  1. repeat for each partition, excluding swap
  1. create swap partition

mkswap /dev/[swappartition] swapon /dev/[swappartition]

  1. mount partitions

mount /dev/sda1 /mnt

mkdir /mnt/boot mount /dev/sda2 /mnt/boot

mkdir /mnt/var mount /dev/sda3 /mnt/var

mkdir /mnt/home mount /dev/sda5 /mnt/home

  1. use geographically close arch package mirror

vi /etc/pacman.d/mirrorlist

  1. put selected mirror at top of the list. this is copied across in the next step
  1. install pacman and bootstrap

pacstrap /mnt base bade-devel vim

  1. generate file system configuration info

genfstab -p /mnt >> /mnt/etc/fstab

  1. chroot into new system

arch-chroot /mnt

Configuration

# set root user password
passwd

# add your own user account and set a password
useradd -m [USERNAME]
passwd [USERNAME]

# let wheel group use sudo for root permission
visudo
# uncomment %wheel      ALL=(ALL) ALL

## USERNAME HOST_NAME= NOPASSWD: /usr/bin/halt,/usr/bin/poweroff,/usr/bin/reboot,/usr/bin/pacman -Syu

# add user to wheel group for sudo/etc, access
gpasswd -a [USERNAME] wheel


# set a hostname
echo computer_name > /etc/hostname

# set timezone
ln -s /usr/share/zoneinfo/Europe/London /etc/localtime

# uncomment en_GB.UTF-8 or appropriate locale
vim /etc/locale.gen
/#en_GB
xZZ

# generate locale
locale-gen

# set locale conf
echo LANG=en_GB.UTF-8 > /etc/locale.conf

# set persistant console keymap and font preferences in /etc/vconsole.conf
vim /etc/vconsole.conf
i
KEYMAP=uk
[esc]ZZ

Images

# uncomment COMPRESSION="xz" in /etc/mkinitcpio.conf
vim /etc/mkinitcpio.conf

# build boot images
mkinitcpio -p linux

# install lts kernel
pacman -S linux-lts

# install a bootloader. tried syslinux before, trying grub now. first impression, syslinux is cleaner.
pacman -S grub
grub-install --recheck --target=i386-pc /dev/sdx

# allow for saving the last booted kernel, edit /etc/default/grub, set
GRUB_DEFAULT=saved
# and add
GRUB_SAVEDEFAULT=true

# generate/regenerate config file
grub-mkconfig -o /boot/grub/grub.cfg

# syslinux route instead; will require some *.c32 symbolic links


# install wpa_supplicant for later wifi setup
pacman -S wpa_supplicant

# reboot
# ctrl-alt-del is quickest

Network

# set network device names in relation to their MAC
vim /etc/udev/rules.d/10-network.rules

echo 'SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="$(cat /sys/class/net/ethernetinterfacename/address)", NAME="eth0"' > /etc/udev/rules.d/10.network.rules
echo 'SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="$(cat /sys/class/net/wifiinterfacename/address)", NAME="wlan0"' >> /etc/udev/rules.d/10.network.rules

# setup netctl (arch dev grown systemd interface)
cp /etc/netctl/examples/ethernet-dhcp /etc/netctl
cp /etc/netctl/examples/wireless-wpa /etc/netctl
vim /etc/netctl/wireless-wpa
# change essid and key

# test netctl ethernet profile
netctl start ethernet-dhcp
ip a
ping bbc.co.uk
netctl stop ethernet-dhcp

# test netctl wireless-wpa profile
netctl start ethernet-dhcp
ip a
ping bbc.co.uk
netctl stop wireless-wpa

# make ethernet profile persistant
netctl enable ethernet-dhcp


(
# set dns resolver (router)
vi /etc/resolv.conf

)

Video, etc.

# find out graphics chipset
lspci | grep -e VGA -e 3D

# find gfx chipset drivers to install
pacman -Ss xf86-video | grep ##something##

# install gfx drivers
pacman -S xf86-video-ati # etc.

# hardware video acceleration
pacman -S libva-mesa-driver 

# bootstrap AUR access with AUR helper yaourt
# https://www.digitalocean.com/community/tutorials/how-to-use-yaourt-to-easily-download-arch-linux-community-packages

echo "[archlinuxfr]" >> /etc/pacman.conf
echo "SigLevel = Never" >> /etc/pacman.conf
echo "Server = http://repo.archlinux.fr/$arch" >> /etc/pacman.conf

# install required basic commands
pacman -Sy yaourt

# now remove last three pacman.conf lines
# and make yourself non-root


# install various apps
yaourt -S pm-utils zsh openssh tmux htop atop tree friendly-find xorg-server xorg-xinit xorg-xsetroot xorg-xrdb xorg-xset udiskie bspwm-git sxhkd-git rxvt-unicode-fontspacing-noinc-vteclear-secondarywheel terminus-font autocutsel compton dunst feh dmenu xfce4-panel pnmixer-git redshift unclutter radiotray lxappearance xscreensaver lightson-git workrave 

# setup encrypted dns
dnscrypt-autoinstall

# audio apps
yaourt -S jack2 pulseaudio-jack cadence-git carla-git

to sort

# slim slim-themes 
# mdm seems better, fork of gdm, animated images



# make slim login desktop manager start automatically
systemctl enable slim.service

# edit slim config - default_user, focus_password, current_theme sleep-openbox
vi /etc/slim.conf


SSH and dotfiles

# Generate [[SSH]] key
 ssh-keygen -t rsa -b 4096 -C "your_email@example.com" [https://help.github.com/articles/generating-a-new-ssh-key/]

eval "$(ssh-agent -s)"
# Ensure ssh-agent is enabled for this shell instance

ssh-add ~/.ssh/id_rsa
# Add your SSH key to the ssh-agent


# install; vcsh myrepos
yaourt -S vcsh-git

# bootstrap vcsh
vcsh clone git@github.com:milkmiruku/vcsh-mr.git

# edit config.d symlinks to available.d
cd .config/mr/available.d
etc.

# mr bootstrap
mr up

Laptop

# Set up touchpad

yaourt -S xf86-input-libinput

sv /etc/X11/xorg.conf.d/30-touchpad.conf

Section "InputClass"
        Identifier "MyTouchpad"
        MatchIsTouchpad "on"
        Driver "libinput"
        Option "Tapping" "on"
EndSection

old Ubuntu setup

ooold * https://github.com/milkmiruku/boxbootstrap/blob/master/box1.5 hostname new.host.name sudo apt-get update sudo apt-get install tmux git git clone git@github.com:milkmiruku/dottmux.git ~/.tmux ln -s ~/.tmux/.tmux.conf ~/.tmux.conf tmux sudo apt-get install curl zsh ncdu htop tree mercurial build-essential gcc libc6-dev ncurses-dev sudo git clone git@github.com:milkmiruku/zsh.git ~/.zsh && cd ~/.zsh && sudo git submodule init && sudo git submodule update # edit zshrc location config useradd -m -s /usr/bin/zsh milk passwd milk adduser milk sudo sudo apt-get remove vim vim-runtime gvim # (disable distro vim. not possible with apt on ubuntu [1]) mkdir ~/src && mkdir ~/src/vim hg clone https://vim.googlecode.com/hg/ ~/src/vim && cd ~/src/vim && ./configure --enable-pythoninterp=yes && make && sudo make install cd git clone git@github.com:milkmiruku/dotvim.git ~/.vim ln -s ~/.vim/vimrc ~/.vimrc mkdir ~/.vim/bundle git clone git://github.com/Shougo/neobundle.vim ~/.vim/bundle/neobundle.vim echo ':NeoBundleInstall' > ~/viminit.txt echo ':q' >> ~/viminit.vim vim -s ~/viminit.vim rm ~/viminit.vim wget -O src/atop.tar.gz http://www.atoptool.nl/download/atop-2.0.2.tar.gz && cd ~/src && tar zxvf atop.tar.gz && cd ~/src/atop && ./configure && make && make install cd vim /etc/ssh/sshd_config # disable root, change port, etc. ssh-keygen -t rsa # (for user and root?) To sort: multiuser config. permissions? Or /usr/share/config/ ... apt-get install php mariadb apt-get install ruby rubygems apt-get install python pip backup

Install

* archinstaller - Automated installation script for arch linux written in bash. It works similar to preseeding the debian installer d-i. * FAI is a non-interactive system to install, customize and manage Linux systems and software configurations on computers as well as virtual machines and chroot environments, from small networks to large-scale infrastructures like clusters and cloud environments. It's a tool for unattended mass deployment of Linux. You can take one or more virgin PC's, turn on the power, and after a few minutes, the systems are installed, and completely configured to your exact needs, without any interaction necessary. * https://wiki.debian.org/DebianInstaller/Preseed * Automating Debian Installs With Preseed and Puppet

Backup

See also Backup Borg pacman -Qqe # list intentionally installed packages Backup paths; /home/* /etc /var /boot etc..