RProstgreSQL package installation error with CENTOS8

Hi, I am new in this community, and I would like to check with you an error I am getting installing RPostgreSQL package.

I have installed postgresql12 and R in a centos8 server.

To connect R with postgresql I needed to install RpostgreSQL package. But firstly I got this error:

"In file included from RS-PQescape.c:7: RS-PostgreSQL.h:23:14: error fatal: libpq-fe.h: No existe el fichero o el directorio"

I solved it firtsly installing in centos8 postgresql-devel, and secondly copying the directory postgresql/include where libpq-fe.h was, to the directory usr/local/include, so R could find it.

After a new installion of the RPostgreSQL package, I got this new error:

Error: package or namespace load failed for ‘RPostgreSQL’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/lib64/R/library/00LOCk--PostgreSQL/00new/RPostgreSQL/libs/RPostgreSQL.so':
/usr/lib64/R/library/00LOCK-RPostgreSQL/00new/RPostgreSQL/libs/RPostgreSQL.so: undefined symbol: PQfmod
Error: loading failed

Does anybody solved this problem? Which is the correct way of installing "RPostgreSQL" package in R for Centos8?

Thanks a lot

Ruben