How to install Intellij IDEA on Ubuntu? How to install Intellij IDEA on Ubuntu? java java

How to install Intellij IDEA on Ubuntu?


Note: This answer covers the installation of IntelliJ IDEA. For an extended script, that covers more JetBrains IDEs, as well as help for font rendering issues, please see this link provided by brendan.
Furthermore, a manual Desktop Entry creation is optional, as newer versions of IntelliJ offer to create it on first startup.


I have my intellij int /opt folder. So what I do is:

  • Download Intellij
  • Extract intellij to /opt-folder: sudo tar -xvf <intellij.tar> -C /opt/ (the -C option extracts the tar to the folder /opt/)
  • Create a Desktop Entry File called idea.desktop (see example file below) and store it anywhere you want (let's assume in your home directory)
  • Move the idea.desktop from your home directory to /usr/share/applications: sudo mv ~/idea.desktop /usr/share/applications/

Now (in a lot) Ubuntu versions you can start the application after the GUI is restarted. If you don't know how to do that, you can restart your PC..

idea.desktop (this is for community edition version 14.1.2, you have to change the paths in Exec= and Icon= lines if the path is different for you):

[Desktop Entry]                                                                 Encoding=UTF-8Name=IntelliJ IDEAComment=IntelliJ IDEAExec=/opt/ideaIC-14.1.2/bin/idea.shIcon=/opt/ideaIC-14.1.2/bin/idea.pngTerminal=falseStartupNotify=trueType=Application

Edit
I also found a shell script that does this for you, here. The given script in the link installs Oracle Java 7 for you and gives you the choice between Community and Ultimate Edition. It then automatically downloads the newest version for you, extracts it and creates a desktop entry.
I have modified the scripts to fulfill my needs. It does not install java 8 and it does not ask you for the version you want to install (but the version is kept in a variable to easily change that). You can also update Intellij with it. But then you have to (so far) manually remove the old folder! This is what i got:

Edit2
Here is the new version of the script. As mentioned in the comments, breandan has updated the script to be more stable (the jetbrains website changed its behavior). Thanks for the update, breandan.

#!/bin/shecho "Installing IntelliJ IDEA..."# We need root to install[ $(id -u) != "0" ] && exec sudo "$0" "$@"# Attempt to install a JDK# apt-get install openjdk-8-jdk# add-apt-repository ppa:webupd8team/java && apt-get update && apt-get install oracle-java8-installer# Prompt for edition#while true; do#    read -p "Enter 'U' for Ultimate or 'C' for Community: " ed #    case $ed in#        [Uu]* ) ed=U; break;;#        [Cc]* ) ed=C; break;;#    esac#doneed=C# Fetch the most recent versionVERSION=$(wget "https://www.jetbrains.com/intellij-repository/releases" -qO- | grep -P -o -m 1 "(?<=https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/idea/BUILD/)[^/]+(?=/)")# Prepend base URL for downloadURL="https://download.jetbrains.com/idea/ideaI$ed-$VERSION.tar.gz"echo $URL# Truncate filenameFILE=$(basename ${URL})# Set download directoryDEST=~/Downloads/$FILEecho "Downloading idea-I$ed-$VERSION to $DEST..."# Download binarywget -cO ${DEST} ${URL} --read-timeout=5 --tries=0echo "Download complete!"# Set directory nameDIR="/opt/idea-I$ed-$VERSION"echo "Installing to $DIR"# Untar fileif mkdir ${DIR}; then    tar -xzf ${DEST} -C ${DIR} --strip-components=1fi# Grab executable folderBIN="$DIR/bin"# Add permissions to install directorychmod -R +rwx ${DIR}# Set desktop shortcut pathDESK=/usr/share/applications/IDEA.desktop# Add desktop shortcutecho -e "[Desktop Entry]\nEncoding=UTF-8\nName=IntelliJ IDEA\nComment=IntelliJ IDEA\nExec=${BIN}/idea.sh\nIcon=${BIN}/idea.png\nTerminal=false\nStartupNotify=true\nType=Application" -e > ${DESK}# Create symlink entryln -s ${BIN}/idea.sh /usr/local/bin/ideaecho "Done."  

Old Version

#!/bin/sh                                                                                                                                   echo "Installing IntelliJ IDEA..."# We need root to install[ $(id -u) != "0" ] && exec sudo "$0" "$@"# define version (ultimate. change to 'C' for Community)ed='U'# Fetch the most recent community edition URLURL=$(wget "https://www.jetbrains.com/idea/download/download_thanks.jsp?edition=I${ed}&os=linux" -qO- | grep -o -m 1 "https://download.jetbrains.com/idea/.*gz")echo "URL: ${URL}"echo "basename(url): $(basename ${URL})"# Truncate filenameFILE=$(basename ${URL})echo "File: ${FILE}"# Download binarywget -cO /tmp/${FILE} ${URL} --read-timeout=5 --tries=0# Set directory nameDIR="${FILE%\.tar\.gz}"# Untar fileif mkdir /opt/${DIR}; then    tar -xvzf /tmp/${FILE} -C /opt/${DIR} --strip-components=1fi# Grab executable folderBIN="/opt/$DIR/bin"# Add permissions to install directorychmod 755 ${BIN}/idea.sh# Set desktop shortcut pathDESK=/usr/share/applications/IDEA.desktop# Add desktop shortcut                     echo -e "[Desktop Entry]\nEncoding=UTF-8\nName=IntelliJ IDEA\nComment=IntelliJ IDEA\nExec=${BIN}/idea.sh\nIcon=${BIN}/idea.png\nTerminal=false\nStartupNotify=true\nType=Application" > ${DESK}echo "Done."    


You can also try my ubuntu repository: https://launchpad.net/~mmk2410/+archive/ubuntu/intellij-idea

To use it just run the following commands:

sudo apt-add-repository ppa:mmk2410/intellij-ideasudo apt-get update

The community edition can then installed with

sudo apt-get install intellij-idea-community

and the ultimate edition with

sudo apt-get install intellij-idea-ultimate


JetBrains has a new application called the Toolbox App which quickly and easily installs any JetBrains software you want, assuming you have the license. It also manages your login once to apply across all JetBrains software, a very useful feature.

To use it, download the tar.gz file here, then extract it and run the included executable jetbrains-toolbox. Then sign in, and press install next to IntelliJ IDEA:

enter image description here

If you want to move the executable to /usr/bin/ feel free, however it works fine out of the box wherever you extract it to.

This will also make the appropriate desktop entries upon install.