Working with PostgreSql (postgres) and Apache Tomcat in ubuntu

For users who have been through Ubuntu, executing applications in ubuntu via terminal might sound easy but its not the same case for the windows users. Assuming PostgreSql and Tomcat is already installed in your system, (if not refer here) lets see how to execute them.
1. PostgreSql (Postgres):

PostgreSql by default resides in the port 5432 and unless and until you have modified that, the command remains the same everywhere. So open the terminal and use the following command for Staring Postgres

sudo /etc/init.d/postgresql-8.4 start

To shutdown postgres,

sudo /etc/init.d/postgresql-8.4 stop

Note : The version 8.4 might not be the version that you installed. so use the version number, and first try without giving sudo. If an error “permission denied” comes up, then use sudo. Sudo command is to upgrade yourself to the root user or admin for that operation alone. To check your postgres version, open the terminal and give the following command.

psql -U postgres

It will prompt for the password (which should be either syspass or postgres depending upon how we configure it) and once its provided, it will show the version ( shown as psql(8.4.8) )  and psql prompt as shown in the screenshot.

2. Apache Tomcat :

Tomcat server, usually the  folder reside in the usr/local folder if u install through the synoptic package manager, but I download the source from tomcat and then put it in my convenient folder. this is because I ve to either write a shell script or go to the source folder to execute commands. So lets execute it by the folder way. I assume its in /home in a folder called tomcat6. Use the following commands for startup and shutdown.

For Staring Tomcat:
sudo /home/tomcat6/bin/startup.sh

To Shutdown Tomcat:

sudo /home/tomcat6/bin/shutdown.sh<br />

In case you have installed Tomcat from the Ubuntu Repositories or through the binary execution file, the startup and shutdown commands are as follows:

<br /><br />For Starting Tomcat:<br /><br />sudo /etc/init.d/tomcat6 start<br /><br />For Stopping Tomcat:<br /><br />sudo /etc/init.d/tomcat6 stop<br /><br />

Note :

For Windows Users:

You have to basically go into the bin folder of tomcat and run the Catalina batch file. It will open a command prompt terminal, if you want to Close the same, just close the terminal.

Advertisements

About Shankar Balachandran
Technical Manager, Openbravo operations, Kailao Consulting Private Limited

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: