Install Linux Mint on a Macbook Air
A set of tips for installation and post install

1 Introduction
The specific goal of this “DIY” project is to refurbish a seven year old macbook air laptop with a modern linux operating system. The OS we’ll focus on for this post is Linux Mint 22. Why Mint? Well, as its been, “since the beginning” of the linux era (circa 1993) the main challenge to installing a linux distribution on almost any PC or mac is wrestling with the hardware drivers: notably video, audio, trackpad and power management drivers. The Mint distro provides a solution the drivers needed for our target macbook air, making the install much, much more straightforward. There are many other considerations that can go into choosing a linux distribution, but for our purposes, this is the main one.
To get started acquire a copy of the Mint distribution. The simplist way to do this is to download the latest Linux Mint ISO image file using an already setup workstation, and “burn” it onto a USB drive. For example use a “mac” laptop with macos installed. Confirm internet connectivity is available (Wifi or ethernet), and the machine has at least one external port.
1.1 Install Mint on a macbook air
The target machine is a 2016 13-inch MacBook Air with four Thunderbolt 3 Ports.
To start the process download an iso file from the Mint website. The current “Virginia” version of Mint iso file is 3.07 GB in size. The “Cinnamon” edition is recommended.
Specifically, download the torrent file for Linux Mint 22 Wilma Cinnamon edition. linuxmint-22-cinnamon-64bit.iso.torrent Install the mac app Transmission and add the torrent file.
Also download the associated sha256sum.txt file.
To check the integrity of your local ISO file, generate its SHA256 checksum and compare it to the content of the sha256sum.txt file:
> sha256sum -b linuxmint-22-cinnamon-64bit.isoWe can transfer the iso file to a USB flash drive using one of several methods. On macos we suggest using the app balanaEtcher. You can download balanaEtcher
Insert the bootable USB flash drive into the target macbook and reboot. Hold the ALT key while the machine reboots and you’ll be presented with a screen offering boot drive options. Select the icon for the USB drive. A grub menu will appear.1
1 GNU GRand Unified Bootloader (GRUB). “When your Linux operating system starts up, GRUB is the first program that runs. It loads the kernel of the operating system, and then the kernel loads the rest of the operating system, including the shell, the desktop environment, and other operating system features.” codecademy.com
From the Grub menu choose Start Linux Mint 22 Cinnamon 64-bit. and the Mint install program will start.
A linux mint desktop will appear allowing you to “test drive” Mint or to continue the install by double clicking the icon labeled install Linux Mint.
A setup dialog will start. Select, in sequence
- Language (English for us),
- Network (If ethernet is available startup program will autmatically connect. If wifi only, not needed at this point, suggest skip),
- codexes (check box “install multimedia codecs”),
- options for installation type (choose “erase disk and install linux mint”).
- Location (Los Angeles for us),
- name a user who will have administrator privileges, assign a password, and a hostname.
After these screens the install process will proceed without additional user input.
When complete connect the target machine to the Internet. As mentioned above, if you have ethernet connectivity plug the cable directly into the target macbook and Mint should connect automatically to the internet. For wireless wifi access Mint may or may not recognize hardware modem. If not use a supported external modem e.g. Panda Wireless modem. Panda is supported since Mint 22 has Ralink RT5372 drivers installed.
The final hardware related step is to add a second monitor, if available, via HDMI or “USB-C”.
Thats it. The base system is ready to go. Reboot and login with the admin username and password you provided earlier.
2 Setup configuration
Set keyboard and trackpad preferences:
* Open `Mouse and Touchpad` in settings. Turn on `Reverse scroll`.
* Open `Keyboard` > `Layouts` > `Options` > `Caps Lock behavior` and select
`Swap Esc` and `Caps-Lock`. This is an important setting for `vim` use.
* Open `Shortcuts` > `Windows`.
* Set `Maximize window` to `Super-f`
* Set `Unmaximize window` to `Super-g`
* Set `Close window` to `Super-q`
* Move window to other monitor `Shift-Super-UpArrow`
Next configure the displays.
- On a two monitor sysem open Display menu (press
commandkey to open menu and search for “display”). Select the macbook as the primary monitor with 1920x1200 (thinkpad) resolution. SetMonitor scaleat 150% to increase default font size in apps. Second monitor (e.g. Dell) should be set at3840x2160.
3 Additional Software setup
Copy files from Host to new Mint machine
Connect to new machine via ssh from mac laptop
First on the new machine (zz)
zz> sudo apt install openssh-server
zz> ip routeget IP for target from the output to ip route, say 10.0.1.196
Secure copy key files over. Key files are
- .vimrc
- .zshrc
- .vim directory (contains
plugandultisnips) place all key files in dotfiles folder kickstart.
mac> scp ~/Dropbox/dotfiles/kickstart/* z@10.0.1.196:~Copy over test workspace
mac> scp ~/work/teaching/fmph243b/project1 z@10.0.1.196:~Next
- Update the
apt“listings” and - install basic utilities
fzf,ripgrep,git,zshand plugins, as well as - major applications
R,vim, andzathurawith the following commands:
sudo apt update
sudo apt upgrade -y
sudo apt install \
r-base-core terminator eza tree zsh git vim fzf ripgrep \
autojump zsh-autosuggestions \
zathura -y4 Miscellaneous extra steps for software install.
Run bash shell script ~/Dropbox/dotfiles/set_up_links.sh to set up symbolic links (e.g. ln -s ~/Dropbox/prj ~/prj). See Appendix 1 below for details.
Make zsh the default shell.
> chsh -s $(which zsh)Set up the shell (zsh) per the post link to set up terminal post
Install zotero and docker using software manager and set up syncing (login: rgthomas)
add vimium extension to firefox
Testing: Should be able to render both Rmd and qmd files.
cd c176
vm
ZT
po
cd setupmint
quarto render index.qmd --to pdfFinish with Dropbox to transfer working environment
sudo apt install nautilus-dropbox
dropbox autostart y
dropbox start -iDropbox startup process will launch a “Sign in” web page. Login with Dropbox credentials through web page.
5 Appendix 1. Script to set up links from local Home to Dropbox
set_up_links.sh
#!/bin/zsh
# since the install process creates a .config directory move it temporarily
mv ~/.config ~/.config.tmp
# create links to hidden files from ~/Dropbox/dotfiles directories
ff=(".zshrc" ".viminfo" ".vimrc" ".local" ".vim" \
".vimplugins" ".config" ".Rprofile")
for P in "${ff[@]}"
do
echo "create a link for Dropbox/dotfiles version of $P in Home"
ln -v -s "$HOME/Dropbox/dotfiles/$P" "$HOME/$P"
done
# copy the original ".config" files into new linked .config
cp -R ~/config.tmp/* ~/.config
# create new directories (links) for working files from Dropbox
dd=("sandbox" "bin" "docs" "prj" "work" "ssh" "shr")
for P in "${dd[@]}"
do
echo "create a link for Dropbox/dotfiles version of echo $P in Home"
ln -v -s "$HOME/Dropbox/$P" "$HOME/$P"
donePossible Shortcut
Install dropbox first. You could wait for Dropbox to finish installing or you could use scp to copy and run the two shell scripts: install_app.sh and set_up_links.sh from ~/Dropbox/dotfiles. These two shells can run in parallel with Dropbox installing.
6 Practice
Notes.
Power management. Switch “suspend” to “shut down immediately” everywhere. This will avoid system lock on timeout.
Situation: Mint is loaded and peng1.Rmd is transferred from researcher 1 to /home/z directory.
Try to run the program with command from colleague:
R -e “render(‘peng1.Rmd’)”
Result: error message:
Command R not found.
So install R…. to fix
sudo apt install r-base-core Try again…
R -e “render(‘peng1.Rmd’)” Result: R loads but gives error: could not find function “render”
Search google “R render”
Result: https://pkgs.rstudio.com/rmarkdown/reference/render.html
Looks like render is a function inside rmarkdown package. so install package R> install.packages(“rmarkdown”)
Try again.
R -e “library(rmarkdown); render(‘peng1.Rmd’)”
Result: error. pandoc version 1.12.3 or higher required.
Now try to install pandoc Try again. > R -e “library(rmarkdown); render(‘peng1.Rmd’)” Result: error. there is no called pacman
so install pacman R> install.packages(“pacman”) Try again…
R -e “library(rmarkdown); render(‘peng1.Rmd’)” result: failed pandoc could not find /Users/zenn/shr/preamble.tex
This makes sense we forgot to send the preamble.tex file to researcher 2. Lets send it now. Also we need to adjust its location from a macos style file name to a linux based one.
To edit peng1.Rmd we need vim > sudo apt install vim
Try again Result: pandoc error “pdflatex not found” Lets install tinytex. First in R and then in mint R> install.packages(“tinytex”) R> tinytex::install_tinytex() # to uninstall TinyTeX, run # tinytex::uninstall_tinytex()
Try again:
R -e “library(rmarkdown); render(‘peng1.Rmd’)” result: pandoc error: file sudoku_apple.pdf not found.
This makes sense we forgot to send the logo file. Lets send the file and try again.
R -e “library(rmarkdown); render(‘peng1.Rmd’)” Result: error no bibliography file found.
This makes sense we forgot to send the bib file. Lets send the file and try again. Also need to edit the location of bib file.
Try again:
R -e “library(rmarkdown); render(‘peng1.Rmd’)”
results: minor error. Some packages weren’t loading via pacman.
Try removing janitor, kableExtra, tidyverse, readxl and add ggplot2.
Try again:
R -e “library(rmarkdown); render(‘peng1.Rmd’)”
Success!
7 Install Docker
Installing Docker on Mint is a bit tricky. You need to add Docker’s GPG key and include the repository in the Apt sources
How to Install Docker on Linux Mint 21: A Step-by-Step Guide
sudo apt update
sudo apt install apt-transport-https ca-certificates curl gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl is-active docker7.1 Prerequisites
In development
7.2 Step-by-Step Implementation
In development
7.3 Key Takeaways
In development
7.4 Further Reading
In development