This post will cover installing PhantomJS on cPanel with root access.
The documentation at http://phantomjs.org/build.html is all that is needed. I am only blogging this to let others know it did not break my cPanel server.
1. Download and install the dependencies
I already had openssl-devel, make, gcc, abd gcc-c++
[root@demos opt]# yum -y install flex bison gperf ruby freetype-devel fontconfig-devel libicu-devel sqlite-devel libpng-devel libjpeg-devel openssl-devel, make, gcc, abd gcc-c++ [root@demos opt]# service httpd start
2. Download and unzip latest source code from http://phantomjs.org/download.html
[root@demos opt]# wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.0.0-source.zip [root@demos opt]# unzip -q phantomjs-2.0.0-source.zip
3. Enter the phantomjs-2.0.0 directory and run './build';
[root@demos phantomjs-2.0.0]# ./build.sh
You will see a notice saying it will 30 minutes to several hours. It only took about 20 minutes on my server.
When build completes and you are still in the phantomjs-2.0.0 directory, you can run 'bin/phantomjs' to test and you should get a prompt.
4. Create a symlink to put phantomjs in everyone's path:
[root@demos phantomjs-2.0.0]# ln -s /opt/phantomjs-2.0.0/bin/phantomjs /usr/bin/phantomjs
As stated in the documentation at
"This produces a build bin/phantomjs. This is an executable; it can be moved to a different directory (e.g. /usr/local/bin) or another machine."
So you could just move it to /usr/bin as well.
This post will cover installing MapFig Studio on CentOS 6x64
MapFig Studio is a light-weight (12 MB), Open Source PHP application for creating, editing, managing, and deploying maps across the internet
MapFig Studio is not a GIS server like GeoServer (or MapServer, etc...), nor is it intended to be.
MapFig Studio is designed to provide users of any skill level with the ability to easily create, manage, and deploy leaflet maps on websites.
In addition to standard map deployment options of HTML, iframe, and URL, MapFig Studio also comes bundled with integrated plugins for WordPress, Drupal, Joomla, and Omeka so your maps can be easily imported, managed, and displayed in your CMS.
Before deciding if you want to install your own MapFig Studio, you may want to try it first using MapFig's Free Public Cloud Studio
The basic account is free and no credit card is required. The basic account also includes the plugins for WordPress, Drupal, and Joomla and all of the features that 99% of users will want in order to add some maps to their websites.
Here is a quick example I just made for this post (click the marker):
And below, moving from left to right, we can pop-up one marker with another, use a standard pop-up (with Google Directions), as well as modal pop-up. We've also switched our base layer to from MapQuest to Stamen Toner. You can use any map provider you wish to as well as create custom groups (the drop-down at top right of map)
OK, I'm a sysadmin, not a designer, I'm sure you can make something nicer.
I will be installing MapFig Studio on a VPS with 256 MB of RAM, but you can easily install MapFig Studio on a shared hosting or cPanel account.
MapFig Studio's resource requirements are similar to PHP application such as WordPress or Drupal.
We designed the application using SuPHP so MapFig Studio can be run on inexpensive shared hosting accounts as well as on dedicated environments.
If you prefer mod_ruid2 this can be used in place and you can skip the SuPHP section.
The only requirements for MapFig Studio are PHP 5.x, SuPHP, PostgreSQL 9, and GDAL.
MapFig does offer managed hosting, but you can get all of the same features and functionality hosting it yourself or with any provider.
In this tutorial I am going to use the CentOS 6.5 repo (and because I happen to like CentOS 6). For production, you should consider CentOS 7, which provides PHP 5.4, or installing/compiling PHP>=5.4 on your distribution.
The same procedure below can be followed on any RHEL/CentOS distribution.
Install Apache and start it. If you elected to use Webmin, you can do this via Servers > Apache Web Server
[root@demos opt]# yum install httpd httpd-tools [root@demos opt]# service httpd start
Unless you want to build from source, the PostgreSQL and EPEL repositories will be needed for PostgreSQL as well as GDAL.
[root@demos opt]# wget http://yum.pgrpms.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm [root@demos opt]# rpm -i pgdg-centos94-9.4-1.noarch.rpm [root@demos opt]# wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm [root@demos opt]# rpm -i epel-release-latest-6.noarch.rpm
A full guide to installing and configuring PostgreSQL on CentOS is available here
[root@demos opt]# yum install postgresql94 postgresql94-devel postgresql94-libs postgresql94-server postgresql94-contrib
It's also a good idea to create some symlinks to the PostgreSQL pre-9.x locations as some libs still seem to look for it there:
[root@demos opt]# ln -s /usr/pgsql-9.4/bin/pg_config /usr/bin [root@demos opt]# ln -s /var/lib/pgsql/9.4/data /var/lib/pgsql [root@demos opt]# ln -s /var/lib/pgsql/9.4/backups /var/lib/pgsql
Create the MapFig database and user who will own the database:
postgres=# create user mapfig with password 'secret'; CREATE ROLE postgres=# create database mapfig owner=mapfig;
Install GDAL using yum, this will pull in deps from the epel repo.
[root@demos opt]# yum install gdal gdal-devel gdal-libs
Add the web user (I'll call mine 'mapfig') who will own installation:
[root@demos opt]# useradd mapfig [root@demos opt]# passwd mapfig Changing password for user mapfig. New password: Retype new password: passwd: all authentication tokens updated successfully.
Install PHP via yum.
[root@demos opt]# yum install php php-devel php-pgsql
Edit your php.ini file under /etc/php.ini to enable short tags (there are some short tags in the current download, we will remove these and update when completed.)
[root@demos opt]# vi /etc/php.ini short_open_tag = On
[root@demos opt]# service httpd restart
Install SuPHP using the centoshelp.org repo (or any other method you prefer):
If you are using mod_ruid2, you can skip these sections.
[root@demos opt]# rpm -ivh http://rpm.centoshelp.org/el6/mod_suphp/mod_suphp-0.7.1-1.el6.cosh.x86_64.rpm
In /etc/suphp.conf, change:
[handlers] ;Handler for php-scripts x-httpd-php=php:/usr/bin/php-cgi ;Handler for CGI-scripts x-suphp-cgi=execute:!self
[handlers] [handlers] ;Handler for php-scripts x-httpd-php="php:/usr/bin/php-cgi" ;Handler for CGI-scripts x-suphp-cgi="execute:!self"
:+1: Thank you to Kieran O’Shea
[root@demos opt]# mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php.conf.disable
Add the following lines to your httpd.conf and bounce Apache:
DirectoryIndex index.html index.html.var index.php AddType x-httpd-php .php .php3 .php4 .php5
[root@demos opt]# service httpd restart
To keep things simple, I am going to be installing MapFig Studio into /var/www/html
Chown the installation directory (/var/www/html) to the web user you created in step 6 above.
[root@demos opt]# chown -Rf mapfig:mapfig /var/www/html
In your httpd.conf, uncomment the line below
At the bottom of your httpd.conf, add your vhost as shown below
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot /var/www/html/ ServerName maps.mydomain.com ErrorLog logs/ maps.mydomain.com-error_log CustomLog logs/ maps.mydomain.com-access_log common
AccessFileName .htaccess ### suPHP ### suPHP_Engine on suPHP_UserGroup mapfig mapfig suPHP_AddHandler x-httpd-php AddHandler x-httpd-php .php .php3 .php4 .php5 <Directory /var/www/html/> Options +Indexes FollowSymlinks AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
[root@demos opt]# service httpd restart
Start an SSH session and su to the web user your created and use wget to pull down MapFig Studio:
[root@demos opt]# su - mapfig [root@demos opt]$ cd /var/www/html [mapfig@demos html]$ wget http://cdn.mapfig.com/MapFig-Studio/MapFig-Studio.zip Saving to: MapFig-Studio.zip 100%[======================================>] 12,754,146 3.79M/s in 3.3sUnzip MapFig Studio and move contents into our doc root at /var/www/html
[mapfig@demos html]$ unzip -q MapFig-Studio.zip [mapfig@demos html]$ mv /var/www/html/MapFigStudio/* /var/www/html
Before beginning the installation process, you must manually update the mail.config.php file located in the includes directory.
If you took my advice above and installed Webmin, you will have a working Postfix mail server.
Change the MAIL_HOST, MAIL_USERNAME, and MAIL_PASSWORD below to your own mail server.
NOTE: this does not to be an account on the local mail server, it can be an email account hosted anywhere.
[mapfig@demos html]$ cd includes [mapfig@demos html]$ vi mail.config.php
<?PHP define("MAIL_SMTPAUTH", true); define("MAIL_SMTPSECURE", "tls"); define("MAIL_HOST", "mail.yourdomain.com"); define("MAIL_PORT", 587); define("MAIL_USERNAME", "email@example.com"); define("MAIL_PASSWORD", "YourPassword"); define("MAIL_FROM", "firstname.lastname@example.org"); define("MAIL_FROM_NAME", "Verify Mapfig"); define("WELCOME_EMAIL_SUBJECT", "Mapfig Studio Registration Confirmation!"); define("MAIL_TEMPLATE_DIRECTORY", dirname(__FILE__)."/../templates/emails/"); ?>
Navigate to your vhost name (or IP) and begin installing:
Install Screen 1: Have your DB information and click "Let's Go"
Install Screen 2: Enter the DB user name and password from "Step 4: Create the MapFig Database" above.
Install Screen 3: Click "Run the Install"
Install Screen 4: Enter your information in the fields provided (these can be changed later)
Install Screen 6: Activate Email is sent to the address you entered in Screen 4 above.
Install Screen 7: Click on the "Verify Account" button to verify account and you will then be able to log into MapFig Studio.
If, for any reason you forgot to do this, you will get "Email not verified" when attempting log in for the first time.
To fix this, connect to your mapfig database as postgres (or as user you created) and update the activationkey field of the users table to '' as shown below, substituting your own email for the one below:
postgres=# \c mapfig You are now connected to database "mapfig" as user "postgres". mapfig=# update users set activationkey = '' where email = 'email@example.com';
This post will cover setting Google for your namesever resolvers in CentOS.
It's a simple task, but my OnApp does not set them for my CentOS templates for some reason.
If they have not been set, the first time you will likely notice is when you go to use yum and it throws PYCURL errors.
Log in as root via SSH and issue 'vi /etc/resolv.conf' to edit your resolv.conf file:
[root@david etc]# vi /etc/resolv.conf
If, like me, you have no nameserver resolvers set, you will see something like this:
# Automatically generated by OnApp (3.0.8) domain davidghedini.com ~ ~
Hit "i" for insert and add the Google Nameservers (22.214.171.124 and 126.96.36.199) as shown below, one per line:
# Automatically generated by OnApp (3.0.8) domain davidghedini.com nameserver 188.8.131.52 nameserver 184.108.40.206
Hit Escape and then ':wq' to save your changes