Sunday, March 9, 2014

Centos6.3 Installation

=================== SET eth0 ==============
vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
BOOTPROTO=static
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="a073834f-6f1e-42c3-b371-43a580c37d73"
HWADDR=00:21:5E:73:12:50
IPADDR=192.168.1.25
NETMASK=255.255.255.0
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"

=================== START APACHE ==============
httpd

*you'll need openssl-devel

# add for cgi: LoadModule cgi_module modules/mod_cgi.so in httpd.conf

if you're using httpd 2.4.6 you'll need:

    apr and apr-util to be downloaded from http://apr.apache.org/
    and place them in apache's_installation_dir/srclib/apr and apr-util
    cp -r apr-util-1.5.2 /home/installers/apache2014/httpd-2.4.6/srclib/
    cp -r apr-1.4.8 /home/installers/apache2014/httpd-2.4.6/srclib/
   
    and include --with-included-apr in ./config   
    in apr-util-1.5.2
    ./configure --with-apr=/home/installers/apache2014/httpd-2.4.6/srclib/apr-1.4.8

    you will also need to download and install pcre using yum

    ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-deflate --enable-info --enable-mime-magic --enable-rewrite --enable-so --enable-speling --enable-ssl --with--ssl=/usr/include/openssl --enable-unique_id --enable-usertrack --with-mpm=prefork --enable-cgi [--with-included-apr]

make
make install
./apachectl start
=================== END APACHE ==============

=================== START MYSQL==============
*note on MySQL you need to install 5.5.10 and configure mapserver first. Once configured you can upgrade it to 5.6

rpm -ivh MySQL-client-xxxxxxx
rpm -ivh MySQL-devel-xxxxxxx
rpm -ivh MySQL-server-xxxxxxx
rpm -ivh Perl-xxxxxxxxxxx
rpm -ivh MySQL-shared-xxxxxxx

if you encountered error like this
file /usr/bin/msql2mysql from install of MySQL-client-5.5.10-1.linux2.6.i386 conflicts with file from package mysql-5.1.61-4.el6.i686
file /usr/bin/mysql from install of MySQL-client-5.5.10-1.linux2.6.i386 conflicts with file from package mysql-5.1.61-4.el6.i686
file /usr/bin/mysql_find_rows from install of MySQL-client-5.5.10-1.linux2.6.i386 conflicts with file from package mysql-5.1.61-4.el6.i686
file /usr/bin/mysql_waitpid from install of MySQL-client-5.5.10-1.linux2.6.i386 conflicts with file from package mysql-5.1.61-4.el6.i686

remove first the old mysql
 rpm -e mysql-devel-5.1.61-4.el6.i686
 rpm -e mysql-5.1.61-4.el6.i686


root@abscbn MySQL-5.5.10-1]# rpm -e postfix-2:2.6.6-2.2.el6_1.i686^C
[root@abscbn MySQL-5.5.10-1]# vi /etc/resolv.conf
[root@abscbn MySQL-5.5.10-1]# ping google.com
if cannot ping edit resolv.conf and add
nameserver 8.8.8.8
nameserver 8.8.4.4

[root@abscbn MySQL-5.5.10-1]# vi /etc/resolv.conf
[root@abscbn MySQL-5.5.10-1]# ping google.com
PING google.com (122.2.152.222) 56(84) bytes of data.
64 bytes from 122.2.152.222.static.pldt.net (122.2.152.222): icmp_seq=1 ttl=60 time=13.4 ms
64 bytes from 122.2.152.222.static.pldt.net (122.2.152.222): icmp_seq=2 ttl=60 time=46.4 ms
64 bytes from 122.2.152.222.static.pldt.net (122.2.152.222): icmp_seq=3 ttl=60 time=85.2 ms
64 bytes from 122.2.152.222.static.pldt.net (122.2.152.222): icmp_seq=4 ttl=60 time=18.7 ms

