Run updates and install upgrades:
sudo apt update && sudo apt upgrade
Install unzip utility and libaio for sqlplus:
sudo apt install unzip -y
sudo apt-get install libaio1 libaio-dev -y
Create folder in /opt
:
sudo mkdir /opt/oracle
Download instantclient and instantclient_sqlplus, please make sure to download the correct version from this website.
The easiest solution is to copy the download link and download it using (please replace xx.x
with the desired version, at the time of writing the newest version is 21.4
):
wget -O instantclient_xx_x.zip https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-xx.x.0.0.0dbru.zip
wget -O instantclient_sqlplus_xx_x.zip https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sqlplus-linux.x64-xx.x.0.0.0dbru.zip
Unzip the downloaded zip files into the previously created folder in /opt/oracle
:
sudo unzip instantclient_xx_X.zip -d /opt/oracle
sudo unzip instantclient_sqlplus_xx_x.zip -d /opt/oracle/
In the next step we need to add the folder /opt/oracle
to the PATH
and LD_LIBRARY_PATH
environment variables.
This would be the ideal point to create a new user account for your application to run under using the command useradd username
, add it to the sudo group using usermod -aG sudo username
.
This can by done by adding these lines at the end of your .profile
file using these commands:
su - username
nano ~/.profile
Make sure to replace xx_x
with your actual version number like 21_4
export PATH="$PATH:/opt/oracle/instantclient_xx_x"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/opt/oracle/instantclient_xx_x"
After adding it to the .profile
file execute:
source ~/.profile
Download the wallet archive file from your database and move it into this folder: /opt/oracle/instantclient_xx_x/network/admin
and unzip it there.
Now you should be able to connect to your database by using the sqlplus
utility. You can copy the connection string in your database.
sqlplus username@password/connectionstring
Finally you can uninstall unzip if you don't desire to keep it.
sudo apt remove unzip