As part of the programming module you study on the course, you are required to interact with the Python programming language. This interaction will be undertaken using an Integrated Development Environment (IDE), which will be installed within the Linux-based operating system.
In this guide, you shall be taken through the journey of installing the Jetbrains IntelliJ IDEA IDE and how it will interact with the Linux (Debian-based) operating system for any module that may make use of the IDE.
The IDE recommended by this course, is the JetBrains suite of applications. The JetBrains suite is payware, and as such they do not come for free. However, as students at this university, you are able to get a free educational licence. To get your free license, follow the instructions at the following URL:
Important
You will want to use your Coventry University e-mail address to register for your JetBrains account. It is also very important you remember the password for this account, as you will need to use these details to activate the IDE and renew your licence every year you are a student.
The JetBrains IntelliJ IDEA application is an IDE and is relatively useful for the course you are studying as it provides a means to develop applications (or reports) for a variety of different languages.
Downloading the IDE is relatively straight forward, you can use a single command. Before you can execute the command, you will need to open the Terminal window. To do this, you can either use the keyboard shortcut: Ctrl + Alt + T or search for Terminal in the Application.
In the terminal window, you can proceed with downloading the IDE file by entering the following command:
This will begin the process of downloading the IntelliJ IDEA installation files from the JetBrains server. Once the
files have been downloaded, they are stored in a compressed archive (.tar.gz
). This will require being uncompressed
to an appropriate area of your Linux system. To Uncompress an archive, the tar
command can be used. However, before
you begin to uncompress the archive, you are required to decide which directory to uncompress the archive to. For this
guide, the archive will be uncompressed to the /opt
directory.
The opt
directory is a root-privileged only directory, as such you are required to use the sudo
command to escalate
privileges on the machine. To uncompress the archive to the opt
directory, the following command can be used:
The -C
flag is used to denote which directory you would like the contents of the compressed archived to be extracted
to. When the command is executed, you will be asked for the password of your user account. In this instance, you will
want to enter the password you would normally use to log in to the system.
Note
When you enter the password it may come across as if you are not entering anything, and this is normal. You should continue entering the password as usual and then push the Enter key.
With your password entered to run the escalated command, the process will begin for extracting the contents of the
archive. To confirm whether the files have been extracted to the opt
directory, the following command can be executed
in the terminal window:
The outcome of this command should list the folders and files that are located in the /opt
directory. In this
instance you should see a directory has been created called idea-IU-*
. The asterisk (*
) is a placeholder for a
version number.
Before you can begin using the IntelliJ IDEA IDE, there are a couple of extra things that need to be done. This will
tidy up the opt
directory, and ensure that you can access the IDE from the Application screen.
The first step is relatively straight forward; to rename a directory you can move the contents of the folder to another
folder with the new name. This can be achieved with using the mv
command:
The command above is essentially renaming the idea-IU-231.8109.175
directory to intellij
, omitting the version number
231.8109.175
. Remember, that the sudo
command is also being used as the opt
directory is a root-privileged only
directory, thus any changes made to this directory needs root/administrator access.
To confirm whether the changes have been successfully applied, you can list the contents of the /opt
directory using
the ls
command:
The outcome from this command can be seen in Figure 5, and you can observe that the old idea-IU-231.8109.175
directory has
been renamed to intellij
.
The next step is to add the CLion binary to the Application screen so it can be easily accessible for you, instead of
having to run a command when you want to access the IDE. To achieve this, a file needs to be created in the directory
/usr/share/applications
. Once again, this directory requires root-privileges and as such the sudo
command will be
required. In this directory, you are required to create a file called IntelliJ.desktop
and this can be achieved using the
nano
command:
The nano
command will open a text-editor in the terminal window, in which you will be able to type (or paste) content
into the newly created file IntelliJ.desktop
. The contents of this file should be the following:
[Desktop Entry]
Type=Application
Terminal=false
Name=IntelliJ IDEA Ultimate
Icon=/opt/intellij/bin/idea.svg
Exec=/opt/intellij/bin/idea.sh
To save the contents of the file, press the following key combination on the keyboard, Ctrl + X. This will then create a shortcut to the IntelliJ IDEA binary on the Application screen. You can now search for the IDE in the Applicationscreen, by clicking on the grid of dots in the bottom left-hand corner and searching for IntelliJ.
To open the IDE click on the icon in the Application screen. Before the main IDE window is opened, the IntelliJ IDEA user agreement will be shown, click on the checkbox to agree to the user agreement and click the Continue button. Another window will be presented, asking whether you want to share your data, click on the Don't Send button.
Once the relevant user agreements and data sharing processes have been completed the IntelliJ IDEA application will begin to load.
On the first instance of following this guide, and the IDE has been installed and loaded, it will ask for you to activate your software. In order to do this, you need to click on the Log In to Jetbrains Account... button. This will open an internet browser window, whereby you will need to sign-in with your JetBrains account you created earlier.
Once you have logged in to your account, the internet browser will close automatically, and you should now see an Activate button appear. Click on this button and your IDE will be activated.
Before you can begin using the IDE for providing solutions for the programming module using the Python programming language, you are required to install a plugin for the IntelliJ IDEA IDE. Once the IDE has loaded, you will be met with a splash. On the splash screen, you will see a button labelled Plugins on the left-hand side of the splash screen, click on this button. The screen will change to present you with a Marketplace of various plugins that can be installed.
On this screen, you can see that the Marketplace tab is active with a blue line underneath the label Marketplace. Directly below this is a search box, and in this box you need to enter the term Python, and a list of options will pop-up.
The first option returned should be labelled just Python with the author being JetBrains s.r.o. This is the plugin that is required to be installed, therefore you can click on the green button labelled Install. This will begin the installation process of the Python plugin for the IDE.
Once it has been successfully installed, you will be met once again with a green button, but this time labelled Restart IDE, click this button and the IDE will be restarted. Once the IDE has restarted, we can begin with the creation of a new Python project.
In this section of the guide, we shall begin the process of creating a new Python project. Once the IDE has loaded, you will be met with a splash screen. On the splash screen, you will see a button labelled New Project, click on this button. A new window will pop up with a variety of different options.
In this window you will need to select the New Project option on the left hand-side. Once this item has been
selected, you will then be asked to provide a name of the project and the location where you would like to save the
project folder. In this instance, you can all the project My_First_Project
and the location can stay as the default
location: /home/ian/IdeaProjects
.
Note
Notice the underscores in the name of the project? The Ubuntu Linux distribution does not like blank spaces in filenames or directory names. As our project will create a new directory, we need to replace the blank spaces with an underscore.
On the same screen, you can see an option to create a Git repository, you can leave this option unchecked. There are also options to select the type of programming language that will be used. If you have installed the Python plugin correctly, an option for Python should be presented. Ensure that this option is selected, as you will be wanting to create a Python project.
With the Python language selected, you will then be met with some additional options to create an Environment. In this instance, you will want to select the New option, and then directly below that you will want to select the Virtualenv environment type. Virtual environments are a great method of keeping your system Python's interpreter separate to any individual projects you are working upon.
Once these settings have been applied you can proceed and click on the Create button. This will begin the process of creating the new Python project.
That is the end of this guide on setting up the JetBrains IntelliJ IDEA IDE. If you have followed all the necessary steps correctly, you should have a fully functional IDE which will enable you to complete any necessary programming based lab activities you will participate with on this course.
If you have spotted any errors or issues within this tutorial, you can e-mail Dr Ian Cornelius. Ensure to include in your message a description of the error or issue and a possible resolution. Also remember to include a URL to the page with the issue or error.