Install dan Configure WebServer

09Jan09

dah lama gk nulis neh,, sekarang mau naro catetan aja neh,,, gk pake basa basi deh pokoknya full catetan doank :D

****************************************************************************************************
************************* INSTALLASI APACHE – PHP ******************************
****************************************************************************************************

========================================================================

* INSTALLASI OS WAJIB MENYERTAKAN: *
[TIDAK PERLU CUSTOMIZE KE DALAMNYA… CUKUP CENTANG DIPAKET]

1) WEB SERVER
2) MYSQL SERVER
3) MAIL SERVER
3) DEVELOPMENT (KECUALI KDE & GNOME DEVELOPMENT)
4) COMPATIBILITY

========================================================================

INSTALL ORACLE-INSTANTCLIENT
* MINIMAL ORACLE-INSTANTCLIENT-BASIC & ORACLE-INSTANTCLIENT-DEVEL *

using – 32 bit
——————-
rpm -ivh oracle-instantclient-basic-10.2.0.4-1.i386.rpm \
oracle-instantclient-devel-10.2.0.4-1.i386.rpm \
oracle-instantclient-jdbc-10.2.0.4-1.i386.rpm \
oracle-instantclient-odbc-10.2.0.4-1.i386.rpm \
oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm

using – 64 bit
——————-
rpm -ivh oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm \
oracle-instantclient-devel-10.2.0.4-1.x86_64.rpm \
oracle-instantclient-jdbc-10.2.0.4-1.x86_64.rpm \
oracle-instantclient-odbc-10.2.0.4-1.x86_64.rpm \
oracle-instantclient-sqlplus-10.2.0.4-1.x86_64.rpm

========================================================================

INSTALL LIBRARY

using – 32 bit
——————-
rpm -ivh libjpeg-6b-33.i386.rpm libjpeg-devel-6b-34.i386.rpm \
libpng-1.2.8-2.i386.rpm libpng-devel-1.2.8-2.i386.rpm \
libc-client-2002e-14.i386.rpm libc-client-devel-2002e-14.i386.rpm

using – 64 bit
——————-
rpm -ivh libjpeg-6b-33.x86_64.rpm libjpeg-devel-6b-34.x86_64.rpm \
libjpeg-devel-6b-34.x86_64.rpm libpng-devel-1.2.8-2.x86_64.rpm \
libc-client-2002e-14.x86_64.rpm libc-client-devel-2002e-14.x86_64.rpm

========================================================================

INSTALL MCRYPT

using – 32 bit
——————-
rpm -ivh libmcrypt-2.5.7-4.el4.centos.i386.rpm libmcrypt-devel-2.5.7-4.el4.centos.i386.rpm

using – 64 bit
——————-
rpm -ivh libmcrypt-2.5.7-4.el4.centos.x86_64.rpm libmcrypt-devel-2.5.7-4.el4.centos.x86_64.rpm

========================================================================

INSTALL MHASH

using – 32 bit
——————-
rpm -ivh mhash-0.9.2-4.i386.rpm mhash-devel-0.9.2-4.i386.rpm

using – 64 bit
——————-
rpm -ivh mhash-0.9.2-4.x86_64.rpm mhash-devel-0.9.2-4.x86_64.rpm

========================================================================

INSTALL FREETDS [OPTIONAL]

using – 32 bit
——————-
1) gunzip freetds-stable.tgz

2) tar xvf freetds-stable.tar

3) cd freetds-stable

4) mkdir /usr/local/freetds

5) ./configure –prefix=/usr/local/freetds

6) make && make install

7) cp [$TDS_SOURCE]/src/tds/.libs/libtds.a /usr/local/freetds/lib

8) cp [$TDS_SOURCE]/include/tds.h /usr/local/freetds/include/

9) nano /usr/local/freetds/etc/freetds.conf

10) uncomment dibaris “tds version = 4.2”

using – 64 bit
——————-
SAMA DENGAN = 32 BIT … DITAMBAH:

11) mkdir /usr/local/freetds/lib64

