One question
This article documents the main steps of the offline configuration.
Second, the desired dependencies
In this case, the required dependencies total of five, as follows:
• PostgreSQL-libs-9.2.24-1.el7_5.x86_64.rpm, Download http://mirror.centos.org/centos/7/os/x86_64 /Packages/postgresql-libs-9.2.24-1.el7_5.x86_64.rpm
• PostgreSQL-9.2.24-1.el7_5.x86_64.rpm, Download http://mirror.centos.org/centos/7/os /x86_64/Packages/postgresql-9.2.24-1.el7_5.x86_64.rpm
• PostgreSQL-devel-9.2.24-1.el7_5.x86_64.rpm, download http://mirror.centos.org/centos/7 address /os/x86_64/Packages/postgresql-devel-9.2.24-1.el7_5.x86_64.rpm
• unixODBC-2.3.7pre.tar.gz, Download https://jaist.dl.sourceforge.net/project/unixodbc /unixODBC/2.3.7/unixODBC-2.3.7pre.tar.gz
• psqlODBC-10.03.0000.tar.gz, Download https://ftp.postgresql.org/pub/odbc/versions/src/psqlodbc-10.03 .0000.tar.gz
After the Internet to download, and then uploaded to the network server Centos.
Third, the installation
1) dependent packages installed postgresql
This part of the work is relatively simple, can be performed in sequence:
rpm -ivh postgresql-libs-9.2.24-1.el7_5.x86_64.rpm
rpm -ivh postgresql-9.2.24-1.el7_5.x86_64.rpm
rpm -ivh postgresql-devel-9.2.24-1.el7_5.x86_64.rpm
2) install unixODBC
This section also without difficulty:
tar -zxvf unixODBC-2.3.7pre.tar.gz
cd unixODBC-2.3.7pre
./configure --enable-gui=no
make
make install
3) Installation psqlodbc
A generic error occurred in this part, but the reason was most of the previous two steps, must be examined carefully. as follows:
tar zxvf psqlodbc-10.03.0000.tar.gz
cd psqlodbc-10.03.0000
./configure
make
make install
If the error can not find libpq.so, the cause may not know /usr/lib/libpq.so.5 or usr / lib / libpq.so.5.5, create a soft link libpq.so in / usr / lib, or wherein a direct copy and rename.
Fourth, configure ODBC
This section in the offline, online is the same.
1) Edit /etc/odbcinist.ini
The configuration file is mainly related driver files, the following is to create a ODBCPostgres items:
[ODBCPostgres]
Description = ODBC for PostgreSQL
Driver = /usr/local/lib/psqlodbcw.so
Driver64 = /usr/local/lib/psqlodbcw.so
Setup = /usr/local/unixODBC/lib/libodbc.so
Setup64 = /usr/local/unixODBC/lib/libodbc.so
FileUsage = 1
2) Edit /etc/odbc.ini
The configuration data file specific information sources, such as:
[PostgresDB]
Driver = ODBCPostgres
Description = Postgres DSN
Servername = 192.168.64.123
Database = postgres
Username = postgres
Password = postgres
Port = 5432
ReadOnly = No
3) Testing
Unixodbc own use isql to test whether a successful connection:
export ODBCINI=/etc/odbc.ini
export ODBCSYSINI=/etc
isql PostgresDB postgres postgres