--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3704ms
rtt min/avg/max/mdev = 13.497/40.992/85.229/28.453 ms
[root@abscbn MySQL-5.5.10-1]# yum remove mysql-libs
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-libs.i686 0:5.1.61-4.el6 will be erased
--> Processing Dependency: libmysqlclient.so.16 for package: 2:postfix-2.6.6-2.2.el6_1.i686
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16) for package: 2:postfix-2.6.6-2.2.el6_1.i686
--> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-2.2.el6_1.i686
--> Running transaction check
---> Package postfix.i686 2:2.6.6-2.2.el6_1 will be erased
--> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-4.0-3.el6.centos.i686
--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-7.el6.i686
--> Running transaction check
---> Package cronie.i686 0:1.4.4-7.el6 will be erased
--> Processing Dependency: cronie = 1.4.4-7.el6 for package: cronie-anacron-1.4.4-7.el6.i686
---> Package redhat-lsb.i686 0:4.0-3.el6.centos will be erased
--> Running transaction check
---> Package cronie-anacron.i686 0:1.4.4-7.el6 will be erased
--> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-20.el6.i686
--> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be erased
---> Package sysstat.i686 0:9.0.4-20.el6 will be erased
--> Finished Dependency Resolution
base                                                                                                                                    | 3.7 kB     00:00
base/primary_db                                                                                                                         | 3.5 MB     00:12
extras                                                                                                                                  | 3.4 kB     00:00
extras/primary_db                                                                                                                       |  18 kB     00:00
updates                                                                                                                                 | 3.4 kB     00:00
updates/primary_db                                                                                                                      | 1.9 MB     00:06

Dependencies Resolved

===============================================================================================================================================================
 Package                          Arch                     Version                              Repository                                                Size
===============================================================================================================================================================
Removing:
 mysql-libs                       i686                     5.1.61-4.el6                         @anaconda-CentOS-201207051201.i386/6.3                   3.9 M
Removing for dependencies:
 cronie                           i686                     1.4.4-7.el6                          @anaconda-CentOS-201207051201.i386/6.3                   164 k
 cronie-anacron                   i686                     1.4.4-7.el6                          @anaconda-CentOS-201207051201.i386/6.3                    38 k
 crontabs                         noarch                   1.10-33.el6                          @anaconda-CentOS-201207051201.i386/6.3                   2.4 k
 postfix                          i686                     2:2.6.6-2.2.el6_1                    @anaconda-CentOS-201207051201.i386/6.3                   9.3 M
 redhat-lsb                       i686                     4.0-3.el6.centos                     @anaconda-CentOS-201207051201.i386/6.3                    22 k
 sysstat                          i686                     9.0.4-20.el6                         @anaconda-CentOS-201207051201.i386/6.3                   784 k

Transaction Summary
===============================================================================================================================================================
Remove        7 Package(s)

Installed size: 14 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Erasing    : redhat-lsb-4.0-3.el6.centos.i686                                                                                                            1/7
  Erasing    : sysstat-9.0.4-20.el6.i686                                                                                                                   2/7
  Erasing    : crontabs-1.10-33.el6.noarch                                                                                                                 3/7
  Erasing    : cronie-anacron-1.4.4-7.el6.i686                                                                                                             4/7
  Erasing    : cronie-1.4.4-7.el6.i686                                                                                                                     5/7
  Erasing    : 2:postfix-2.6.6-2.2.el6_1.i686                                                                                                              6/7
  Erasing    : mysql-libs-5.1.61-4.el6.i686                                                                                                                7/7
  Verifying  : 2:postfix-2.6.6-2.2.el6_1.i686                                                                                                              1/7
  Verifying  : redhat-lsb-4.0-3.el6.centos.i686                                                                                                            2/7
  Verifying  : cronie-1.4.4-7.el6.i686                                                                                                                     3/7
  Verifying  : cronie-anacron-1.4.4-7.el6.i686                                                                                                             4/7
  Verifying  : crontabs-1.10-33.el6.noarch                                                                                                                 5/7
  Verifying  : sysstat-9.0.4-20.el6.i686                                                                                                                   6/7
  Verifying  : mysql-libs-5.1.61-4.el6.i686                                                                                                                7/7

