In this post, I will walk you through the steps on how you can install IBM CPLEX on Ubuntu 20.04.
Here are the steps to Install IBM CPLEX on your Ubuntu –
- Download CPLEX
- Install CPLEX
- Edit the Bashrc file
- Finish, Run CPLEX
Download IBM CPLEX –
Download directly using Browser –
Okay, so the first step will be to download the IBM CPLEX bin file. You can download CPLEX by Going to this link here – http://www.mysmu.edu/faculty/hclau/is421.html
Here select the .bin file for Linux 64-bit if your system is 64-bit. If it’s 32-bit then you can go to the (OLD) Installation Package section and download the 32-bit version from there.
You can also alternatively download CPLEX by going to IBM’s official website – https://www.ibm.com/products/ilog-cplex-optimization-studio. Here select the version you need. The free edition or the academic edition.
After downloading the CPLEX bin file, create a new folder and move the bin file to the new folder that you created. Name the folder “cplex”.
Download using Terminal –
To download IBM CPLEX using the terminal follow these steps –
NOTE: You’ll need root permission to be able to download CPLEX using the terminal. Download it directly from the internet if you don’t have root permissions.
1. Open the terminal, first update and upgrade your ubuntu using the command –
sudo apt-get update
sudo apt-get upgrade
2. Create a new directory where we will download the CPLEX bin file. This is to make things organized instead of installing everything here and there.
mkdir -p cplex
This command will create a new directory called “cplex” in your ubuntu.
3. Change the working directory to “cplex”.
cd cplex
4. After changing the directory you can download CPLEX to that directory using the command given below.
wget http://www.mysmu.edu/faculty/hclau/CPLEX/cplex_studio128.linux-x86-64.bin
If your ubuntu system don’t have wget installed then you can install it using this command –
sudo apt-get install wget
After the download completes change your working directory back to the previous one –
cd ..
Once the download completes you can now follow the steps below to install CPLEX on ubuntu.
Installing IBM CPLEX –
Now let’s see the installation process. To install CPLEX we will have to first run and execute the bin file that we downloaded.
But before that, we’ll have to change our working directory to the one where we downloaded the bin file.
cd cplex
After changing the directory we will execute the bin file. To do that we will run the following command-
bash /home/username/cplex/cplex_studio128.linux-x86-64.bin
Here in the place of “username” type your own username.
After executing the bash file follow the instructions of the installation process.
Here it will ask you to select your language, select English by entering number 2. Choose different numbers for different languages as shown in the installation window. Click Enter.
After that enter number “1” to accept the user agreement.
Now here it will ask you to enter an ABSOLUTE PATH to install CPLEX on your system. You should give the path where you downloaded CPLEX. In our case, it will be –
/home/username/cplex/CPLEX_Studio128
After entering the absolute path, press enter and then enter “y” to continue. Follow the remaining steps shown in the terminal.
Now, after it asks you to press Enter to exit the installer. Press enter which will finish the installation.
Edit Bashrc File –
After that, now we will have to edit the bashrc file. To edit the bashrc file first change your working directory to the directory where you installed CPLEX.
As we were already in the “cplex” directory we will use this command –
cd CPLEX_Studio128
Now, after changing the working directory we’ll edit the bashrc file using the gedit editor-
gedit ~/.bashrc
This command will open the bashrc file in the text editor where we will need to scroll down to the bottom of the file and add this line –
export PATH=$PATH:/home/username/cplex/CPLEX_Studio128/cplex/bin/x86-64_linux
Here, change “username” to your own username.
Now after adding the following line in the file, click on the Save button at the top of the editor and then click on the close button.
Finish and Run CPLEX –
Now after saving the file in the terminal type this command to finish the installation process of IBM CPLEX.
source ~/.bashrc
And, that’s it. You can now run CPLEX on your Ubuntu by typing “cplex” in your terminal.
cplex
[lyte id=’c9uVSaQkd8o’ /]
Frequently Asked Questions –
Do I need Root permission to install CPLEX ?
No, you don’t need root permission to install CPLEX. You can install it without root permission.
How do I download CPLEX from the IBM website?
To download CPLEX from the IBM website you will need to first go to this link here. Now on the IBM website, we’ll need to select the Free Edition or the Academic Edition. After that, you’ll need to create an IBM account after which you can download CPLEX from there.