Setup C++ IDE CLion on Raspberry Pi with Ubuntu Mate

Install environment and tools


Insert the CF-card to Raspberry Pi CF card slot, turn on the Raspberry Pi board and follow the setup dialogs and then login to the system.

Update and upgrade the system. Run following commands and type “y” when confirmation requested

sudo apt-get update
sudo apt-get upgrade

Ubuntu Mate can run without GUI. Use util graphical to disable or disable GUI.

Enable GUI on the next boot of the system

sudo graphical enable

Disable GUI on the next boot of the system – only console is available.

sudo graphical disable

To start GUI manually when it was not started at boot – execute the command lightdm and switch to GUI pressing Ctrl+Alt+F7

sudo lightdm

Read useful detail in the section “Hardware accelerated video”

Useful tools and applications


htop is an extended version of util top installed by default

sudo apt-get install htop

Shutter is a tool to make screenshots, with some image editing features

sudo apt-get install shutter

vim editor is an improved version of one of default editors vi

sudo apt-get install vim

CMake is an open-source, cross-platform family of tools designed to build, test and package software. It is used by CLion to maintain and build C++ projects

sudo apt-get install cmake

GDB is GNU Project debugger. It is used by CLion to debugg C++ code. CLion support version 7.8

sudo apt-get install gdb

JDK – Java Development Kit is required by CLion. Download an archive¬†with JDK “Linux ARM 32 Soft Float ABI” (requires to tick the radio-button regarding accepting of User Agreement).



Usually web-browsed downloads files in the folder ~/Downloads

ls ~/Downloads


If the downloaded JDK does not exists in it – try to find it with browser’s button “Downloads” or with the command find (with option “/” – to start from the root directory)

sudo find / -name jdk*.tar.gz


In this example archive with JDK was downloaded to the tmp folder in the root directory.

Extract the archive with JDK to folder /opt. Instead of highlighted folder and file name – use the correct name of the downloaded file. Extract the archive with the command sudo also sets root as an owner of extracted data

sudo tar -xzf ~/Downloads/jdk-8u77-linux-arm32-vfp-hflt.tar.gz -C /opt

Find the extracted folder name with JDK

ls /opt

Rename the extracted folder with JDK to “java”

sudo mv /opt/jdk1.8.0_77/ /opt/java


Set the environment variable pointing to the java and make it available for next sessions of bash

export JAVA_HOME=/opt/java/
echo 'export JAVA_HOME=/opt/java/' >> ~/.bashrc

Restart the terminal and verify the JAVA_HOME still available




CLIon a cross-platform IDE for C and C++. Follow the original instructions to install CLIon or the description below.

Download archive with CLion and find downloaded file. “i” in the option -iname is to ignore case in names – the downloaded file has capital letters in its name

sudo find / -iname clion*.tar.gz


Notice the path “/home/user1/Download” is equal to the “~/Downloads” as “/home/user1” is a “home” folder for the user user1 and symbol ~ is its short writing.

Extract the file to the folder /opt

sudo tar -xzf ~/Downloads/CLion-2016.1.tar.gz -C /opt

Verify the folder with CLIon exists in the /opt folder

ls /opt


Rename the folder to clion – just to remove version from it

sudo mv /opt/clion-2016.1/ /opt/clion



Leave a Reply

Your email address will not be published. Required fields are marked *