That new-Ubuntu smell

Installing Linux has gotten pretty easy.

Depending on the flavor needed and the destination two utilities come in handy to make the needed USB boot sticks:

I’m using Ubuntu 22: https://ubuntu.com/download/desktop

To do this install I put the imaged USB drive into the target machine and held down the DEL key. F7 would have worked, but DEL goes to the boot settings and I can set the machine to always prefer the key if it’s plugged in. Since this machine will likely get re-imaged fairly often, that’s what I want.

Here’s some common commands used during a setup.

Why not Docker? I’ll use Docker fine for DigitalOcean droplets or GitHub Actions or whatever. I installed something that uses it (swiftly). I don’t need it for what I’m doing in general though. I have a bash script for when I’m not rethinking the set up. Writing things down took longer than doing it.

Hardware Fixes

My new little box couldn’t see its wifi card. Fix worked. Required ethernet.

  ###  resolving wifi issues
    3  cat /etc/motd
    4  cat /etc/issue
    8  sudo dmesg | grep wifi
    9  sudo add-apt-repository ppa:cappelikan/ppa
   10  sudo apt update && sudo apt full-upgrade
   41  lshw
  139  ip
  140  ip link show
  141  ip address show

Git

https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup

On a properly configured machine run cat ~/.gitconfig to see what’s there. If it’s exactly right and it’s easy, copy it over. Otherwise here are the basics.

  247  git config --global init.defaultBranch main
  248  git config --global user.name "$(YOUR_NAME)"
  249  git config --global user.email $(YOUR_EMAIL)
  250  git config --global alias.start-repo '!git init . && git add . && git commit --allow-empty -m "Initialize repository"'

On Linux the global .gitignore with .DS_Store in it is less of a big deal to do.

The default editor can be changed in two ways, for git only of for the system:

## for the system
update-alternatives --display editor  # on Ubuntu will likely be nano
sudo update-alternatives --config editor #dialog with currently installed editors

## just for git
git config --global core.editor $(YOUR_FAV_EDITOR_AND_ITS_WAIT_FLAG)

When updating the editor for git, if your editor has a wait flag, use it

Also, depending on what I’ll be doing on the image, the git extension for large file storage can also be handy.

  269  sudo apt-get install git-lfs
  270  git lfs install

VSCode

https://code.visualstudio.com/docs/setup/linux

  ###  installing VSCode
   23  cd Downloads/  # got it from the page auto download. 
   24  sudo apt install ./code_1.86.2-1707854558_amd64.deb 

Like with git can check a known good machine get what extensions to install if not already using Settings Sync or a Profile.

## old machine
code --list-extensions > vscode-extensions.list 
## new machine
cat vscode-extensions.list | xargs -L 1 code --install-extension 

Swift

Last time I used the tarball. This time I’m using swiftly as an experiment. (swiftbox and swiftenv also great choices.) Swiftly actually uses the official docker images to do its thing.

The actual install for swiftly: very smooth. 5 out of 5 stars using it to get to the nightly build up and running. Most of these commands were exploring if I could help the repl find lldb without the known needed extra install and fix. I could not. Moved on.

  ###  installing swift / swiftly
   12  sudo apt install curl
   13  curl -L https://swift-server.github.io/swiftly/swiftly-install.sh | bash
   14  . $HOME/.local/share/swiftly/env.sh
   15  swiftly install latest
   16  which which clang make git swift lldb

   29  ls ../.local/bin/clang
   30  ls -la ../.local/bin/
   40  ldd `which swift`
   60  echo $PATH
   63  cat ~/.bashrc
   64  hash -r
   65  swift repl
   66  swiftly use latest
   77  code ~/.bashrc
   78  which python3
   79  ls /usr/lib/llvm-14 #nope, not there yet
   82  ls -la /usr/lib
   84  ls -alrth
  127  lldb --help
  128  lldb --python-path  ##<--- AND HERE IS THE SAME ERROR as REPL
  
  146  swift package init --type tool
  147  swift run  #works
 
  ### spm also worked fine for 
  165  swiftly install main-snapshot
  165  swiftly use main-snapshot
  168  swiftly install 5.10-snapshot
  170  swiftly use 5.10-snapshot

Homebrew

I primarily use apt-get, but I recently learned homebrew was a thing on Linux, so why not?

https://github.com/Homebrew/brew#donations

###  installing homebrew
216  sudo apt-get install propcps

218  sudo apt-get install build-essential # <== important would do anyway

219  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
220  (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/$(YOUR_USER)/.bashrc
221  eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Makes its own user. Fascinating.

Some of the other faves

  278 sudo apt-get install ffmpeg imagemagick libpng-dev cmake hugo

Not Yet

All of these will be done but on demand. pyenv I’ve used via homebrew on macOS. Not sure if I’ll do it that way on Ubuntu.