Install the Oracle database client under Ubuntu16.04 to connect the Django project to the Oracle database
1. Download the Oracle Client installation package:
Go to the official website http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html download the three required packages below.
Oracle-instantclient11. 2-basic-11.2. 0.4. 0-1. X86_64.rpmoracle-instantclient11. 2-devel-11.2. 0.4. 0-1. X86_64.rpmoracle-instantclient11. 2-sqlplus-11.2. 0.4. 0-1. x86_64.rpm
2. Install with Alien
Download Alien (Alien can convert rpm format to dev format for RPM package installation):
sudo Install Alien
To install
sudo alien-i oracle-instantclient11.< Span style= "color: #800080;" >2 -basic-11.2 . 0.4 . 0 - sudo alien-i oracle-instantclient11. 2 -devel-11.2 . 0.4 . 0 - sudo alien-i oracle-instantclient11. 2 -sqlplus-11.2 . 0.4 . 0 -
To install the required libraries:
sudo Install Libaio1
3. Configuring the Environment
① Open/etc/ld.so.conf File
sudo gedit /etc/ld. so.conf
Added content:/usr/lib/oracle/11.2/client64/lib/
Execute the/sbin/ldconfig command to make it effective
Open/etc/profile File
sudo gedit/etc/profile
② Add the following environment variables
Export oracle_home=/usr/lib/oracle/11.2/client64export oracle_base=/usr/lib/oracle/11.2 export Ld_library_path=${ld_library_path}: $ORACLE _home/libexport PATH= $PATH: $ORACLE _home/ Bin
Execute command source/etc/profile to make it effective
4.Django connects to Oracle and requires library cx_oracle.
In the virtual environment used by the Django project, install the Cx_oracle
Install cx_oracle-5.2. 1
At this point, Django can successfully connect to the Oracle database.
Installing the Oracle client under Ubuntu16.04