Wednesday, March 19, 2014

update to openssh 6.2

1st Method

1.  Download the latest openssh package from http://www.openssh.org/ under /usr/local.
2.  Extract the package: # tar -xvf openssh-<version>.tar.gz
3.  Take a note of current SSH installation on the server by executing the following commands:
      # which ssh
      # rpm -qa | grep ssh
      # rpm -qf  `which ssh`
      Also take a backup of /etc/ssh folder.
4.  Go to /usr/local/openssh-<version no>/
5.  Compile the openssh package as follows:
     # ./configure --with-kerberos5 --with-pam --with-md5-passwords
6. make
7. make install
8. Check if the system is using the newly compiled openssh package by running the 'which' and 'ssh -v' command.
9. Manually link the older version of  'ssh' command to new version:
   # mv /usr/sbin/ssh /usr/sbin/ssh_old
   # ln -s /usr/local/bin/ssh /usr/sbin/ssh 


2nd Method (by overriding existing SSH config)
1.  Download the latest openssh package from http://www.openssh.org/ under /usr/local.
2.  Extract the package: # tar -xvf openssh-<version>.tar.gz
3.  Take a note of current SSH installation on the server by executing the following commands:
      # which ssh
      # rpm -qa | grep ssh
      # rpm -qf  `which ssh`
      Also take a backup of /etc/ssh folder.
4.  Go to /usr/local/openssh-<version no>/
5.  Compile the openssh package as follows:

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-ssl-dir=/opt/openssl-0.9.8e --with-pam  --with-kerberos5 --with-md5-passwords --with-tcp-wrappers

6. make
7. make install
8. Check if the system is using the newly compiled openssh package by running the 'which' and 'ssh -v' command.

Monday, March 17, 2014

install crontab on CEntos6.3

edit first repository path
vi /etc/yum.repos.d/CentOS-Base.repo (made mine like below)


[root@mapserver enad]# vi /etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

then allow the server to connect to internet to be able to make a yum install
yum install cronie*


[root@mapserver enad]# yum install cronie*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Examining cronie-1.4.4-12.el6.i686.rpm: cronie-1.4.4-12.el6.i686
Marking cronie-1.4.4-12.el6.i686.rpm to be installed
Examining cronie-anacron-1.4.4-12.el6.i686.rpm: cronie-anacron-1.4.4-12.el6.i686
Marking cronie-anacron-1.4.4-12.el6.i686.rpm to be installed
Examining cronie-noanacron-1.4.4-12.el6.x86_64.rpm: cronie-noanacron-1.4.4-12.el6.x86_64
Cannot add package cronie-noanacron-1.4.4-12.el6.x86_64.rpm to transaction. Not a compatible architecture: x86_64
Resolving Dependencies
--> Running transaction check
---> Package cronie.i686 0:1.4.4-12.el6 will be installed
---> Package cronie-anacron.i686 0:1.4.4-12.el6 will be installed
--> Processing Dependency: crontabs for package: cronie-anacron-1.4.4-12.el6.i686
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================
 Package                                 Arch                            Version                                Repository                                                  Size
=================================================================================================================================================================================
Installing:
 cronie                                  i686                            1.4.4-12.el6                           /cronie-1.4.4-12.el6.i686                                  165 k
 cronie-anacron                          i686                            1.4.4-12.el6                           /cronie-anacron-1.4.4-12.el6.i686                           38 k
Installing for dependencies:
 crontabs                                noarch                          1.10-33.el6                            base                                                        10 k

Transaction Summary
=================================================================================================================================================================================
Install       3 Package(s)

Total size: 213 k
Total download size: 10 k
Installed size: 205 k
Is this ok [y/N]: y
Downloading Packages:
crontabs-1.10-33.el6.noarch.rpm                                                                                                                           |  727 B     00:00 ...
http://mirror.centos.org/centos/6/os/i386/Packages/crontabs-1.10-33.el6.noarch.rpm: [Errno -1] Package does not match intended download. Suggestion: run yum --enablerepo=base clean metadata
Trying other mirror.


Error Downloading Packages:
  crontabs-1.10-33.el6.noarch: failure: Packages/crontabs-1.10-33.el6.noarch.rpm from base: [Errno 256] No more mirrors to try.
 

if you will encounter an error like this just clean the metadata 
yum --enablerepo=base clean metadata

[root@mapserver enad]# yum --enablerepo=base clean metadata
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Cleaning repos: base extras updates
10 metadata files removed
3 sqlite files removed
0 metadata files removed


