Friday, August 31, 2012

GIS Republic: Installing & Configuring PostgreSQL + PostGIS in U...

GIS Republic: Installing & Configuring PostgreSQL + PostGIS in U...: Installing & Configuring PostgreSQL + PostGIS in Ubuntu 12.XX Installation Launch Terminal Open Terminal. Use Ctrl+Alt+T key c...

Installing & Configuring PostgreSQL + PostGIS in Ubuntu 12.XX



Installing & Configuring PostgreSQL + PostGIS in Ubuntu 12.XX

Installation

Launch Terminal

Open Terminal. Use Ctrl+Alt+T key combination                         
















install python-software-properties. Type the command below in the terminal

sudo apt-get install python-software-properties








Add PPA repository to my Ubuntu.

Type the command below in the terminal
sudo add-apt-repository ppa:pitti/postgresql



 








Update the System

After adding PPA, update your system apt:
Type the command below in the terminal
                sudo apt-get update

















Finally install postgresql-9.X:

Type the command below;
sudo apt-get install postgresql












A successful installation

Configuring postgresql.conf to use port 5432...

update-alternatives: using /usr/share/postgresql/9.1/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode.

 * Starting PostgreSQL 9.1 database server                      [ OK ]

Setting up postgresql (9.1+134~precise) ...


if you having any error, make sure you already install libpq-dev. The libpq-dev package is for compiling wrappers/clients against libpq.

Install libpq-dev package


$sudo apt-get install postgresql-9.1 libpq-dev


 

 

 

 

 











Wednesday, August 22, 2012

APACHE 2 + TOMCAT 7 + GEOSERVER



Installing Tomcat 7 and Apache2 with mod_jk on Ubuntu 12.04 or linode a cloud platform powered on linux distros


This is a tutorial on how to install Tomcat and Apache2, and then configure to connect the Apache Web Server to Tomcat using mod_jk and then drop a war file for geoserver.
Login as root in the LINODE instance by issuing the following commands

su root

A password prompt appears prompting you to supply the password. Issue the following command to install Apache:

apt-get install apache2













Test the installation from the browser using http://localhost/

apt-get install tomcat7
apt-get install tomcat7-admin


Issue the following command

apt-get install libapache2-mod-jk

First lets enable the redirect port 8443 on Tomcat by issuing the following command

vim /etc/tomcat7/server.xml

and uncomment the following line

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />











Now we will create our workers.properties file for Apache. 

vim /etc/apache2/workers.properties

Copy and paste the text below;

# Define 1 real worker using ajp13
worker.list=worker1, worker2
# Set properties for worker (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

# Define second  real worker using ajp13
# Set properties for worker (ajp13)
worker.worker2.type=ajp13
worker.worker2.host=localhost
worker.worker2.port=8010
















Issue the command to save and quit

:wq

Ask Apache to use this worker 

vim /etc/apache2/mods-available/jk.conf

Change the JkWorkersFile property to;

/etc/apache2/workers.properties















Finally configure the URL so that Apache web server should pass through to Tomcat servlet requests

vim /etc/apache2/sites-enabled/000-default

and add the following line in your opened file in the terminal

<VirtualHost *:80>
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
JkMount /apps* worker1
JkMount /geoserver* worker2
</VirtualHost *:80>


















Now, restart the servers

/etc/init.d/tomcat7 restart
/etc/init.d/apache2 restart



Download a web archive file (*.war) from GeoServer downloads

Copy file to Tomcat7 Directory root folder

cp /home/administrator/Downloads/geserver-2.1.4.zip  /var/lib/tomcat7/webapps

Unzip the file by issuing the below command in the terminal.

unzip geoserver-2.1.4.zip

Immediately, your geoserver-2.1.4.war file is exploded by tomcat7 into a folder.The folder is called GeoServer. Test GeoServer by typing on your browser http://localhost/geoserver. An example can be shown from this link.

Tuesday, August 21, 2012

LAMP SERVER On Ubuntu 12.04 Locally or in Linode


Authentication

Log in as root by issuing the following command
su root
Use SSH to login to LINODE instance. NB if using SSH key pair authentication mode then username/password authentication is unnecessary as shown below.

           ssh dmuthami@176.58.114.103
















Hostname

Set the hostname by issuing the following commands
hostname
hostname -f
Results for issuing hostname command
li501-103
li501-103.members.linode.com

LINODE Login

Login as root in the LINODE instance by issuing the following commands
su root
A password prompt appears prompting you to supply the password

Install and Configure the Apache Web Server

Issue the following command to install Apache:
apt-get install apache2











Now we'll configure virtual hosting so that we can host multiple domains (or subdomains) with the server. These websites can be controlled by different users, or by a single user, as you prefer.


Configure Name-based Virtual Hosts

Issue the below command
vim /etc/apache2/sites-available/spatialwise_apps.com




Enter the entries below by typing or copying and pressing Shift+CTRL+V
<VirtualHost *:80>
     ServerAdmin waruid@gmail.com
     ServerName example.com
     ServerAlias www.spatialwise_apps.com
     DocumentRoot /srv/www/spatialwise_apps.com/public_html/
     ErrorLog /srv/www/spatialwise_apps.com/logs/error.log
     CustomLog /srv/www/spatialwise_apps.com/logs/access.log combined
</VirtualHost>












Issue the following commands
esc
Type the following commands to save and quit
:wq
Before you can use the above configuration, you'll need to create the specified directories. For the above configuration, you can do this with the following commands. Substitute your own domain names for those shown below.
mkdir -p /srv/www/spatialwise_apps.com/public_html
mkdir /srv/www/spatialwise_apps.com/logs




After you've set up your virtual hosts, issue the following commands:
a2ensite spatialwise_apps.com




This command symbolically links your virtual host file from sites-available to the sites-enabled directory. Finally, before you can access your sites you must reload Apache with the following command:
service apache2 reload



Install MySQL

The first step is to install the mysql-server package, which is accomplished by the following command:
apt-get install mysql-server




During the installation you will be prompted for a password. Choose something secure (use letters, numbers, and non-alphanumeric characters) and record it for future reference.


Configure MySQL and Set Up Databases

Run the following command to execute the program:
mysql_secure_installation










Next, you may create a database and grant your users permissions to use databases. First, log in to MySQL:
mysql -u root -p
Enter MySQL's root password, and you'll be presented with a MySQL prompt where you can issue SQL statements to interact with the database.

To create a database and grant your users permissions on it, issue the following command. Note, the semi-colons (;) at the end of the lines are crucial for ending the commands. Your command should look like this:
create database lollipop;
grant all on lollipop.* to 'foreman' identified by '5t1ck';
flush privileges;

With that completed, you've successfully configured MySQL and you may now pass these database credentials on to your users. To exit the MySQL database administration utility issue the following command:
quit
With Apache and MySQL installed you are now ready to move on to installing PHP to provide scripting support for your web pages.









Install and Configure PHP

Ubuntu includes packages for installing PHP from the terminal. Issue the following command:
apt-get install php5 php-pear
Issue the command below and see to it the settings below are well done.
vim /etc/php5/apache2/php.ini

max_execution_time = 30
memory_limit = 64M
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
log_errors = On
error_log = /var/log/php.log
register_globals = Off










After making changes to the PHP configuration file, restart Apache by issuing the following command:
service apache2 restart

If you need support for MySQL in PHP, then you must install the php5-mysql package with the following command:
apt-get install php5-mysql
To install the php5-suhosin package, which provides additional security for PHP 5 applications (recommended), issue the following command:
apt-get install php5-suhosin
Restart Apache to make sure everything is loaded correctly:
service apache2 restart