Menu

PostgreSQL Database on Linux

AJGrant

PostgreSQL Database on Linux

If you wish to use a PostgreSQL server installed locally rather than using the default Built-In database then you should install and configure the PostgreSQL database prior to installing and Configuring Hypersocket. If you are using Ubuntu then bear in mind that as of Ubuntu 12.4 there is an option to include PostgreSQL during installation, if it is not installed use the following commands:

sudo apt-get install postgresql

To begin set a password for the postgres user

sudo -u postgres psql postgres
\password postgres

Enter a password and then confirm it, in this example we'll enter postgres

PostgreSQL server should be running run the following command from a terminal prompt to check:

sudo netstat -tap | grep postgresql

You should see the following line or something similar:

tcp 0 0 localhost:postgresql *:* LISTEN 2561/postgres

If the server is not running start it:

sudo service postgresql restart

After installation, connect to your MySQL server as root from a terminal prompt and execute the following:

sudo -u postgres createdb hypersocket
sudo -u postgres psql -d hypersocket
CREATE USER hypersocket WITH PASSWORD 'hypersocket';
GRANT ALL PRIVILEGES ON DATABASE hypersocket to hypersocket;

Now install Hypersocket.

Depending on the installer you are using, configuring Hypersocket to use the PostgreSQL database will differ. If you are using a GUI installer then after the Hypersocket files are installed you will be prompted to configure Hypersocket's operational ports and then the database to be used, here you will be able to select the PostgreSQL option and then provide the hostname and port of the server, the database name, and authentication details, if you followed the earlier example these would be:

Hostname – localhost
Port – 3306
Database – hypersocket
Username – hypersocket
Password - hypersocket

Finishing this configuration will complete the installation and you will be able to start the Hypersocket service.

If you are using a command line installer then configuration requires a little bit more. After installation completes and before the service is started you will need to go to the Hypersocket conf directory:

cd /opt/hypersocket/conf

Open the database.properties file as root in order to edit the content:

sudo vi database.properties

Delete the existing contents of the file and enter the following replacing the 5 variable entries with the relevant details for the PostgreQL server:

jdbc.driver.className=org.postgresql.Driver
jdbc.url=jdbc:postgresql://${installer:databaseHost}:${installer:databasePort}/${installer:databaseName}
jdbc.username=${installer:databaseUser}
jdbc.password=${installer:databasePassword}
jdbc.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

The file will contain a number of placeholder values that need to be updated, each of these entries will need to be changed to use the actual details of the SQL database that Hypersocket will connect to:
If you used the earlier example then the text should now look like this:

jdbc.driver.className=org.postgresql.Driver
jdbc.url=jdbc:postgresql://localhost:3306/hypersocket
jdbc.username=hypersocket
jdbc.password=hypersocket
jdbc.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

Save the changes to the file and start the service, Hypersocket should now begin using the PostgreSQL database.


Related

Wiki: Server Installation

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.