[postgres@centos7 ~]$ mkdir ~/openssl [postgres@centos7 ~]$ openssl req -new -x509 -days 365 -nodes -text -subj '/CN=postgres' -out ~/openssl/server.crt -keyout ~/openssl/server.key Generating a 2048 bit RSA private key .............+++ .+++ writing new private key to '/home/postgres/openssl/server.key' ----- [postgres@centos7 ~]$ chmod 600 ~/openssl/server.key [postgres@centos7 ~]$ ll openssl/ total 8 -rw-rw-r-- 1 postgres postgres 4058 Nov 11 08:16 server.crt -rw------- 1 postgres postgres 1704 Nov 11 08:16 server.key [postgres@centos7 ~]$