David Ghedini

Linux, Java, Oracle, and PostgreSQL

David Ghedini

Wednesday Dec 23, 2015

PostgreSQL 9.5 Scripts for CentOS 6 and CentOS 7

I'm always pleasantly surprised to see that my "Install PostgreSQL 9 on CentOS" from back in 2011 is still coming up on Google searches and that I still get the occasional new comments for it.

I thought I might be useful to add some scripts for PostgreSQL 9.5 (and 9.4) for Both CentOS 6 and CentOS 7 that may be time savers.

Please read the README and use only on a clean install!





The CentOS scripts lists all of the packages individually so you can easily edit the script to add or remove packages.

The scripts adds some basic security steps:

  • Creates a minimally privilaged user (pgadmin - change to whatever you like)
  • Disables root log in
  • Sets the SSH port to 3838 (change to whatever you like).
  • Sets root, postgres, admin, and ssl pass to 32 chars
  • Installs IP tables (if you want to use firwalld, comment the appropriate lines as noted).
  • Configures Webmin for managing PostgreSQL
  • Installs a self-signed SSL for PostgreSQL
  • Updates pga_hba.conf to MD5 and SSL
  • Updates postgresql.conf for SSL and remote connections.

Once completed, it will display the new passwords for pgadmin, root, postgres, and ssl as well as write them to an auth.txt file

: Example Output at End of Script
Passwords saved in /root/auth.txt
pg pass: DqVnavTlCXcSKfHprgUtjF-20rpfsKui
ssl pass: yxaQJCXgudTw19XEOMPdZzNd5n6rwVOG
pgadmin pass: A0RUHtPfSFC82mHeDP_ixrRavk7itgkE
root pass: RvZDHkZv-AeQS-ce0Mcnif7GxmmJ-zxN

Bookmark and Share

Monday Dec 07, 2015

DSpace Handle Server: java.lang.Exception: Incorrect passphrase

The solution is provided by Rafael Carreres Paredes at


I had a bit of trouble locating it, however, so hopefully this will help the next person:

After issuing './bin/start-handle-server' there is no error displayed but handle server is not running.

The /dspace/log/handle-server.log shows:

Enter the passphrase for this server's authentication private key: 
Note: Your passphrase will be displayed as it is entered
Error: Incorrect passphrase
       (see the error log for details.)

Shutting down...

And in /handle-server/error.log:

Unable to initialize server signature object: java.lang.Exception: Incorrect passphrase
java.lang.Exception: Incorrect passphrase
	at net.handle.hdllib.Util.decrypt(Util.java:1083)
	at net.handle.server.HandleServer.(HandleServer.java:306)
	at net.handle.server.AbstractServer.getInstance(AbstractServer.java:72)
	at net.handle.server.Main.initialize(Main.java:152)
	at net.handle.server.Main.main(Main.java:75)

SSH and navigate to your dspace lib directory.

Navigate to your /lib directory and use the java key util as below (be sure to substitute paths for your privkey to your own):

 java -cp handle-6.2.jar net.handle.apps.tools.KeyUtil /var/lib/dspace-5.4/handle-server/privkey.bin

It starts an interactive session in which you will be asked for your password (the one you set handle configuration) and then give the option of 'Save private key without encryption'

Enter the passphrase for this private key:
Note: Your passphrase will be displayed as it is entered

Choose an operation:
  1: Encrypt private key with passphrase
  2: Save private key without encryption
  3: Exit
Warning: data not encrypted
Private key saved to file: /var/lib/dspace-5.4/dspace/handle-server/privkey.bin

Choose an operation:
  1: Encrypt private key with passphrase
  2: Save private key without encryption
  3: Exit

Check that you handle server is now running as well as logs.

Bookmark and Share

Thursday Sep 03, 2015

Install PhantomJS on cPanel

This post will cover installing PhantomJS on cPanel with root access.

The documentation at http://phantomjs.org/build.html is all that is needed. I am only blogging this to let others know it did not break my cPanel server.

1. Download and install the dependencies

I already had openssl-devel, make, gcc, abd gcc-c++

[root@demos opt]# yum -y install flex bison gperf ruby freetype-devel fontconfig-devel libicu-devel sqlite-devel libpng-devel libjpeg-devel openssl-devel, make, gcc, abd gcc-c++
[root@demos opt]# service httpd start

2. Download and unzip latest source code from http://phantomjs.org/download.html

[root@demos opt]# wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-source.zip
[root@demos opt]# unzip -q phantomjs-2.0.0-source.zip

3. Enter the phantomjs-2.0.0 directory and run './build';

[root@demos phantomjs-2.0.0]# ./build.sh

You will see a notice saying it will 30 minutes to several hours. It only took about 20 minutes on my server.

When build completes and you are still in the phantomjs-2.0.0 directory, you can run 'bin/phantomjs' to test and you should get a prompt.

4. Create a symlink to put phantomjs in everyone's path:
[root@demos phantomjs-2.0.0]# ln -s /opt/phantomjs-2.0.0/bin/phantomjs /usr/bin/phantomjs

As stated in the documentation at

"This produces a build bin/phantomjs. This is an executable; it can be moved to a different directory (e.g. /usr/local/bin) or another machine."

So you could just move it to /usr/bin as well.

Bookmark and Share

Main Menu

Built With



Tag Cloud

Hosted by:




petiole Cloud