Playground.arduino.cc will be read-only starting December 31st, 2018. For more info please look at this Forum Post

Installing Arduino on Linux

WARNING!!! If you use sudo apt-get install arduino you will probably get an extremely outdated and possibly non-standard version of the Arduino IDE. Official Linux 32 bit, 64 bit, and ARM builds are available for download here: https://www.arduino.cc/en/Main/Software

You can find official Linux installation instructions here: https://www.arduino.cc/en/Guide/Linux

Some of the information in the following pages may be outdated:

For more detailed instructions, pick your distribution:

Requirements

You will need to install some programs to use Arduino under Linux (the way you do this depends on your distribution):

  • openjdk-7-jre (although openjdk-6-jre, sun's java 6 runtime, the sun-java6-jre package or the oracle JRE 7, should work too)
  • it is HIGHLY recommended to use arduino IDE 1.0.1, because it use an internal pre-build gcc compiler. This exclude all tool-chain problem, or at least guarantee we all have the same problem. Also this mean you don't need to install all the above package anymore. That's it, no more other Requirements, you can skip the rest of this section.
    • If you want to use your system's compiler, delete the folder ./hardware/tools/avr in your arduino IDE installation
    • If you still want to use older Arduino IDE version, then you need avr-gcc (aka "gcc-avr"), version 4.3.2 or later 4.3.x version (4.4.x and 4.5.x seem to have various problems)
      • Version 4.3.0 has a major bug which affects multiplication of long int's. This is the default version in Ubuntu Intrepid (8.10). Check using "avr-gcc --version" and upgrade if necessary.
      • Versions prior to 4.3.0 do not support the ATmega328 (which comes on the Arduino Duemilanove). People running distributions like Hardy Heron (Ubuntu) or Etch (Debian) and previous will need to upgrade their version of avr-gcc.
      • Version 4.7 have break some older standard and the arduino core class give some compiling error.
    • avr-gcc-c++ (Else you will get this error: Cannot run program "avr-g++":j ava.io.IOException:Error=2: No such file or directory)
    • avr-libc

Download the latest Arduino Linux distribution from the arduino dowload section. Copy/extract these files to a directory (or your desktop) and Run the "arduino" script. Be sure that the full extracted directory location/name has no spaces in the /location/name.

Included Dependencies

The Arduino software download includes custom versions of two additional dependencies:

  • RXTX, a Java and native library for communicating with serial devices like Arduino boards
  • avrdude, an application for uploading programs to AVR microcontrollers (like the ones on Arduino boards)
  • from Arduino IDE 1.0.1 a full working avr-gcc package is included

You should be able to use the versions of these programs that come with the Arduino software download. If, however, they won't run on your computer, you may need to compile the Arduino-specific versions of these programs for yourself rather than using the standard packages from your distribution.

The avrdude that comes with Arduino was modified to ensure proper functioning of the auto-reset of Arduino boards before upload (without which the upload will fail). The source code to the Arduino version is available on GitHub.

The RXTX that comes with Arduino was modified to support devices of the form /dev/ttyACM*, which are used by the Arduino Uno and Mega 2560 boards (which use an ATmega8U2 instead of an FTDI chip for USB-serial communication). Source code for the Arduino version is also available on GitHub.

The RXTX library requires that you specify the serial ports via a java command line parameter gnu.io.rxtx.SerialPorts So you will have to modify the arduino shell script and add that in the last line where java is invoked like this:

java -Dgnu.io.rxtx.SerialPorts=/dev/ttyACM0 -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel processing.app.Base "$@"

Other notes

Locking assertion failure from java when using Xinerama

To fix:

  sudo sed -i 's/XINERAMA/FAKEEXTN/g' /usr/lib/jvm/java-6-sun/jre/lib/amd64/motif21/libmawt.so

USB-Serial Devices

Arduino's (and other USB-serial devices) end up as /dev/ttyUSB# or /dev/ttyACM#.

If you have more than one such device then some udev magic may help avoid confusion.

Kernel Configuration

If you configured your own kernel, the driver is either under "Device Drivers => USB Support => USB Serial Converter Support => USB FTDI Single Port Serial Driver" or "Device Drivers => USB Support => USB Modem (CDC ACM) support". Select [Y], to have it "built in" to the kernel or [M] to have it built as a module. Dmesg then should show the device like this:

ftdi_sio 2-2:1.0: FTDI USB Serial Device converter detected

or like this:

cdc_acm 5-2:1.0: ttyACM0: USB ACM device

User Rights

Make sure you are in the tty group. On some distros you might need to create an udev rule for the FTDI USB Serial Device converter.

Checking the avr-gcc version

This works only if you are using Arduino IDE older than 1.0, or you have deleted the ./hardware/tools/avr folder

Run avr-gcc --v from a terminal window to check your version number.

(The old instructions for installing Arduino on Linux are still available.)

Installing Arduino BT on Ubuntu 9.04 and 9.10

Refer to Arduino BT - Ubuntu for the full guide. This guide section was created in a new page by the author.