Senin, 08 Maret 2010

How To Install HTTPD PHP and MySQL OpenSUSE 11.1 x86_64

In This Tutorial, We will start to install and configure Apache Webserver, PHP and Mysql from Source / tar.gz in O/S OpenSUSE 11.1 x86_64 bit O/s
If you are searching how to install apache php and mysql for linux o/s 32bit, please click HERE

So I assume you already have OpenSUSE11 installed, up and running.
This tutorial also can be implemented in other O/S such as : Centos and Fedora or other 64bit Linux O/S.

Login into your server with root access.

Download and Extract All Packages and Dependencies

$cd /root
$vi files.sh
#!/bin/bash
# download and extract all packages and dependencies

cd /root
wget http://mirror.csclub.uwaterloo.ca/mysql/Downloads/MySQL-5.1/mysql-5.1.44...
wget http://www.alliedquotes.com/mirrors/apache/httpd/httpd-2.2.14.tar.gz
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
wget http://www.ijg.org/files/jpegsrc.v8a.tar.gz
wget http://curl.haxx.se/download/curl-7.20.0.tar.gz
wget http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.3.12.tar.gz
wget http://mirror.unej.ac.id/cpan/authors/id/T/TI/TIMB/DBI-1.609.tar.gz
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.43.tar.gz
wget http://openssl.org/source/openssl-0.9.7g.tar.gz
wget http://www.zlib.net/zlib-1.2.3.tar.gz
wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
wget http://www.php.net/distributions/php-5.3.1.tar.gz
wget ftp://ftp.cac.washington.edu/imap/imap-2007b.tar.Z

echo "Extracting All Packages "

tar -zxvf mysql-5.1.44.tar.gz
tar -zxvf httpd-2.2.14.tar.gz
tar -zxvf libxml2-2.7.6.tar.gz
tar -zxvf jpegsrc.v8a.tar.gz
tar -zxvf curl-7.20.0.tar.gz
tar -zxvf freetype-2.3.12.tar.gz
tar -zxvf DBI-1.609.tar.gz
tar -zxvf libpng-1.2.43.tar.gz
tar -zxvf openssl-0.9.7g.tar.gz
tar -zxvf zlib-1.2.3.tar.gz
tar -zxvf gd-2.0.35.tar.gz
tar -zxvf php-5.3.1.tar.gz
tar -zxvf imap-2007b.tar.Z

Chmod and Execute files.sh

$cd /root
$chmod 755 files.sh
$./files.sh

Install C compiler and Dependencies

$yast -i gcc gcc-c++ ncurses-devel pam-devel automake

Note : you can use yum, apt-get or etc to install c compiler.

Create MySQL user and Compiling MySQL Server

Create user and group mysql with yast

$yast
>> Security and Users >> User and Group Management
>> In Users Section >> Press tab to ADD a new user
>>> Input User Full Name "mysql", Username "mysql", Password and Confirm Password >> OK
>> In Group section >> Press tab to ADD a Group
>>> Input Group Name "mysql" >> OK
>> In users Section >> Edit user "mysql"
>>> In Existing Local User Choose Details Section
>>> Login Shell Change it to "/bin/false"
>>> Default Group Change it to "mysql" >> OK >> OK
>> press f9 to quit yast

Compiling MySQL Server

$cd /root
$cd mysql-5.1.37
$./configure --prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/var \
--with-pthread --with-big-tables
$make && make install

Change mysql dir permission

$chown -R mysql.mysql /usr/local/mysql

Copy mysql cnf files from this directory below to /etc/
and change the file to my.cnf

$cd /usr/local/mysql/share/mysql
$cp my-small.cnf /etc/my.cnf

Install mysql DB

$/usr/local/mysql/bin/mysql_install_db --user=mysql

Starting mysql server

$/usr/local/mysql/bin/mysqld_safe --user=mysql &

Create mysql root password

$/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

Compiling OpenSSL 0.9.7g

$cd /root/
$cd openssl-0.9.7g
$./config -fPIC
$make depend
$make install

Add /usr/local/include into ld.so.conf

$vi /etc/ld.so.conf
## add this line below ##
/usr/local/include

Reload ld.so.conf

$ldconfig

Compiling Apache/ HTTPD Web Server

$cd /root
$cd httpd-2.2.14
$./configure --prefix=/usr/local/apache2 \
--enable-so --enable-mods-shared=most \
--enable-ssl=static --with-ssl=/usr/local/ssl
$make && make install

Compiling Zlib, FreeType, GD, LibXML2,LIBJPEG, LIBPNG, CURL, DBI

$cd /root
$cd zlib-1.2.3
$./configure --shared && make && make install

$cd ..
$cd freetype-2.3.12
$./configure && make && make install

$cd ..
$cd jpeg-8a
$./configure --prefix=/usr/local --enable-shared
$make && make install

$cd ..
$cd libpng-1.2.43
$./configure && make && make install

$cd ..
$cd curl-7.20.0
$/configure && make && make install

$cd ..
$cd libxml2-2.7.6
$./configure && make && make install

$cd ..
$cd gd-2.0.35
$./configure --with-freetype=/usr/local \
--with-jpeg=/usr/local/lib \
--with-png=/usr/local/lib
$aclocal
$make && make install

$cd ..
$cd DBI-1.609
$perl Makefile.PL
$make && make install

$cd /root
$mv imap-2007b /usr/local/
$cd /usr/local/imap-2007b
$make lnp EXTRACFLAGS="-fPIC"
$mkdir include lib
$cp src/c-client/*.h include/
$cp c-client/c-client.a lib/libc-client.a
$cp c-client/osdep.h include/
$cp c-client/env_unix.h include/
$cp c-client/linkage.h include/

Compiling PHP

$cd /root
$cd php-5.3.1
$ ./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-gd=/usr/local \
--with-jpeg-dir=/usr/local/lib \
--with-zlib-dir=/usr/local \
--enable-ftp \
--with-png-dir=/usr/local/lib \
--with-freetype-dir=/usr/local \
--with-curl=/usr/local \
--with-imap=/usr/local/imap-2007b \
--with-imap-ssl=/usr/local/ssl \
--enable-mbstring
$make && make install

Copy php.ini

$cp php.ini-production /usr/local/lib/php.ini

Configure httpd.conf to support PHP

$cd /usr/local/apache2/conf/
$pico httpd.conf

### make sure this line below is already there
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php

Starting Up Apache and MySQL Webserver

$/usr/local/mysql/bin/mysqld_safe --user=mysql &
$/usr/local/apache2/bin/apachectl start

Added Apache and MySQL in Boot.local Init Script

$vi /etc/init.d/boot.local
### Add this line below into boot.local ###
/usr/local/apache2/bin/apachectl start
/usr/local/mysql/bin/mysqld_safe --user=mysql &

Create a test.php with phpinfo in file

$cd /usr/local/apache2/htdocs
$pico test.php


## save this file

$vim /usr/local/lib/php.ini (edit short_open_tag menjadi on)



Or We also can check php result from console

$php -v
PHP 5.3.1 (cli) (built: Mar 3 2010 10:07:54)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies

Open a test.php from your Browser

You can try to access test.php from your browser
Example your server ip address is 10.10.10.10

Http://10.10.10.10/test.php

Tidak ada komentar: