a. Supported Operating Systems include Linux, Unix, and Windows. These installation instructions assume a default Linux/Unix system, but provide Windows instructions where possible.
b. Apache (or other web server) installed - see http://www.apache.org
c. Perl installed, this should already be installed on most Unix systems, but if it is not then see http://www.perl.com; or http://www.activestate.com for Windows users.
d. Mysql database installed:
Mysql (MySQL-Max 4.x) can be downloaded from http://www.mysql.com
After installing the software you need to set a root password:
$ mysqladmin -u root password my_password
where "my_password" should be a password you choose for your database.
- Install lbs script and setup lbs database
a. Unpack lbs.tar.gz into /cgi-bin (or if using mod_perl, the /perl directory)
$ gzip -d lbs.tar.gz
$ tar -xvf lbs.tar
b. You should create a new database within MySQL called "mobilemaps" with the following command-line:
$ mysqladmin -u root -p create mobilemaps
c. Configure database connection file, 'mobilemaps.conf'. First move into the lbs directory from the cgi-bin directory, then create a new copy of mobilemaps.conf:
$ cd lbs
$ cp mobilemaps.conf.sample mobilemaps.conf
Then edit the new mobilemaps.conf file to connect to your database - for example, use 'root' as the user, and the password you used when setting the root password in the MySQL installation phase in section 1.b above.
d. Install external Perl modules. The simplest way is to use the following script in the lbs directory, which automatically downloads and installs all the required modules from the CPAN repository (see http://www.cpan.org for more information.) It is recommended to run this script as root.
$ perl install_perl_libs.pl
If this is the first time you have used CPAN, then entering 'No' at the initial CPAN configuration prompt can be a good idea, because the defaults are usually adequate.
If this fails to work for some reason (If you are using Windows with ActiveState's Perl you should investigate the program called "ppm", and run: "ppm install dbi", "ppm install dbd-mysql", "ppm install tk") then you must install the individual modules and bundles, (available to download on http://www.cpan.org)
MIME::Base64, URI, Digest::MD5, Bundle::libnet, HTML::Parser, Bundle::LWP, Data::ShowTable, DBI, Bundle::DBD::mysql, Bundle::Tk
Enter each name separately into the search interface on cpan.org, download each file, gzip -d file.tar.gz, tar -xvf file.tar, then follow the INSTALL instructions (typically: perl Makefile.PL; make; make test; make install)
The library Bundle::DBD::mysql does not always install with the CPAN script install_perl_libs.pl, because its tests fail against a password configured MySQL database, and should be installed manually. If you have exited from the install_perl_libs.pl script, then go into your .cpan/build directory (e.g. /root/.CPAN/build/) and into the Msql-Mysql-modules-[xxxx] directory. Then run "perl Makefile.PL", follow the instructions (install MySQL DBD only, enter your real user/pass for the tests); make; make test; make install.
e. Run the install script to setup database tables
$ perl install_lbs_db.pl
f. Put mobilemaps pictures into the webserver path
$ cd /var/www/html #(or your webserver's html document directory)
$ mkdir pics
$ cp /var/www/cgi-bin/lbs/pics/* pics #(copy pics from the install directory)
g. Ensure the "lbs" script is executable. From the cgi-bin directory enter:
$ chmod 755 lbs/lbs
- Import placenames
Download the "placenames.txt.gz" file (or "placenames.zip" file for Windows) and unzip it into a temporary directory such as /tmp.
$ gzip -d /tmp/placenames.txt.gz
Start up the Mysql client, and import the placenames into the database:
$ mysql -u root -p
> load data local infile '/tmp/placenames.txt' into table placenames;
To limit the placename set to just the area you have chosen your Mobilemaps nearby engine to cover, you should find the latitude and longitude coordinates of a square box surrounding your area. Paper atlases can be surprisingly good ways of finding this information, while web map servers unfortunately rarely provide coordinates. You should have four values: North, South, West, and East for each side of the box. Now, within the mysql client, delete the placenames that are outside your box:
> delete from placenames where ((latitude < [South]) or (latitude > [North])) and ((longitude < [West]) or (longitude > [East]));
[Note: The five digit numbers at the beginning of the placenames are USA zip codes.]
- Import geocoding database
Please refer to the
Geo-data Installation document *Section 1. US Geocoding Database
for setting up a street-level US geocode database.
- Spider Web pages
a. Install Mobilemaps Spider. If this has not already been done, download the Mobilemaps Spider from http://www.mobilemaps.com/download/download.html, and follow the spider installation instructions here.
b. A convenient step is to import a "seed" file of URL's from a source such as the Open Directory Project (http://dmoz.org/). Download the file "content.rdf" (large) into the /spider directory, and then edit the script "read_odp.pl" in the /spider directory to change the variable $place='your_place_of_interest' (e.g. a US state like 'California', or a whole country like 'New Zealand'.) Run:
to generate a text file of Open Directory Project URLs that match your area. Next start up the Mysql client:
$mysql -u root -p
> use spider;
> load data infile '[root of your spider directory]/spider/your_place.txt' into table spider_url;
c. Run the Mobilemaps Spider
$ perl MMSpider.pl
Further instructions are available in the /spider/README file.
d. Export spidered data, once you are satisfied with data quantity
(i) Calculate relevance - this script operates on the spider database to perform a relevance calculation, prior to the actual export.
$ perl -w relevance.pl
(ii) Export data from spider
$ perl -w export.pl (or click on the export button in spider gui)
- Index spidered data
Move the exported data from the spider into the lbs directory, and run the indexing script.
$ mv export.txt [web root]/cgi-bin/lbs/
$ cd [web root]/cgi-bin/lbs/
$ perl -w mm_index_us.pl
As well as indexing, the exported data, the indexing script also geocodes the spidered addresses. As of 2002-10-22, Geocoding has been designed to identify USA streets only, so elsewhere in the world you will have to code your own (except note that UK postcodes are recognised by the Spider, providing a satisfactory UK solution). Sadly the geocoding data is only free, to our knowledge, in the USA, and expensive elsewhere. Gecoding databases should consist of a list of postcodes or addresses with latitude and longitude coordinates in decimal degrees. Information on setting up USA geocoding databases are in section Import geocoding database above.
- Setup mapserver
Please refer to
the Mapserver Installation document
for MapServer software and HCSLMAP script installation guidelines, and the
Geo-data Installation document *Section 2. Street Level Maps, for instructions on setting up a large US street-level data set.
- Setup sox
* World placenames & UK placenames & US Zipcodes
chmod 700 make
chmod 755 sox
chmod 755 soxinputmap
Uses data files:
* To generate your own list of placenames for sox, see details in the Sox Installation document.
- Setup configuration file
Edit the mobilemaps.conf file and change any of the path variables to suit your system. These only need to be changed if you have modified the default location of any of the scripts.
- Insert HTML to access the nearby engine
Insert the following HTML into a Web page to access your Mobilemaps nearby engine:
- Optional NearbyAds setup
If you have decided to take advantage of the Mobilemaps NearbyAds service, which is free to join and offers a high percentage of advert click revenue, follow these steps:
a. Sign-up for a portal account at the portals advertising page
You will be given an Advertising ID on sign-up.
b. To ensure that advertising clicks are credited to your account, you should add your Advertising ID to your mobilemaps.conf as follows:
And check that the advertising flag is turned on, which looks like:
You should also start the gstart-robot daemon, mm_grobot.pl, which polls the list of location adverts regularly to keep your copy of them up to date:
$ cd [web root]/cgi-bin/lbs/