Removed:
  mysql-libs.i686 0:5.1.61-4.el6

Dependency Removed:
  cronie.i686 0:1.4.4-7.el6                 cronie-anacron.i686 0:1.4.4-7.el6        crontabs.noarch 0:1.10-33.el6        postfix.i686 2:2.6.6-2.2.el6_1
  redhat-lsb.i686 0:4.0-3.el6.centos        sysstat.i686 0:9.0.4-20.el6

Complete!

then continue on installation of MySQL

=================== END MYSQL  ==============

=================== START MAPSERVER PREREQ ==============
*libjpeg-devel-6b-46.el6.x86_64 already installed

tar -zxvf libpng-1.5.12.tar.gz
cd libpng-1.5.12
./configure
make
make install
cd ../

tar -zxvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure
make
make install
cd ../

tar -zxvf zlib-1.2.7.tar.gz
cd zlib-1.2.7
./configure
make
make install
cd ../

tar -zxvf freetype-2.4.10.tar.gz
cd freetype-2.4.10
./configure
make
make install
cd ../
==================================
tar -zxvf proj-4.8.0.tar.gz
cd proj-4.8.0
./configure
make
make install
cd ../

tar -zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure
make
make install
cd ../

tar -zxvf jpegsrc.v8d.tar.gz
cd jpeg-8d
./configure
make
make install
cd ../

tar -jxvf geos-3.3.5.tar.bz2
cd geos-3.3.5
./configure --prefix=/usr/local
make
make install
cd ../

tar -zxvf swig-2.0.8.tar.gz
cd swig-2.0.8
./configure --prefix=/usr/local
make
make install
cd ../

tar -zxvf gdal-1.9.1.tar.gz
cd gdal-1.9.1
./configure --with-jpeg --with-gd --with-freetype --with-png --with-ogr --with-proj --with-gdal --with-httpd=/usr/local/apache2 --with-tiff --with-wfs --with-wcs --with-threads --with-wmsclient --with-wfsclient --with-geos=/usr/local/bin/geos-config --with-postgis --enable-debug --with-gif --with-php-- --with-libtiff --with-static-proj4=/usr/local/bin --with-mysql
make
make install
cd ../

? install agg
=================== END MAPSERVER PREREQ ==============

=================== START PHP ==============
tar -zxvf php-5.4.7.tar.gz
cd php-5.4.7

./configure --with-gd --with-png-dir=/usr/lib --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/apache2/php --with-zlib-dir --with-pear --enable-soap --with-mysql --with-gd --enable-mbstring --with-curl --with-openssl

make
make install

Copy
    cp php.ini-development /usr/local/lib/php.ini

Edit the php.ini
    vi /usr/local/lib/php.ini
    Search
        extension_dir
    edit
        extension_dir = "/usr/local/apache2/modules/"
    Search
        include_path
    edit UNIX:
        include_path ="/usr/local/lib/php"
    Search:
        extension=msql.so
    Add
        extension=php_mysql.dll

Edit ld.so.conf
    vi /etc/ld.so.conf
    add
        /usr/local/lib
        /usr/local/include
Run
    ldconfig -v

Edit httpd.conf
    vi /usr/local/apache2/conf/httpd.conf

    Verify not comment - LoadModule php5_module modules/libphp5.so

    Add this line
        -AddType application/x-httpd-php .php
        -AddType application/x-httpd-php-source .phps
        -AddType application/x-httpd-php .phtml

Start HTTPD
/etc/init.d/httpd restart

vi /usr/local/apache2/htdocs/test.php
add this line to test php
<?php phpinfo(); ?>
=================== END PHP ==============

=================== START MAPSERVER ==============
tar -zxvf mapserver-6.2.1.tar.gz
cd mapserver-6.2.1