then yum install cronie* (make sure you have asterisk (*) so all libraries for crontab will be installed

[root@mapserver enad]# yum install cronie*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
base                                                                                                                                                      | 3.7 kB     00:00
base/primary_db                                                                                                                                           | 3.5 MB     00:10
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:05
Setting up Install Process
Examining cronie-1.4.4-12.el6.i686.rpm: cronie-1.4.4-12.el6.i686
Marking cronie-1.4.4-12.el6.i686.rpm to be installed
Examining cronie-anacron-1.4.4-12.el6.i686.rpm: cronie-anacron-1.4.4-12.el6.i686
Marking cronie-anacron-1.4.4-12.el6.i686.rpm to be installed
Examining cronie-noanacron-1.4.4-12.el6.x86_64.rpm: cronie-noanacron-1.4.4-12.el6.x86_64
Cannot add package cronie-noanacron-1.4.4-12.el6.x86_64.rpm to transaction. Not a compatible architecture: x86_64
Resolving Dependencies
--> Running transaction check
---> Package cronie.i686 0:1.4.4-12.el6 will be installed
---> Package cronie-anacron.i686 0:1.4.4-12.el6 will be installed
--> Processing Dependency: crontabs for package: cronie-anacron-1.4.4-12.el6.i686
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================
 Package                                 Arch                            Version                                Repository                                                  Size
=================================================================================================================================================================================
Installing:
 cronie                                  i686                            1.4.4-12.el6                           /cronie-1.4.4-12.el6.i686                                  165 k
 cronie-anacron                          i686                            1.4.4-12.el6                           /cronie-anacron-1.4.4-12.el6.i686                           38 k
Installing for dependencies:
 crontabs                                noarch                          1.10-33.el6                            base                                                        10 k

Transaction Summary
=================================================================================================================================================================================
Install       3 Package(s)

Total size: 213 k
Total download size: 10 k
Installed size: 205 k
Is this ok [y/N]: y
Downloading Packages:
crontabs-1.10-33.el6.noarch.rpm                                                                                                                           |  10 kB     00:00
http://mirror.centos.org/centos/6/os/i386/Packages/crontabs-1.10-33.el6.noarch.rpm: [Errno -1] Package does not match intended download. Suggestion: run yum --enablerepo=base clean metadata
Trying other mirror.


Error Downloading Packages:
  crontabs-1.10-33.el6.noarch: failure: Packages/crontabs-1.10-33.el6.noarch.rpm from base: [Errno 256] No more mirrors to try.

[root@mapserver enad]# vi /etc/yum.repos.d/CentOS-Base.repo
[root@mapserver enad]# yum --enablerepo=base clean metadata
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos-hn.viettelidc.com.vn
 * extras: centos-hcm.viettelidc.com.vn
 * updates: ossm.utm.my
Cleaning repos: base extras updates
9 metadata files removed
3 sqlite files removed
0 metadata files removed
[root@mapserver enad]# yum install cronie*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos-hn.viettelidc.com.vn
 * extras: centos-hcm.viettelidc.com.vn
 * updates: ossm.utm.my
base                                                                                                                                                      | 3.7 kB     00:00
base/primary_db                                                                                                                                           | 3.5 MB     00:12
extras                                                                                                                                                    |  727 B     00:00 ...
http://centos-hcm.viettelidc.com.vn/6.5/extras/i386/repodata/repomd.xml: [Errno -1] Error importing repomd.xml for extras: Damaged repomd.xml file
Trying other mirror.
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:12
Setting up Install Process
Examining cronie-1.4.4-12.el6.i686.rpm: cronie-1.4.4-12.el6.i686
Marking cronie-1.4.4-12.el6.i686.rpm to be installed
Examining cronie-anacron-1.4.4-12.el6.i686.rpm: cronie-anacron-1.4.4-12.el6.i686
Marking cronie-anacron-1.4.4-12.el6.i686.rpm to be installed
Examining cronie-noanacron-1.4.4-12.el6.x86_64.rpm: cronie-noanacron-1.4.4-12.el6.x86_64
Cannot add package cronie-noanacron-1.4.4-12.el6.x86_64.rpm to transaction. Not a compatible architecture: x86_64
Resolving Dependencies
--> Running transaction check
---> Package cronie.i686 0:1.4.4-12.el6 will be installed
---> Package cronie-anacron.i686 0:1.4.4-12.el6 will be installed
--> Processing Dependency: crontabs for package: cronie-anacron-1.4.4-12.el6.i686
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================
 Package                                 Arch                            Version                                Repository                                                  Size
=================================================================================================================================================================================
Installing:
 cronie                                  i686                            1.4.4-12.el6                           /cronie-1.4.4-12.el6.i686                                  165 k
 cronie-anacron                          i686                            1.4.4-12.el6                           /cronie-anacron-1.4.4-12.el6.i686                           38 k
Installing for dependencies:
 crontabs                                noarch                          1.10-33.el6                            base                                                        10 k

Transaction Summary
=================================================================================================================================================================================
Install       3 Package(s)

Total size: 213 k
Total download size: 10 k
Installed size: 205 k
Is this ok [y/N]: y
Downloading Packages:
crontabs-1.10-33.el6.noarch.rpm                                                                                                                           |  10 kB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : crontabs-1.10-33.el6.noarch                                                                                                                                   1/3
  Installing : cronie-1.4.4-12.el6.i686                                                                                                                                      2/3
  Installing : cronie-anacron-1.4.4-12.el6.i686                                                                                                                              3/3
  Verifying  : cronie-anacron-1.4.4-12.el6.i686                                                                                                                              1/3
  Verifying  : cronie-1.4.4-12.el6.i686                                                                                                                                      2/3
  Verifying  : crontabs-1.10-33.el6.noarch                                                                                                                                   3/3

Installed:
  cronie.i686 0:1.4.4-12.el6                                                          cronie-anacron.i686 0:1.4.4-12.el6

Dependency Installed:
  crontabs.noarch 0:1.10-33.el6

Complete!

installation using yum complete



manual installation if no internet connection: 
*must have these files
 

  Installing : procmail-3.22-25.1.el6.i686
  Installing : sendmail-8.14.4-8.el6.i686
  Installing : crontabs-1.10-33.el6.noarch
  Installing : cronie-1.4.4-12.el6.i686
  Installing : cronie-anacron-1.4.4-12.el6.i686

  Installing : cronie-noanacron-1.4.4-12.el6.i686
  Verifying  : cronie-anacron-1.4.4-12.el6.i686
  Verifying  : cronie-1.4.4-12.el6.i686
  Verifying  : crontabs-1.10-33.el6.noarch
  Verifying  : procmail-3.22-25.1.el6.i686
  Verifying  : cronie-noanacron-1.4.4-12.el6.i686
  Verifying  : sendmail-8.14.4-8.el6.i686

Thursday, March 13, 2014

apache with openssl setup

configure apache to have an openssl
make a directory for ssl (i made mine in /home)

to create server.key     - openssl genrsa -out server.key 1024
to create server.csr    - openssl req -new -key server.key -out server.csr
to create server.crt    - openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

[root@gems2 httpd-2.0.55]# cd /home/ssl

[root@gems2 ssl]# openssl genrsa -out server.key 1024
Generating RSA private key, 1024 bit long modulus
................................................++++++
.......................++++++
e is 65537 (0x10001)

[root@gems2 ssl]# openssl req -new -key server.key -out server.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [GB]:PH
State or Province Name (full name) [Berkshire]:Manila
Locality Name (eg, city) [Newbury]:Manila
Organization Name (eg, company) [My Company Ltd]:CIGI
Organizational Unit Name (eg, section) []:sysad
Common Name (eg, your name or your server's hostname) []:egems2
Email Address []:enadz36@yahoo.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
[root@gems2 ssl]# ls
server.csr  server.key
[root@gems2 ssl]# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Signature ok
subject=/C=PH/ST=Manila/L=Manila/O=CIGI/OU=sysad/CN=egems2/emailAddress=enadz36@      yahoo.com
Getting Private key
[root@gems2 ssl]# ls
server.crt  server.csr  server.key

move it to specified folder
[root@gems2 ssl]# cp -r server.* /usr/local/apache2/conf/
cp: overwrite `/usr/local/apache2/conf/server.crt'? y
cp: overwrite `/usr/local/apache2/conf/server.csr'? y
cp: overwrite `/usr/local/apache2/conf/server.key'? y

stop start httpd-SSL
[root@gems2 ssl]# /etc/init.d/httpd stop
[root@gems2 ssl]# /etc/init.d/httpd start-SSL


modify your httpd.conf file to add ssl key and certificate
    <VirtualHost 127.0.0.1:443>
        SSLEngine on
        SSLCertificateFile /usr/local/apache2/conf/server.crt
        SSLCertificateKeyFile /usr/local/apache2/conf/server.key
    </VirtualHost>



as per linus (http://linusramos.blogspot.com/2011/08/apache-ssl-setup.html)

apache: ssl setup


1. configure your apache with ssl
    # ./configure --prefix=/usr/local/apache2 --enable-rewrite --enable-ssl --with-ssl=/usr/include/openssl

2. create a sign key without pass phrase *
    # openssl genrsa -out server.key 1024
    or if with pass phrase
    # openssl genrsa -des3 -out server.key 1024

3. create a certificate request. use this when you purchase your certificate. (or do no. 4 for self signed certificate)
    # openssl req -new -key server.key -out server.csr
    (leave the challenge password blank)

4. create a self signed certificate
    # openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

5. modify your httpd.conf file to add ssl key and cetrificate
    <VirtualHost 127.0.0.1:443>
        SSLEngine on
        SSLCertificateFile /usr/local/apache2/conf/server.crt
        SSLCertificateKeyFile /usr/local/apache2/conf/server.key
    </VirtualHost>

6. place your ssl key and certificate files into the directory paths you supplied in your httpd.conf (above)

7. start apache with ssl
    # /etc/init.d/httpd startssl

* you should NOT generate the RSA private key with a pass phrase if you have scripts that restart apache with ssl automatically, else, it will require you to enter the pass phrase before it starts apache with ssl

8. edit apache startup script to launch with ssl
    include DSSL in start start script /etc/init.d/httpd
    $HTTPD -k $ARGV -DSSL

9. allow ssl port through your firewall. if you're using iptables, add this
    -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT

to verify the contents of the certificate request, use the this comand:
# openssl req -noout -text -in server.csr

to view the contents of the private key, use the command below:
# openssl rsa -noout -text -in server.key

to use SSLv3 instead of TLSv3, add this in ssl.conf:
SSSLProtocol -all +SSLv3 +TLSv1
SSLCipherSuite SSLv3:+HIGH:+MEDIUM


to test ssl connection
# openssl s_client -connect localhost:443

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 ----------------------