8 min read

Setting up Ubuntu 20.04 LTS

No tags available

I recently had the chance to set up Ubuntu on several different hard drives I iterated through. I’ve come up with a procedure that seems to work for me to set up my environment the way I like it.

# Get started
sudo apt install emacs meld cifs-utils samba-common nfs-client hardinfo default-jre
### Done

# Configure git
git config --global user.email "andrewmemory@example.com"
git config --global user.name "Doctor Memory"
git config --global core.autocrlf input
git config --global credential.helper cache --timeout=36000
git config --global diff.tool meld
### Done

# Swizzle userids
# as andrewmemory
sudo adduser andrewmemorybackup
# edit /etc/group and replace andrewmemory with andrewmemory,andrewmemorybackup
# change andrewmemory to 3000
# change sambashare to 3001
# as andrewmemorybackup
sudo vipw
cd /home/
sudo chown -R andrewmemory.andrewmemory andrewmemory
# while we're here, let's put us in dialout
sudo usermod -a -G dialout andrewmemory
sudo usermod -a -G dialout andrewmemorybackup
### Done

# Set up CIFS credentials
credentials directory in /etc/samba/credentials
700
file in /etc/samba/credentials/server
user=andrewmemory
password=secret
### Done

# Add to /etc/fstab:
tmpfs    /tmp    tmpfs    size=512m    0    0
tmpfs    /var/tmp tmpfs    size=512m    0    0
//server.example.com/music			  /music	  cifs	  x-systemd.automount,uid=3000,gid=3001,credentials=/etc/samba/credentials/server,sec=ntlmssp	0	2
server.example.com:/shared			/shared	nfs4	defaults,user,exec	0	2
server.example.com:/shared			/nfsshared	nfs4	defaults,user,exec	0	2
### Done

# Get most of the packages
sudo apt install \
emacs \
git \
nfs-client \
cifs-utils \
samba-common \
hardinfo \
default-jre \
gnucash \
gcc \
abcde \
audacity \
imagemagick \
bind9-dnsutils \
net-tools \
brasero \
bsdutils \
bzip2 \
cdparanoia \
default-jdk-headless \
dnsutils \
dos2unix \
dosfstools \
e2fsprogs \
easytag \
evince \
exfat-fuse exfat-utils \
ffmpeg  \
filezilla \
flac \
toilet \
toilet-fonts \
flatpak \
font-manager \
fontmatrix \
ftp \
g++ \
gawk \
gdb \
genisoimage \
ghostscript \
gnuplot \
growisofs \
icc-profiles-free \
icc-profiles \
keepassx \
lame \
make \
meld \
ntpdate \
ntp \
obs-studio \
openscad \
patch patchutils \
ps2eps psmisc pstoedit psutils \
python3 \
rsync \
sharutils \
sntp \
splat \
tcl tk \
unrar unzip zip \
vice \
vorbis-tools \
wget \
wine-stable \
whois \
xz-utils
### Done

sudo apt remove rhythmbox; sudo apt autoremove
### Done

# TeXlive
sudo mkdir /usr/local/texlive
sudo chown andrewmemory.andrewmemory /usr/local/texlive
cd /shared/archive/apps/TeX/TeX2021/TEXCOL2021/texlive
./install-tl --gui
# default paper size Letter
### Done

# TeXstudio
sudo apt --no-install-recommends install texstudio
### Done

