These instructions describe the installation of JMRI on a Raspberry Pi system running the Raspbian OS. There's also an 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.
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.
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).
A fresh JMRI install on a Raspberry Pi B 2 running Jessie 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).
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 than the JDK shipping with Jessie. Check your version of Java in step 3.
To install the OS on a RasPi, follow these steps: [1]
raspi-config
.
More details on installing Raspbian can be found at the Raspberry Download site. Beginners are advised to use the NOOBS install.
Once the OS is installed on your Pi, update the system. From the LXTerminal type
sudo apt-get upgrade
and 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.
For current JMRI releases (version 3.10 and up) you need "Java 8" or "Java 1.8". Raspbian Jessie 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:
Java 1.x
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]
Download JMRI (choose the Linux edition).
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, backup any user created files in the JMRI directory and delete the JMRI directory. Then move the extracted JMRI directory and its contents 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. [2]
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.
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/
Connect your computer to your Command Station hardware.
To start JMRI using the CLI open LXTerminal and enter:
cd /opt/JMRIfollowed by either
./PanelPro ./DecoderPro
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.
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.
After editing sysctl.conf
, run sysctl -p
to activate changes (or reboot your Pi). [3]
sudo poweroff
and then switch the power off once the shutdown is complete. [4]
sudo shutdown -h now
using 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 raspi-config
Use an external power supply for the interface, because the Pi2's USB ports can only supply about 100mA of current.
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, go to the JMRI users group.
(Rev 4.2, updated 21 Jan 2016 based on tips from [1] Suzie Tall, [2] Dave Sand, [3] Scott Jay and [4] David McMorran).