Install Posit Professional Drivers for Linux
Overview
How to install Posit Professional Drivers for Linux.
Linux OS
On Linux you can install Posit Professional Drivers using RPM/DEB packages with these instructions.
This installation method gives you immediate access to all available drivers and provides a streamlined upgrade process for multiple drivers.
If you can’t install RPM/DEB packages on your Linux Desktop, you can use the following steps below.
Step 1. Install dependencies
Install an OBDC driver manager using your system package manager:
sudo yum install unixODBC unixODBC-devel
sudo apt-get install unixodbc unixodbc-dev
sudo zypper install unixODBC unixODBC-devel
Verify that you’re running unixODBC 2.3.5 or laterThere are known issues using older versions of unixODBC.
Running the command
odbcinst --version
should tell you which version your Linux installation provides. If you have a unixODBC version below 2.3.5, please use the following steps to upgrade it to the latest:curl -O http://www.unixodbc.org/unixODBC-2.3.16.tar.gz tar -xvf unixODBC-2.3.16.tar.gz && cd unixODBC-2.3.16 ./configure && make sudo make install
Then confirm the installation with version 2.3.16 with
odbcinst --version
.After this, you must reinstall the
odbc
package in R, if already installed.By default,
sudo make install
adds libraries to/usr/local/lib
. In some default installations of R, this path isn’t present on theLD_LIBRARY_PATH
environment variable set by R at startup.Verify the following within RStudio:
Sys.getenv("LD_LIBRARY_PATH")
If
/usr/local/lib
isn’t present at the beginning of this list, modify theldpaths
script for your version/versions of R to ensure that it’s set at the beginning of theLD_LIBRARY_PATH
variable.The path to the
ldpaths
script is a symlink at<R installation directory>/etc/ldpaths
. For default R installations, this is/usr/lib/R/etc/ldpaths
, which links to/etc/R/ldpaths
, by default.It’s usually sufficient to change
/etc/R/ldpaths
like so:{.bash filename="File: /etc/R/ldpaths} ... LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH
Verify that the library paths are correct before reinstalling the ODBC package.
If the wrong version of the library loads, user-installed drivers don’t work.
Only then you should reinstall the
odbc
package:install.packages(c("odbc"))
Additional steps for using the Oracle database driverIf you are working with the Oracle database, you must:
- Install version 19.21 of the Oracle Instant Client
- Link the Oracle library directory to the Posit Professional Drivers library directory by running the following command:
Terminal
ln -s /usr/lib/oracle/19.x/client64/lib/* /opt/rstudio-drivers/oracle/bin/lib/
Please adjust the directory minor version (x) according to the installed version of the Oracle Instant Client.
For more information on connecting to Oracle Databases, see the Connecting to Oracle databases with Posit Professional Drivers support article.
Step 2. Install the drivers
Install the drivers using RStudio Desktop Pro:
- Open RStudio Desktop Pro.
- In the Connections pane, click New Connection.
- Select the data source from the list.
- Specify the installation location for the driver (the default path is
/home/<user>/.local/share/rstudio/odbc/drivers
). - Click Next.
- After the installation completes, click Next. The driver has now been installed.
- You can either:
- Click Cancel.
- Enter the connection details to test and/or establish a connection.
Installing the drivers this way automatically updates entries in the odbcinst.ini
file used by unixODBC.
To determine the path to the file that’s used, run the following in the terminal:
Terminal
odbcinst -j
The output could resemble:
Terminal
unixODBC 2.3.16 DRIVERS............: /usr/local/etc/odbcinst.ini SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources USER DATA SOURCES..: /home/username/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8
The
DRIVERS...
entry shows the location of theodbcinst.ini
file.
Step 3. Testing database connectivity
Test the database connectivity directly from within RStudio Desktop Pro:
Open RStudio Desktop Pro.
In the Connections pane, click New Connection.
Select the data source from the list.
Enter the requested information and click Test.
If prompted, enter the database password.
Configure ODBC DSNs for testing and making database connectionsIf you prefer, you can also set up ODBC DSNs to test and make database connections.
Define the DSNs in
~/.odbc.ini
. For example:File: ~/.odbc.ini
[test] Driver = SQLServer Server = my.server.name Database = dbname Port = 1433
Then, access the DSN directly from the New Connection dialog or test from the terminal with the following:
Terminal
isql test
Upgrading
Installing the latest version of the Professional Drivers replaces the currently installed version.
Uninstallation
Uninstall the drivers using RStudio Desktop Pro:
- Open RStudio Desktop Pro.
- In the Connections pane, click New Connection.
- Select the data source from the list.
- Click Uninstall….
- When prompted to uninstall the driver, click Yes.
This removes the driver files and deletes the driver entry from odbcinst.ini
.