# Gimp
flatpak install https://flathub.org/repo/appstream/org.gimp.GIMP.flatpakref
cp /shared/backup-home/usr.bin.gimp ~
# Where usr.bin.gimp is just a call to
#  flatpak run org.gimp.GIMP//stable "$@"
sudo cp ~/usr.bin.gimp /usr/bin/gimp
sudo chmod 755 /usr/bin/gimp
cp /shared/gimp/*.scm ~/.var/app/org.gimp.GIMP/config/GIMP/2.10/scripts
### Done

# KiCAD
sudo add-apt-repository --yes ppa:kicad/kicad-5.1-releases
sudo apt update
sudo apt install --install-recommends kicad
# If you want demo projects
sudo apt install kicad-demos
### Done

# Firefox
# Disable sharing info
# Under Downloads, "Always ask where to save files"
# Under Startup, "Restore previous session"
# Under Data Collection, uncheck all
### Done

# any crontabs? - no
### Done

# ltspice - executable called LTspice.exe - install under wine
# there are links on the desktop, some config under /home/andrewmemory/andrewmemory/.wine/drive_c/Program Files/LTC/

# FontForge
# Go to https://fontforge.org/en-US/downloads/gnulinux-dl/
# See if there's anything newer than 2020-11-07
# if there is, get it, otherwise copy from /shared/backup-home/home/andrewmemory/andrewmemory
cp /shared/backup-home/home/andrewmemory/andrewmemory/FontForge-2020-11-07-21ad4a1-x86_64.AppImage ~
### Done

# the AppImages: under /home/andrewmemory/andrewmemory (or get the latest)
FreeCAD_0.18-16146-Linux-Conda_Py3Qt5_glibc2.12-x86_64.AppImage

# Android Studio
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 openjdk-11-jdk
sudo add-apt-repository ppa:maarten-fonville/android-studio
sudo apt update
sudo apt install android-studio
# Install KVM
sudo apt install cpu-checker
kvm-ok
# Assuming it's OK:
sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo adduser andrewmemory libvirt
sudo adduser andrewmemory kvm
sudo adduser andrewmemorybackup libvirt
sudo adduser andrewmemorybackup kvm
sudo chmod u+x /var/run/libvirt/libvirt-sock
sudo chmod g+x /var/run/libvirt/libvirt-sock
# Reboot
sudo chmod 755 /opt
cd /opt/android-studio/bin
./studio.sh
# Update everything...
# Open project /shared/development/AndroidStudioProjects/
# Tools -> Create Desktop Entry
# File -> Settings
# Install Android SDK Command-line Tools, Google Play services
# Accept licenses
yes | ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --licenses
# Build -> Rebuild Project
# ... go away for 30 minutes (!)
# Click "Select a JDK" in the event log and pick /opt/android-studio/jre
# Tools -> AVD Manager
# Create Pixel 4a, Download Android 30
# Settings -> Memory Settings, choose IDE Max Heap 2048M
#
# Just so I can build projects with the shared keys I used before:
cd ~
cp /shared/backup-home/debug.keystore ~/.android/
### Done

# Arduino
# Download from https://www.arduino.cc/en/software
# Extract the .tar.gz (currently in Downloads)
tar xf arduino-1.8.16-linux64.tar.xz
cd arduino-1.8.16/
sudo ./install.sh
# Need to install libraries as well...

# Set up environment
# /home/andrewmemory (with VISUAL, EDITOR, etc...)
# at the end of ~/.bashrc put:
export VISUAL=/usr/bin/emacs
export EDITOR=$VISUAL
export PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
# Log out and back in
### Done

# Set up log2ram (I probably should have done this earlier)
echo "deb http://packages.azlux.fr/debian/ buster main" | sudo tee /etc/apt/sources.list.d/azlux.list
wget -qO - https://azlux.fr/repo.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install log2ram
# To control: sudo systemctl stop log2ram
# To uninstall: sudo apt purge --remove log2ram
### Done

# Don't forget the udev rules for things I did...

# Fonts
sudo apt install fonts-noto fonts-noto-extra fonts-noto-mono
# Manually install:
#  /shared/fonts/*.?tf
### Done

# Also manually install brscan / brother stuff
# go to https://www.brother-usa.com/support/mfcl2750dw
# Download linux-brprinter-installer-2.2.3-1.gz
gunzip -d linux-brprinter-installer-2.2.3-1.gz
sudo bash ./linux-brprinter-installer-2.2.3-1 MFC-L2750DW
# Specify DeviceURI? I said "No", although it says to say "Yes" for network.
### Done

# Thunderbird
thunderbird -ProfileManager
# create a "Default User" profile and an "andrewmemory network" profile
# exit Thunderbird
# edit ~/.thunderbird/profiles.ini and set the andrewmemory network profile to:
Name=andrewmemory network
IsRelative=0
Path=/shared/thunderbird/andrewmemory
# I also set Default=/shared/thunderbird/andrewmemory
thunderbird -ProfileManager
# Set to open andrewmemory network by default
### Done

# GnuCash
# Start GnuCash
# Click Cancel
# Open /shared/accounts/accounts.gnucash
# Expand Accounts and click on Checking Account
# View -> Transaction Journal
### Done

# Set up my static IP
ifconfig
# eno1 says ether 00:01:02:03:04:05
ssh root@firewall
# delete the lease from /var/db/dhcpd.leases
ps -aux | grep dhcp
# Kill /usr/sbin/dhcpd
rw
emacs /etc/dhcpd.conf
        host newhost {
                hardware ethernet 00:01:02:03:04:05;
                fixed-address 192.168.1.2;
                option host-name "newhost"; 
        }
# save
cd /var.named/named/etc/namedb
emacs db.example
newhost.example.com.              IN A    192.168.1.2
# update serial number
# save
emacs db.example.rev
2.1.168.192.in-addr.arpa.   IN PTR  newhost.example.com.
# update serial number
# save
reboot ### On firewall, not on the desktop!
# wait a bit until you can ssh into firewall again
# reboot the desktop
ifconfig
# verify that the IP address is right
sudo apt install openssh-server
### Done

# Cura
# Install latest Cura .appImage in ~ from
#   https://ultimaker.com/software/ultimaker-cura
# Create (non-networked) Creality Ender 3 with default options
# Open Marketplace, go to Plugins, install OctoPrint Connection
# Quit and restart Cura ~/Ultimaker*
# Load a model and slice
# Settings -> Extruder 1 -> Materials -> Manage Materials
# Create 3D Solutech PLA as a copy of Generic PLA, set cost, weight
#  I just used 1000g because... that's what it started out as
# Set Print Settings build plate temp to 60 C
# Create Hatchbox PLA as a copy of 3D Solutech PLA
# Settings -> Printers -> Creality 3 -> Manage Printers
# Turn on octopi.example.com
# Connect Ocotoprint
# Add octopi - octopi.example.com - 80 - /
# Request API key
# Log into OctoPrint
# Select "Start print job after uploading" and "Connect to printer before sending". Deselect the rest.
# Uncheck "Automatically discover local OctoPrint instances"
# Settings -> Setting Visibility -> Check All
# For each profile: Profiles -> Customize
#  Z Seam Alignment = Randomize
# Preferences -> General -> Currency ($)
#  Opening and saving files -> Unselect "Add machine prefix to job name"
#  Uncheck "Send anonymous print information"
### Done

# OpenSCAD
# There's a setting under "Advanced" that lets you undock. Enable that.
### Done