Pinball Compute Setup

First off the computer I am using is an Intel NUC. I got the NUC5CPYH with a 120GB SSD and 4GB RAM, which I hope will be enough power but should at least get me developing and I can upgrade to a bigger unit in the future if needed. My intention is to develop from my primary iMac or my laptop and use remote connection (VNC) to access the NUC. This blog is to outline some of the process I went through in setting up my NUC and environment to work with it.

I am going to use Linux (Ubuntu) and to keep the OS as light as possible I will use the Xubuntu variant as this installs the XFCE window manager by default which is lighter than the normal Unity Window Manager.

TIP: There are good docs on setting up Mission Pinball here: However I went a little off script in setting up Mission Pinball Framework as I wasn't too keen on their installer, it installs the python packages into the system python instead of creating a virtual environment or using user space.

To get started I downloaded Xubuntu ( Current latest stable 16.04) and Burn the ISO onto a blank USB using UNetBootLin ( I then plugged a USB stick into the NUC and perform a stock standard install ( I ensured that I configured the machine to auto login as my user.

Once I was booted up to the new OS I installed OpenSSH so I could complete most of the remaining setup from my primary computer. To do this I opened a terminal and ran "sudo apt-get update && sudo apt-get install -y openssh-server". I called my unit "nuc" (unique I know), which meant I was then able to "ssh nuc" from my mac.

Next up I setup the pre-required packages:
sudo apt-get -y install build-essential git gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-ugly libavcodec-dev libavformat-dev libgl1-mesa-dev libgles2-mesa-dev libgstreamer1.0-dev libjpeg-dev libmtdev-dev libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libsmpeg-dev libswscale-dev libtiff5-dev libx11-dev libxine2-ffmpeg pulseaudio python3 python3-pip zlib1g-dev

Then ensured my pip and setuptools were the latest:
sudo pip3 install --upgrade pip
sudo pip3 install --upgrade setuptools

I want to use a virtualenv for mpf so next I setup my nuc for python virtualenvs and created a new virtualenv called mpf
sudo pip3 install virtualenvwrapper
mkdir $HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/
echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/" >> $HOME/.bashrc
mkvirtualenv mpf

Now that I have a virtualenv I will install the mpf requirements and mpf itself into the venv
pip3 install --upgrade pillow
pip3 install -I Cython==0.24.
pip3 install kivy
pip3 install mpf mpf-mc

I can't start mpf remotely via SSH as the media controller needs access to the window. So in order to access the NUC via the GUI ill use vnc. First up ill install x11vnc
sudo apt-get install x11vnc

Then ill setup a script I can call remotely from my Mac to start VNC when I am working
sudo touch /opt/startvnc
sudo chown $USER /opt/startvnc
echo "while [ 1 ]
 x11vnc -display :0  -ncache -localhost
 sleep 1
" > /opt/startvnc
chmod +x /opt/startvnc

On my Mac ill add an alias to ~/.bashrc so after I start a new terminal I can just run "nucvnc" to setup the tunnel and VNC server over the SSH connection.
alias nucvnc='ssh -L 5900: nuc /opt/startvnc'

After running "nucvnc" and using "VNC Viewer" from my Mac to connect to, I am now connected to the main console of the NUC. I can open a terminal on the NUC screen and test mpf.

First I download the mpf examples
git clone

Then switch to my python virtualenv and run the last tutorial code
workon mpf
cd mpf-examples/tutorial_step_18/
mpf both

Now in order to make a tight development loop I would rather work locally on my Mac but have the files I am editing be immediately available to the NUC. The simple way to do this is to use SSHfs which will mount the NUC filesystem onto my Mac. 

First I install fuse and SSHfs on my Mac from, then I create some more alias on my Mac by adding these lines to my "~/.bashrc"
alias mountnuc='sshfs -o allow_other,defer_permissions nuc:/home/mfuller /Users/mfuller/nuc/'
alias umountnuc='umount /Users/mfuller/nuc'

Lastly create the mount point folder on my Mac
mkdir /Users/mfuller/nuc

Now I can just run "mountnuc" to start working on my codebase stored remotely on the NUC and "umountnuc" when I am done.

I am still awaiting my hardware delivery from FASTPinballWhen I get that I will add the steps on setting up the connections to the hardware.


Popular posts from this blog

MPF Unittest automation with Bitbucket Pipelines

Using Trello to track progress