Environement setup for Macintosh
Before install and launch Gisgraphy, you must setup java, postgres, and postgis. It is not, properly speaking, the installation of Gisgraphy, and if you already have Postgresql, Postgis and java installed (you needs JVM >= 1.5), you can go directly to the gisgraphy installation guide
Install and configure java / JVM
Since Mac OS 8, Java is installed. You just have to check that you have, at least, java 5.0. if it is note the case, update your Mac OS.
To see if Java is correctly installed, open a shell and type :
Install postgresql and postgis
If you already have Postgresql AND Postgis installed, you can skip this section
Install the package
To install Postgres and postgis, you need to download some package backport from Unix. Note that you need to download and install the package in the order bellow :
- PROJ_Framework
- GEOS_Framework
- PostgreSQL
- PostGIS
To make the installation easier, you can run the following lines in a terminal (it is in the Applications -> Utilities folder), it will download and install Postgres and Postgis automatically :
mkdir tempinstall cd tempinstall curl -O http://www.kyngchaos.com/files/software/unixport/PROJ_Framework-4.7.0-2.dmg hdiutil attach PROJ_Framework-4.7.0-2.dmg sudo installer -pkg /Volumes/*/*.pkg -target "/" hdiutil detach /Volumes/PROJ* curl -O http://www.kyngchaos.com/files/software/unixport/GEOS_Framework-3.2.0-1.dmg hdiutil attach GEOS_Framework-3.2.0-1.dmg sudo installer -pkg /Volumes/*/*.pkg -target "/" hdiutil detach /Volumes/GEOS* curl -O http://www.kyngchaos.com/files/software/unixport/PostgreSQL-8.4.3-1.dmg hdiutil attach PostgreSQL-8.4.3-1.dmg sudo installer -pkg /Volumes/*/*.pkg -target "/" hdiutil detach /Volumes/Postgr* curl -O http://www.kyngchaos.com/files/software/unixport/PostGIS-1.5.1-1.dmg hdiutil attach PostGIS-1.5.1-1.dmg sudo installer -pkg /Volumes/*/*.pkg -target "/" hdiutil detach /Volumes/PostGIS*
Configure memory
Postgres need a lot of shared memory to run on Macintosh (read more), so you need to increase it. Run the following lines in a terminal (it is in the Applications -> Utilities folder) :
sudo sysctl -w kern.sysv.shmall=65536 sudo sysctl -w kern.sysv.shmmax=16777216
But this value will be back to their default values when you will startup your Mac. To make these values stick across reboots, add / modify those lines in /etc/sysctl.conf, like this :
kern.sysv.shmall=65536 kern.sysv.shmmax=16777216
Initialize the server
Sometimes The installation is partial ( it is a known issue) and you need to create a directory, give the correct rights and use this folder to store the database :
#Change postgres (mac) user : sudo passwd postgres #you need to log in as "postgres" in order to initialise the database (give the password you've just typed su -l postgres #create a directory to hold postgres data mkdir /usr/local/pgsql/data #create the Database structure /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data --encoding=UTF8 #launch postgres /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
Configure the postgres user / password
By default the postgres user can connect to postgres with the same password as the Mac one, but we'd like that postgres ask for a password and not use the Mac one
- Log in with user 'postgres' :
- Define the postgres (postgresql) user's password
- Update postgres conf Edit the pg_hba.conf
- Restart postgres
if you got the following message : psql command not found, you have to had the path to your PATH : "setenv PATH ${PATH}:/usr/local/pgsql/bin" or "export PATH=$PATH:/usr/local/pgsql/bin"
Now you've changed the password for your postgresql user, we have to tell postgresql to use this password
local all all password host all all 127.0.0.1 255.255.255.255 password
You must restart postgresql to take our changes into account :
as postgres (Mac)'s user, type :
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data reload
Configure Postgis
Here are the command to install a Database and init the Gisgraphy database
# create the database psql -U postgres -h YOURIP -c "CREATE DATABASE gisgraphy ENCODING = 'UTF8';" #create language createlang -U postgres -h YOURIP plpgsql gisgraphy #create postgis function psql -U postgres -h YOURIP -d gisgraphy -f /usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql psql -U postgres -h YOURIP -d gisgraphy -f /usr/local/pgsql/share/contrib/postgis-1.5/spatial_ref_sys.sqlWhere YOURIP is the ip adress of your server(127.0.0.1 in most case)
In order to know if Postgis is correctly install, open a PostgreSQL connection or PgAdmin and type :
select version ();
orSHOW server_version;
. It will give you the PostgreSQL versionselect postgis_full_version () ;
It will give you the Postgis version
Define Environnement settings
Macintosh systems define a maximum number of files that can be open. solr open a large number of files. to avoid message like "Too many open files" you must increase this limit. open a shell and type
sudo ulimit -n6000
that will set the maximum number of open files to 6000.
Sometimes this is not enough. and you have to edit the /etc/security/limits.conf file and add the two following lines :
* hard nofile 20000 * soft nofile 20000
then close and re-open your Mac session to take changes into account.
ulimit -aH
in a shell to check if the value has been set
And now...
Now that you environement is setup, you can go to the Gisgraphy installation guide