The Arduino package contains an IDE that can be used to develop and upload code to the micro-controller. A current arduino package is available in the repositories of most Linux distributions (Ubuntu and Fedora, anyway). But sometimes, you need to use a different version of Arduino for a certain use case. For example, the distro doesn't have the most current version that you need to drive your new-fangled dev board from Adafruit or PJRC. Or, the new Arduino package breaks your existing code or compatibility with a different device.
Now you can have different flavors of the Arduino packages on your Linux computer at the same time, and use the alternatives command to switch between them. Here's how.
- Install from the repositories:
sudo yum -y install arduino
- Run the Arduino IDE and set your preferences, etc. and test that it works. Your user may need to be added to some groups (dialout and lock in Fedora 20+) to have permissions to write to the serial interface on your computer.
- Optionally, install the alternatives graphical user interface. You can use this interface to switch between your options rather than using the command.
sudo yum -y install galternatvies
- Prepare the installed arduino code for use with alternatives
- Move the arduino script to /usr/share/arduino:
sudo mv /usr/bin/arduino /usr/share/arduino sudo alternatives --install /usr/bin/arduino arduino /usr/share/arduino/arduino 25000
- The preceding command links the /usr/bin/arduino command to /usr/share/arduino/arduino (which you moved there in the step before that.) Note: You will have to repeat this step when the version of the arduino IDE changes in the Fedora repositories.
- Download other versions! Go to http://arduino.cc/en/Main/Software to download the newest version of the IDE
- Arduino 1.0.6 (the newest version available at this time)
- Arduino 1.5.8 (for the Yun and Due)
- Arduino IDE for the Intel Galileo https://communities.intel.com/docs/DOC-22226
- Install a new option as an alternative. Extract the next option, and move it into /usr/share
tar -zxvf arduino-1.5.8-linux64.tgz sudo mv arduino-1.5.8 /usr/share
- Then install it as an alternative:
sudo alternatives --install /usr/bin/arduino arduino /usr/share/arduino-1.5.8/arduino 20000
Now you can more easily switch between to two options:
sudo alternatives --config arduino There are 2 programs which provide 'arduino'. Selection Command ----------------------------------------------- *+ 1 /usr/share/arduino/arduino 2 /usr/share/arduino-1.5.8/arduino Enter to keep the current selection[+], or type selection number: 2 Troubleshooting
Starting Arduino 1.0.6 for the first time throws this error repeatedly:
please see: How can I use Lock Files with rxtx? in INSTALL check_group_uucp(): error testing lock file creation Error details:Permission deniedcheck_lock_status: No permission to create lock file.
Make the following change in /usr/lib/tmpfiles.d/legacy.conf (see http://playground.arduino.cc/Linux/Fedora for more about this):
As root, change the line that reads:
d /run/lock 0755 root root -
d /run/lock 0775 root lock -
The change is effective on the next reboot. To change immediately:
sudo chgrp lock /run/lock sudo chmod g+w /run/lock