Installing JMRI on Raspbian
These instructions describe the installation of JMRI on a Raspberry Pi system running the Raspbian OS. There's also a Install help page for other flavors of Linux.
The Raspberry Pi is becoming increasingly popular as a small and cheap computer.
Raspbian is based on Debian and is recognized as being a very user friendly distribution.
JMRI installation consists of two stages: install Java and install JMRI.
Pre-Built Image Available
- A free RaspberryPi image, completely configured with JMRI, auto-identify logic for many popular DCC systems and its own wifi access point, is available for download [here].
- Determine if your system software supports JMRI:
JMRI System Requirements
These instructions deal with installing JMRI on a Raspberry Pi model 2 B running the latest Raspbian OS.
We describe how to install the components needed for JMRI to run, followed by how to install JMRI itself. Before starting the install, make sure your Pi has a working internet connection (for downloads etc.) via either Wifi or a UTP cable to your Router.
Raspbian 4.14 Stretch
A fresh JMRI install on a Raspberry Pi 3 Model B+ running Stretch is straightforward, as this OS includes Java 1.8 and the JMRI Linux install is ready for Arm. Follow the steps outlined below (skip steps 3 and 4).
Raspbian 4.1 Jessy
A fresh JMRI install on a Raspberry Pi B 2 running Jessy is straightforward, as this OS includes Java 1.8 and the JMRI Linux install is ready for Arm. Follow the steps outlined below (skip steps 3 and 4).
Raspbian 3.18 Wheezy
Tested on: Raspberry Pi Model B with 512Mb memory and a SanDisk 8Gb SDHC card.
Wheezy might run on a Pi A or B+, but OpenJDK is said to be a lot slower then the JDK shipping with Jessy. Check your version of Java in step 3.
To install the OS on a RasPi, follow these steps: 
- Format an SD card in FAT32 using the utility from SD Card foundation.
- Unzip NOOBS image to the SD card (using another computer) and insert the SD card in the Pi's SD slot.
- Boot Pi 2 on the SD card and install Raspbian OS (the first option in the list).
- Enable SSH in the raspi-config.
- Change host name in the raspi-config.
- Enable booting in to GUI as user Pi
Once the OS is installed on your Pi, update the system. From the LXTerminal type
sudo apt-get upgradeand hit Enter. Some messages will appear and when the prompt returns, type
sudo apt-get update. The update command might take a few minutes to complete. This insures you have the latest version of Raspbian and any included software.
Since Java is already installed, the next step is to install JMRI.
- Depending on how your Pi is set up, you might need to install Java:
For current JMRI releases (version 3.10 and up) you need "Java 8" or "Java 1.8". Raspbian Jessy already has a suitable Java Runtime (Oracle 1.8) as part of the distribution.
To check which Java version is installed, open LXTerminal window and type 'java -version'. This will return something like:
If it is not at least 1.8, or if you get a "java: not found" error, you will need to install Java from the repositories or java.com.
[please report exact instructions to update Java]
- Get the JMRI software...
Download JMRI (choose the Linux edition).
- ...and install it.
Uncompress/untar the file your download. Double click on the .tgz file to open the Tar, then click Extract. This will create a new "JMRI" folder.
Each JMRI release is an independent set of files: It's intended to be used as a whole. Each release provides new files, and sometimes removes old files. You should therefore not expand the download into the same place as an existing JMRI installation. Instead, expand it into a separate location, and move in to it's final destination, completely replacing any previous version of JMRI.
To install, you just have to move that new JMRI folder to where you want it on your computer.The latest test releases of JMRI include support for the ARM v7 processor, so extracting is all you need to do. 
JMRI 3.10.1 did not, which required some startup script changes as the Pi2 runs an ARM7 processor. An installation script was written by Matthew Macdonald-Wallace to modify certain libraries so that JMRI would run. He provides a Pi install script on GitHub.
- Copy RxTx
Matt Harris reported July 2015: The comms libraries fix is no longer necessary with JMRI development releases 3.11.1 and up as the Linux start-up script has been updated to better detect the ARM architecture. Move on to step 7.
The RxTx library used to be a problem requiring modifications to enable JMRI to run. JMRI requires a package called RXTXcomm. The version that was included with JMRI 3.5 and earlier did not work on the Raspberry Pi. So, if you are using or updating a version of JMRI prior to 3.8 then the RxTx library in JMRI must be replaced by the original. There is a script to do this in the JMRI Users group "Files" area if you wish to run JMRI 3.8 on Raspbian 3.18 Wheezy. Since JMRI version 3.8 this is no longer required.
The following script will fix the PanelPro etc. comms libraries not working due to incorrectly recognized processor. Type:
sudo cp -v /opt/JMRI/lib/linux/armv6l/* /opt/JMRI/lib/linux/armv7l/Note that this step is no longer required on a fresh install of JMRI 3.8 and up.
- Installation is complete.
Connect your computer to your Command Station hardware.
To start JMRI using the CLI open LXTerminal and enter:
cd /opt/JMRIfollowed by either
Using the GUI: To create a complete set of Desktop icons that you can just double-click, Dan M. wrote a set of desktop startup icons for the Pi. Again, double click on the .tar.gz file to open the Tar, then click extract and copy the separate startup files you wish to your desktop folder; change the path in these text files to match your JMRI install).
After a clean install, the JMRI Preferences pane will open. Select your Connection and USB port, click "Save" and restart.More on this on the JMRI Setup help page.
You could have your Pi automatically open DecoderPro and start an "xrdp" Remote Desktop at startup if e.g. the Pi is mounted under your layout and runs a so called "headless mode". See Sherman's blog on
Nscale.net forum JMRI on a Pi2 for instructions.
Using WiThrottle zeroconfig
Disable IPv6 for the network interfaces (with IPv6 turned on, the WiThrottle window will display
127.0.0.1. After turning off IPv6 the window will display the IP address of your adapter. iPhone picks up the WiThrottle server when set to automatic configuration and no longer flashes the
network disconnected error. Rebooting the Pi, restarting DecoderPro (including "Faceless") or restarting the WiThrottle app gave no issues in our testing).
Open a terminal window and enter
sudo leafpad, then in Leafpad open the file:
edit /etc/sysctl.conf and add these parameters to the bottom of the file:
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 net.ipv6.conf.eth0.disable_ipv6 = 1
Note: you need
root access to edit this file.
Be sure to add extra lines for other network interfaces you want to disable ipv6 for.
sysctl -p to activate changes (or reboot your Pi). 
Turn off your PiAnytime you need to shutdown the Raspberry Pi, use the line command:
sudo poweroffand then switch the power off once the shutdown is complete. 
Turn off your Pi remotely from your 'phoneE.g., on Android install the free SSH button app. Configure it to send the command
sudo shutdown -h nowusing the Pi's IP address and your username and password for SSH. Switch the power off once the shutdown is complete. You must enable SSH on the PI for this to work. See
Use an external power supply for the interface, because the Pi2's USB ports can only supply about 100mA of current.
- Digitrax PR3
- The PR3 is reported to work reliably (Dan M.).
- LocoBuffer USB
- For connecting to LocoNet, we recommend you use Raspbian Jessy or later with the LocoBuffer-USB.
- MERG CBUS
- The MERG CANUSB interface is detected automatically (Matt H.).
- SPROG II and SPROG 3
- Check in /dev or dmesg for the device that is created when connecting. This is the device you should connect to in the JMRI connection.
- Pi-SPROG One
- Connects directly to the Pi GPIO pins (unused pins passed through). Requires external power supply. With a Pi 3 Model B (recommended) you can use the on-board WiFi an AP (Access Point) mode to create a wireless command station. See the SPROG DCC website for details of creating a suitable OS image.
- [please report your results]
- Your login account should have root permissions to access the GPIO Pi interface (the 40 pins on a Pi board).
More details on our Raspberry Pi via GPIO hardware Help page.
The JMRI Hardware help page lists the various types of layout equipment that JMRI can connect to, and gives links to instruction pages. Go there next to complete your setup.
If you have any problems, get back to the JMRI users Groups.io.