12) cp -R /usr/local/freetds/lib/* /usr/local/freetds/lib64/

========================================================================

APACHE version 2.2.10

1) install di direktori = /usr/local/apache2

2) sebagai root, jalankan:
using – 32 bit
——————-
./configure –prefix=/usr/local/apache2 –enable-FEATURE=yes –enable-ssl \
–enable-so –enable-rewrite –enable-setenvif -enable-nonportable-atomics=yes

using – 64 bit
——————-
./configure –prefix=/usr/local/apache2 –libdir=/usr/lib64 –enable-FEATURE=yes \
–enable-ssl –enable-so –enable-rewrite –enable-setenvif \
–enable-nonportable-atomics=yes

3) sebagai root, jalankan:
make && make install

4) cek dengan:
/usr/local/apache2/bin/apachectl -V

REFERENCE:
http://www.codeassembly.com/Upgrade-to-apache-2.2.6-without-downtime/
http://httpd.apache.org/docs/2.2/misc/perf-tuning.html

========================================================================

PHP version 5.2.6 or 5.2.8

1)install di direktori = /usr/local

2) sebagai root, jalankan:
using – 32 bit
——————-
./configure –prefix=/usr/local –exec-prefix=/usr/lib –with-config-file-path=/etc \
–with-apxs2=/usr/local/apache2/bin/apxs –enable-force-cgi-redirect –enable-fastcgi \
–enable-inline-optimization –enable-bcmath –enable-calendar –enable-ctype \
–enable-discard-path –enable-exif –enable-magic-quotes –enable-dom –enable-libxml \
–with-openssl –with-pcre-regex –enable-session –enable-simplexml –enable-spl \
–enable-wddx –enable-xml –enable-hash –enable-reflection –with-pear –enable-json \
–enable-filter –with-curl –enable-mbregex –with-zlib-dir –with-zlib –with-mcrypt \
–with-jpeg-dir –with-png-dir –with-xpm-dir –with-ttf –with-freetype-dir –with-gd \
–enable-gd-native-ttf –with-gettext –with-gmp –with-layout=GNU –with-oci8=instantclient \
–enable-sigchild –with-mysql –with-mysqli –enable-mbstring –with-mssql=/usr/local/freetds \
–with-kerberos –with-imap-dir –with-imap –with-imap-ssl –with-ldap –with-mhash \
–with-mime-magic –enable-pdo=shared –with-pdo-sqlite=shared –with-sqlite=shared \
–enable-soap –enable-zip

using – 64 bit
——————-
./configure –prefix=/usr/local –with-libdir=lib64 –exec-prefix=/usr/lib64 –with-config-file-path=/etc \
–with-apxs2=/usr/local/apache2/bin/apxs –enable-force-cgi-redirect –enable-fastcgi \
–enable-inline-optimization –enable-bcmath –enable-calendar –enable-ctype \
–enable-discard-path –enable-exif –enable-magic-quotes –enable-dom –enable-libxml \
–with-openssl –with-pcre-regex –enable-session –enable-simplexml –enable-spl \
–enable-wddx –enable-xml –enable-hash –enable-reflection –with-pear –enable-json \
–enable-filter –with-curl –enable-mbregex –with-zlib-dir –with-zlib –with-mcrypt \
–with-jpeg-dir –with-png-dir –with-xpm-dir –with-ttf –with-freetype-dir –with-gd \
–enable-gd-native-ttf –with-gettext –with-gmp –with-layout=GNU –with-oci8=instantclient \
–enable-sigchild –with-mysql –with-mysqli –enable-mbstring –with-mssql=/usr/local/freetds \
–with-kerberos –with-imap-dir –with-imap –with-imap-ssl –with-ldap –with-mhash \
–with-mime-magic –enable-pdo=shared –with-pdo-sqlite=shared –with-sqlite=shared \
–enable-soap –enable-zip

3) sebagai root, jalankan:
make && make install

========================================================================

CREATE USER – GROUP, SETTING PERMISSI0N & CONFIGURE

1) groupadd -g 600 htdocs

2) useradd -u 600 -g htdocs htdocs

3) useradd -u 601 -g htdocs etiket

4) passwd htdocs

5) passwd etiket

6) mkdir /usr/local/lib/php/session

7) chown -R etiket:htdocs /usr/local/apache2/htdocs

8) chown -R etiket:htdocs /usr/local/lib/php/session

9) chmod 770 /usr/local/lib/php/session

10) Copy file httpd.conf DARI PAKET INSTALL ke /usr/local/apache2/conf/
[PASTIKAN DI httpd.conf:]
User = etiket
Group = htdocs

11) Copy file php.ini DARI PAKET INSTALL ke /etc

12) mkdir /usr/local/apache2/logs/old

13) chkconfig iptables off

14) chkconfig sendmail on

15) chkconfig httpd off

FOR USING SSL WITH PASSPHRASE

16) CREATE FILE /usr/local/apache2/conf/passphrase ISINYA:
#!/bin/sh
echo “passphrase”
–> GANTI passphrase DENGAN ISI YANG BENAR

17) chown +x /usr/local/apache2/conf/passphrase

18) EDIT extra/httpd-ssl.conf
UBAH
SSLPassPhraseDialog builtin

MENJADI:
#SSLPassPhraseDialog builtin
SSLPassPhraseDialog exec:/usr/local/apache2/conf/passphrase

19) EDIT httpd.conf ; TAMBAHKAN DI PALING BAWAH: [OPTIONAL]

RewriteEngine on
RewriteRule ^/(.*):SSL$ https://%{SERVER_NAME}/$1 [R,L]
RewriteRule ^/(.*):NOSSL$ http://%{SERVER_NAME}/$1 [R,L]

20) /usr/local/apache2/bin/apachectl restart

21) REBOOT MACHINE

22) TEST WITH WEB BROWSER –> MUST BE SHOWN THE HTML PAGE
========================================================================

EDIT STARTUP & LOGROTATE SCRIPT
[HANYA JIKA INSTALLASI OS MENGINSTALL WEB SERVER]

1) EDIT FILE /etc/init.d/httpd … PADA BAGIAN:
A>>
ASLI :
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0

MENJADI:
# Path to the apachectl script, server binary, and short-form for messages.
# — ORIGINAL — #
#apachectl=/usr/sbin/apachectl
#httpd=${HTTPD-/usr/sbin/httpd}
#prog=httpd
#pidfile=${PIDFILE-/var/run/httpd.pid}
#lockfile=${LOCKFILE-/var/lock/subsys/httpd}
#RETVAL=0

# — EDIT-AN — #
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/usr/local/apache2/logs/httpd.pid}
lockfile=${LOCKFILE-/usr/local/apache2/logs/httpd}
RETVAL=0

B>>
ASLI:
start() {
echo -n $”Starting $prog: ”
check13 || exit 1
LANG=$HTTPD_LANG daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}

MENJADI:
start() {
echo -n $”Starting $prog: ”
#check13 || exit 1
LANG=$HTTPD_LANG daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}

2) service httpd start

3) PASTIKAN SERVICE YANG JALAN YANG DI APACHE2
/usr/local/apache2/bin/apachectl status

4) chkconfig httpd on

————————————————–

EDIT FILE /etc/logrotate.d/httpd
ASLI:
/var/log/httpd/*log {
missingok
notifempty
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}

MENJADI:
/usr/local/apache2/logs/*log {
missingok
monthly
rotate 3
olddir /usr/local/apache2/logs/old
sharedscripts
postrotate
# /bin/kill -HUP `cat /usr/local/apache2/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}

#/var/log/httpd/*log {
# missingok
# notifempty
# sharedscripts
# postrotate
# /sbin/service httpd reload > /dev/null 2>/dev/null || true
# endscript
#}

========================================================================

INSTALL EACCELERATOR [OPTIONAL]

1) tar -jxvf eaccelerator-0.9.5.3.tar.bz2

2) GO TO [$EACCELERATOR_SOURCE]

3) export PHP_PREFIX=”/usr/lib64″

4) $PHP_PREFIX/bin/phpize

5) ./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config

6) make && make install

7) mkdir /var/cache/eaccelerator

8) chown htdocs.htdocs /var/cache/eaccelerator

9) EDIT /etc/php.ini …
UN-COMMENT (buang tanda ;) PADA BAGIAN INI, SUPAYA MENJADI:
extension=”eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/var/cache/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

========================================================================

TESTING APACHE + PHP (64 bit) + FINISHING

1) vi /usr/local/apache2/htdocs/info.php
[di dalam info.php isikan syntax php untuk menampilkan versi php, pasti udah tau kan :D (coz saya tulis syntax phpnya gk bisa tampil neh di wordpress)
Tes di web browser page itu, misal di vnc server itu http://localhost/info.php
JIKA TIDAK BISA, COBA CEK USER & GROUP PADA httpd.conf TELAH ADA

2) COPY ISI FILE /etc/hosts DARI SERVER LAMA KE SERVER BARU
DAN EDIT JIKA PERLU

3) EDIT /etc/resolv.conf
PASTIKAN BISA AKSES KE INTERNET

4) SINKRONISASI TIME SERVER [SERVER HARUS BISA KONEK KE INTERNET]
a. ntpd -d
–> (proses bisa d cek di /var/log/messages)
–> akan keluar output seperti … +… sec

b. chkconfig ntpd on

5) REBOOT MACHINE

========================================================================

INSTAL PHPMYADMIN
—————————————–

1) extract file phpMyAdmin
tar -xzvf phpMyAdmin-3.0.1.1-all-languages.tar.gz -C /usr/local/apache2/htdocs/

2) rename folder hasil extract phpmyadmin
mv /usr/local/apache2/htdocs/phpMyAdmin-3.0.1.1-all-languages /usr/local/apache2/htdocs/phpmyadmin

3) copy file config.sample.inc.php menjadi config.inc.php
cp /usr/local/apache2/htdocs/phpmyadmin/config.sample.inc.php /usr/local/apache2/htdocs/phpmyadmin/config.inc.php

4) edit file config.inc.php
nano /usr/local/apache2/htdocs/phpmyadmin/config.inc.php

5) cari bagian ini $cfg[‘blowfish_secret’] = ”; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
kemudian isikan blowfish_secretnya dengan huruf atau angka, misalnya $cfg[‘blowfish_secret’] = ‘anukuanumujuga69’;

6) tes phpmyadmin di browser, misal melalui vnc server di mozilla ketikan –> http://localhost/phpmyadmin
atau bisa melalui console dengan links http://localhost/phpmyadmin

========================================================================

GENERATE SSL KEY [OPTIONAL]
——————————————————————–
openssl req -new -x509 -days 365 -sha1 -newkey rsa:1024 \
-nodes -keyout server.key -out server.crt \
-subj ‘/O=adi-setio/OU=IT/CN=adi-setio.cc.cc’

========================================================================
****************************************************************************************************
************************* — END OF FILE — *************************
****************************************************************************************************

========================================================================
***** FOR TESTING PURPOSE ONLY *****

./configure –prefix=/usr/local –exec-prefix=/usr/lib –with-config-file-path=/etc \
–with-apxs2=/usr/local/apache2/bin/apxs –enable-force-cgi-redirect –enable-fastcgi \
–enable-inline-optimization –enable-bcmath –enable-calendar –enable-ctype \
–enable-discard-path –enable-exif –enable-magic-quotes –enable-dom –enable-libxml \
–with-openssl –with-pcre-regex –enable-session –enable-simplexml –enable-spl \
–enable-wddx –enable-xml –enable-hash –enable-reflection –with-pear –enable-json \
–enable-filter –with-curl –enable-mbregex –with-zlib-dir –with-zlib –with-mcrypt \
–with-jpeg-dir –with-png-dir –with-xpm-dir –with-ttf –with-freetype-dir –with-gd \
–enable-gd-native-ttf –with-gettext –with-gmp –with-layout=GNU –with-oci8=instantclient \
–enable-sigchild –with-mysql –with-mysqli –enable-mbstring –with-mssql=/usr/local/freetds \
–with-kerberos –with-imap-dir –with-imap –with-imap-ssl –with-ldap –with-mhash \
–with-mime-magic –enable-pdo=shared –with-pdo-sqlite=shared –with-sqlite=shared \
–enable-soap –enable-zip

========================================================================



No Responses Yet to “Install dan Configure WebServer”

  1. Leave a Comment

Leave a comment