./configure \
--enable-debug \
--with-agg=/usr/local/agg-2.4 \
--with-curl \
--with-curl-config=/usr/bin/curl-config \
--with-freetype \
--with-gd=/usr/local/ \
--with-gdal=/usr/local/bin/gdal-config \
--with-geos=/usr/local/bin/geos-config \
--with-httpd=/usr/local/apache2/bin/httpd \
--with-jpeg \
--with-libiconv=/usr \
--with-libtiff \
--with-ogr=/usr/local/bin/gdal-config \
--with-php=/usr/local/bin/php-config \
--with-png=/usr/local \
--with-proj=/usr/local \
--with-sos \
--with-static-proj4=/usr/local/bin \
--with-threads \
--with-tiff \
--with-wcs \
--with-wfs \
--with-wfsclient \
--with-wmsclient \
--with-xml2-config=/usr/bin/xml2-config \
--with-mysql \

make

# make sure you enable cgi-bin script in apache first

check if this is not on comment LoadModule cgi_module modules/cd

***if you get 'cannot find GIF' error, install giflib-devel package then run ldconfig

cp mapserv legend scalebar shp2img shp2pdf shptree shptreetst shptreevis sortshp tile4ms /usr/local/apache2/cgi-bin/

cp mapscript/php/.libs/php_mapscript.so /usr/local/apache2/modules/
cp mapscript/php/php_mapscript.so /usr/local/apache2/modules/

vi /root/.bash_profile
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib:/usr/lib

vi httpd.conf
    setenv LD_LIBRARY_PATH /usr/local/lib

/usr/local/apache2/cgi-bin/mapserv -v
=================== END MAPSERVER ==============

! - tweak for mapserver 6.0.3

# refer to the tweak at the bottom of this file to compile with php option (https://github.com/mapserver/mapserver/commit/0d68cd5c06fa97a9d403c11e66d3ab99a16bc78d)

--------------------- START tweak to compile mapserver with php option ----------------------
from https://github.com/mapserver/mapserver/commit/0d68cd5c06fa97a9d403c11e66d3ab99a16bc78d
# in mapscript/php/image.c
/* if there is no output buffer active, set the header */
#306         
-    if (OG(ob_nesting_level)<=0)
-    {
-        php_header(TSRMLS_C);
-    }
+    //handle changes in PHP 5.4.x
+    #if PHP_VERSION_ID < 50399
+    if (OG(ob_nesting_level)<=0) {
+      php_header(TSRMLS_C);
+      }
+    #else
+    if (php_output_get_level(TSRMLS_C)<=0) {
+      php_header(TSRMLS_C);
+      }
+    #endif
   
#312(old) #317(new)
     if (MS_RENDERER_PLUGIN(php_image->image->format))
     {
         iptr = (void *)msSaveImageBuffer(php_image->image, &size, php_image->image->format);

# in mapscript/php/php_mapscript.c
#902         
-function_entry mapscript_functions[] = {
+zend_function_entry mapscript_functions[] = {
     PHP_FE(ms_GetVersion, NULL)

# in mapscript/php/php_mapscript_util.c
#44
     zend_hash_init(zobj->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-    zend_hash_copy(zobj->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+    //handle changes in PHP 5.4.x
+    #if PHP_VERSION_ID < 50399
+      zend_hash_copy(zobj->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+    #else
+      object_properties_init(zobj, ce);
+    #endif
     retval.handle = zend_objects_store_put(zobj, NULL, (zend_objects_free_object_storage_t)zend_objects_free_object, NULL TSRMLS_CC);
     retval.handlers = &mapscript_std_object_handlers;
     return retval;
#59(old) #65(new)
     ALLOC_HASHTABLE(zobj->properties);
     zend_hash_init(zobj->properties, 0, NULL, ZVAL_PTR_DTOR, 0);
-    zend_hash_copy(zobj->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
#67   
+    //handle changes in PHP 5.4.x
+    #if PHP_VERSION_ID < 50399
+      zend_hash_copy(zobj->properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
+    #else
+      object_properties_init(zobj, ce);
+    #endif
     retval.handle = zend_objects_store_put(zobj, NULL, (zend_objects_free_object_storage_t)zend_objects_free_object, NULL TSRMLS_CC);
     retval.handlers = object_handlers;
--------------------- END tweak to compile mapserver with php option ----------------------

No comments:

Post a Comment