Skip to main content

Magic ๐Ÿ–ฅ

Late 2012 i7 mac mini. My current main machine is Macs Ovid Stu

Logโ€‹

  • ๐Ÿ”ฅ 26/08/03 - I decided to convert this old machine into a local server that I can use for testing and mirroring production servers since it's got an i7 processor and enough memory to run locally.
  • 22/11/8 - Preparing for my annual machine cleaning and migration to ARM. In doing so, I've moved the magic mini up to the office to act as a server on which to drop my development projects during the migration. I previously had used the mini as a media server in the den but I've found that it's easier to user AirPlay from a tablet. I'll leave a breadcrumb trail here of the specifics as a reference.
  • 20/07/27 - I finally took it out of commission long enough to migrate to the ARM ( https://davidwindham.com/arm/ ) architecture and replace the old drive with an SSD - https://davidwindham.com/mac-mini.

Ubuntuโ€‹

  • 24.04 - Late 2012 Quad-Core i7 is native 64-bit EFI so not bootloader 32-bit workarounds.
  • gotta go autoinstall so I don't need a headless monitor
  1. flash Server ISO to USB drive
  2. create a configuration file named user-data inside the USB's root directory containing your user details, SSH keys, network settings, and disk wiping rules.
#cloud-config
autoinstall:
version: 1
interactive-sections: []

# Set system identity & login credentials
identity:
hostname: macmini-server
username: admin
# Default password below is: "ubuntu"
# To generate a custom SHA-512 password hash, run on a Mac/Linux terminal:
# python3 -c 'import crypt; print(crypt.crypt("yourpassword", crypt.mksalt(crypt.METHOD_SHA512)))'
password: "$6$rounds=4096$rounds=4096$c3VwZXJzZWNyZXQ$mR6wY0GZ2M9O7JzG3w0JzX1qV7x0JzX1qV7x0JzX1qV7x0JzX1qV7x0JzX1qV7x0JzX1qV7x0JzX1qV7x"

# Automatically enable OpenSSH server during install
ssh:
install-server: true
allow-pw: true

# Automatically format the internal drive (overwrites macOS completely)
storage:
layout:
name: direct

# Reboot automatically when the installation finishes
late-commands:
- "curtin in-target -- shutdown -r now"
  1. edit the GRUB menu configuration on the USB drive to append autoinstall to the boot flags.
  2. Plug the USB into the Mac mini, power it on, hold Option, press Enter (to hit the default EFI boot option blindly).
  3. Ubuntu will read the configuration file, wipe the internal drive, set up SSH, reboot automatically, and come online on your local networkโ€”all with zero display attached.

Linux install notesโ€‹

# Create the systemd unit file
sudo bash -c 'cat <<EOF > /etc/systemd/system/mac-power-on.service
[Unit]
Description=Set Mac mini auto power on after AC loss
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/usr/bin/setpci -s 0:1f.0 0xa4.b=0

[Install]
WantedBy=multi-user.target
EOF'

# Reload systemd and enable the service
sudo systemctl daemon-reload
sudo systemctl enable mac-power-on.service

# Test-run the command once
sudo setpci -s 0:1f.0 0xa4.b=0

install mac fan controll (macfanctld)

sudo apt update
sudo apt install -y macfanctld
sudo systemctl enable --now macfanctld

Enable Auto-Power-On After Power Failure

sudo setpci -s 0:1f.0 0xa4.b=0

add systemd

sudo bash -c 'cat <<EOF > /etc/systemd/system/mac-power-on.service
[Unit]
Description=Set Mac mini auto power on after AC loss
After=multi-user.target

[Service]
Type=oneshot
ExecStart=/usr/bin/setpci -s 0:1f.0 0xa4.b=0

[Install]
WantedBy=multi-user.target
EOF'

sudo systemctl daemon-reload
sudo systemctl enable mac-power-on.service

Prevent Idle Sleep & Hibernation

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Notes:โ€‹

$magic

Networkโ€‹

Moved it to have an ethernet connection to the main router and reserved the IP address: 192.168.7.177 so that it's available to all of the machines on the network.

Storageโ€‹

Renamed the drive ( MiniSSD ) and wiped clean the original 1TB disc ( Magick ) to use as a NAS backup drive. Added my two Lacie drives ( Silverbullet / Farpoe ) so that they are accessible via the network. Changed the file permissions to allow Remote Management and access.

Operating Systemโ€‹

It's going to be permanently stuck on MacOS 11 Catalina due to Monterey not supporting it. Installed the lastest XCode command line tools to bring Homebrew up to speed. Matched up the software on macs so I have duplicates and I'm making notes on which ones are x86, universal, and ARM native.

Terminalโ€‹

Oh My ZSH configuration to match servers and other machines. I use an identifying emoji ( Macs ๐Ÿถ / Magic ๐ŸŽฑ / Zeke ๐ŸฆŠ / Woozer ๐Ÿป )for each prompt to make it easier to differentiate the machines. Migrated dotfiles using my repo @ https://davidwindham.com/code/dotfiles

Databasesโ€‹

Duplicated all of my existing project databases:

  • MySQL 8.0.26 x86 64bit
  • PostGreSQL 13.4
  • MongoDB 4.4
  • Redis 6.2

Languagesโ€‹

  • PHP 7.4.24 & 8.0.11
  • Ruby 2.7.4 & 3.0.2 ( via RVM )
  • Python 3.9.7
  • GoLang 1.17.3
  • Node 16.13 & 17.0.1 ( via NVM )

Softwareโ€‹

  • Abandoned
    • RDM ( Redis Now in TablesPlus )
    • Colloquy ( No IRC anymore )
  • Migrated
    • TablesPlus
    • Sequel Pro
    • MongoDB Compass
    • Docker
    • DBengin
    • Postman/Insomnia
    • Vercel Now
    • WebStorm/RubyMine/PyCharm/PhpStorm/GoLand
    • VSCode/Textmate/Sublime/Atom/CodeKit
    • AdobeCC/Sketch/Sip
    • Final Cut/Audio Hijack/VLC/Handbrake/Screenflow/Licecap
    • Keybase/Slack/Zoom
    • Apache/Nginx
    • Homebrew 3.3.3

Homebrewโ€‹

brew leaves | column
automakelibmetalinkphp@7.2
boostlibpqxxphp@7.4
composerlibxml2phpunit
dnsmasqlibyamlpostgresql
faacmakedependredis
ffmpegmcryptsphinx-doc
gistmkcerttexi2html
gnupgmysql@5.7tmux
gonghttp2wp-cli
heroku/brew/herokunginxyarn
httpdnssyasm
httracknvmzlib
ilmbasepandoczsh-history-substring-search
imagemagickphpzsh-syntax-highlighting
brew list
adnsleptonicanspr
aomlibassnss
aprlibassuannvm
apr-utillibblurayoniguruma
argon2libde265opencore-amr
aspelllibevopenexr
autoconflibeventopenjpeg
automakelibffiopenldap
bdw-gclibgcryptopenssl@1.1
boostlibgpg-erroropus
brotlilibheifp11-kit
c-areslibidnpandoc
ca-certificateslibidn2pcre
cairolibksbapcre2
composerliblqrphp
curllibmetalinkphp@7.2
curl-openssllibnghttp2php@7.4
dav1dliboggphpunit
dnsmasqlibomppinentry
docbooklibpngpixman
docbook-xsllibpqpkg-config
faaclibpqxxpostgresql
ffmpeglibpthread-stubspython@3.10
flaclibsampleratepython@3.9
fontconfiglibsndfilerav1e
freetdslibsodiumreadline
freetypelibsoxrredis
frei0rlibssh2rtmpdump
fribidilibtasn1rubberband
gdlibtiffsdl2
gdbmlibtoolshared-mime-info
gettextlibunistringsnappy
ghostscriptlibusbspeex
gifliblibvidstabsphinx-doc
gistlibvmafsqlite
gliblibvorbissrt
gmplibvpxtesseract
gnu-getoptlibx11texi2html
gnupglibxautheora
gnutlslibxcbtidy-html5
golibxdmcptmux
gobject-introspectionlibxextunbound
graphite2libxml2unixodbc
guilelibxrenderutf8proc
harfbuzzlibyamlwebp
herokulibzipwp-cli
heroku-nodelittle-cms2x264
httpdlzox265
httpd24m4xmlto
httrackmakedependxorgproto
icu4cmcryptxvid
ilmbasemhashxz
imagemagickmkcertyarn
imathmpdecimalyasm
janssonmysql@5.7zeromq
jbig2decncurseszimg
jemallocnettlezlib
jpegnghttp2zsh-history-substring-search
jpeg-xlnginxzsh-syntax-highlighting
krb5nodezstd
lamenpth