samp (solaris, apache, mysql, php)

10
Institut Manajemen Telkom http://www.imtelkom.ac.id S S A A M M P P [Solaris 10, Apache 2, MySQL 5, PHP 5] Nyoman Bogi Aditya Karna Sisfo IM Telkom [email protected] http://bogi.blog.imtelkom.ac.id

Upload: telkom-institute-of-management

Post on 04-Jun-2015

2.049 views

Category:

Education


14 download

DESCRIPTION

a tutorial guide on how to install Apache, MySQL, PHP on top of Solaris

TRANSCRIPT

Page 1: SAMP (Solaris, Apache, MySQL, PHP)

IInnssttiittuutt MMaannaajjeemmeenn TTeellkkoomm

http://www.imtelkom.ac.id

SSAAMMPP

[Solaris 10, Apache 2, MySQL 5, PHP 5]

Nyoman Bogi Aditya Karna Sisfo – IM Telkom [email protected] http://bogi.blog.imtelkom.ac.id

Page 2: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

Abstrak Saat ini banyak pengguna IT yang masih dibingungkan saat diharuskan memilih antara sistem operasi yang paling tepat yang akan digunakan untuk suatu server. Hal ini mengingat pada banyaknya pilihan yang tersedia, dimulai dari Linux yang terkenal atas open source dan dukungan aplikasinya, Solaris yang terkenal atas platform hardware Sun, FreeBSD yang terkenal di kalangan open source underground atas kestabilannya, dan Windows yang terkenal atas dukungan aplikasi dan user friendly-nya. Sebagian besar pengguna IT memang sudah jauh lebih mengenal Linux dan terbiasa dengannya, yang menyebabkan mereka tidak pernah sempat untuk mencoba-coba performansi sistem jika menggunakan platform yang lain. Hal ini disebabkan karena disamping Linux adalah platform open source yang paling banyak memiliki distribusi yang tersedia, ditambah dengan dukungan aplikasi terkenal lainnya seperti Apache, PHP, Oracle, SAP, dan lainnya.

Latar Belakang Meskipun Solaris bukan turunan langsung dari UNIX, namun topologi dan konfigurasi-nya sangat mirip dengan keluarga UNIX. Solaris pada awalnya adalah platform yang didesain hanya untuk komputer Sun yang berbasis prosesor Sparc, namun sekarang telah tersedia platform Solaris untuk prosesor dengan arsitektur x86 dimana didalamnya mencakup Intel dan AMD. Popularitas Solaris x86 semakin menanjak sejak di-release secara free sepanjang untuk keperluan pembelajaran, development, dan trial. Saat ini release terakhir dari Solaris 10 adalah Solaris 5/09 yang merupakan release pada bulan Mei di tahun 2009. Solaris 5/09 dikemas dalam 5 CD utama ditambah dengan 1 CD tambahan (companion). Ada beberapa aplikasi yang dibundling kedalam 5 CD tersebut, mencakup aplikasi yang sangat dibutuhkan dalam membantu pekerjaan keseharian kita yaitu Star Office.

Tujuan Buku manual ini ditujukan untuk memudahkan praktisi, teknisi, maupun user dalam melakukan instalasi AMP (Apache – MySQL – PHP) diatas Solaris 10 sebagai layanan (Service) yang paling sering dibutuhkan untuk melayani kebutuhan SME (Small Medium Enterprise). Sistem Operasi yg di-standarkan dalam buku manual ini adalah Solaris 10, Apache 2, MySQL 5, dan PHP 5.

Seputar Solaris Solaris merupakan solusi yang ideal untuk server, namun masih banyak keraguan dari sisi pemakai terutama untuk platform x86 karena beberapa pemakai melaporkan pernah mengalami gangguan (hang) saat menggunakan platform ini.

Page 3: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

Berikut tampilan dari Solaris yang menggunakan GUI GNOME

Instalasi Tool Pendukung Instalasi tool pendukung untuk menunjang instalasi AMP di Solaris 10 semua berasal dari Blastwave™ (http://blastwave.network.com/csw) dimana pada situs ini tersedia repository aplikasi yang siap untuk diinstall karena telah berada dalam format package (.pkg.gz). Instalasi tool pendukung ini akan dijelaskan per tahap : Step 1 : Install pkgutil INTEL users : http://blastwave.network.com/csw/pkgutil_i386.pkg md5 = a9dcb973ca18d63439d6d4dd12c9bf0a sha1 = ba8ade3f4659708de716b6b6dbf5949fe4482b55 sha256 = c8734812a53c2b83dd6084a93a4c3fbe9a209f4ddcc8a280fcedcfb2a03f6266 # uname -a SunOS infusion 5.10 Generic_139556-08 i86pc i386 i86pc # cat /etc/release Solaris 10 5/09 s10x_u7wos_08 X86 Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms. Assembled 30 March 2009 # pkgadd -d http://blastwave.network.com/csw/pkgutil_`/sbin/uname -p`.pkg ## Downloading... ..............25%..............50%..............75%..............100% ## Download Complete

Page 4: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

The following packages are available: 1 CSWpkgutil pkgutil - installs Solaris packages easily (i386) 1.4,REV=2009.01.20 Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: Processing package instance <CSWpkgutil> from <http://blastwave.network.com/csw/pkgutil_i386.pkg> pkgutil - installs Solaris packages easily(i386) 1.4,REV=2009.01.20 Please see /opt/csw/share/doc/pkgutil/LICENSE for license information. ## Processing package information. ## Processing system information. 11 package pathnames are already properly installed. ## Verifying disk space requirements. ## Checking for conflicts with packages already installed. ## Checking for setuid/setgid programs. This package contains scripts which will be executed with super-user permission during the process of installing this package. Do you want to continue with the installation of <CSWpkgutil> [y,n,?] y Installing pkgutil - installs Solaris packages easily as <CSWpkgutil> ## Installing part 1 of 1. /opt/csw/bin/bldcat /opt/csw/bin/chkcat /opt/csw/bin/pkgutil /opt/csw/etc/pkgutil.conf.CSW /opt/csw/libexec/pkgutil/wget /opt/csw/share/doc/pkgutil/LICENSE /opt/csw/share/doc/pkgutil/readme /opt/csw/share/man/man1/pkgutil.1 /var/opt/csw/pkgutil/admin.CSW [ verifying class <none> ] ## Executing postinstall script. Installation of <CSWpkgutil> was successful. # mkdir /etc/opt/csw # cp -p /opt/csw/etc/pkgutil.conf.CSW /etc/opt/csw/pkgutil.conf Step 2 : Fetch Software catalog Jika kita perhatikan dari hasil instalasi di Step 1, terlihat bahwa package pkgutil telah mencakup aplikasi ‘wget’ yang dapat digunakan untuk mengambil suatu file baik melalui protokol FTP

Page 5: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

maupun HTTP. Koneksi yang digunakan oleh ‘wget’ bisa melalui direct connection atau melalui suatu proxy dengan setting sebagai berikut : # cat /export/home/manager/.wgetrc progress=dot:mega ftp_proxy=http://192.168.35.7:8080 http_proxy=http://192.168.35.7:8080 Sesuaikan IP address dan nomor port dengan setting yang berlaku di lingkungan kita. # /opt/csw/bin/pkgutil --catalog Fetching new catalog if available... --01:41:49-- http://blastwave.network.com/csw/unstable/i386/5.8/catalog => `/var/opt/csw/pkgutil/catalog.i386.5.8.0' Connecting to 192.168.35.7:8080... connected. Proxy request sent, awaiting response... 200 OK Length: 375,014 [text/plain] 0K ..... 100% 342.27 KB/s 01:41:52 (342.27 KB/s) - `/var/opt/csw/pkgutil/catalog.i386.5.8.0' saved [375014/375014] Step 3 : Security Semua software dari Blastwave telah memiliki digital signature, untuk itu kita perlu menambahkan kemampuan Solaris untuk dapat melakukan pengecekan signature ini dengan cara instalasi GNU GPG dan MD5 hash : # /opt/csw/bin/pkgutil --install gnupg textutils Parsing catalog, may take a while... New packages: CSWcommon CSWisaexec CSWexpat CSWiconv CSWncurses CSWggettext CSWbzip2 CSWzlib CSWreadline CSWtextutils CSWgnupg Total size: 9.2 MB 11 packages to fetch. Do you want to continue? [Y,n] Setelah CSWgnupg terinstall, selanjutnya adalah mengambil digital key milik Blastwave.org dan memasangnya di lokal. Untuk ini, kita bisa menggunakan GPG untuk mengambil digital key tersebut di MIT keyserver, dengan cara : # /opt/csw/bin/gpg --keyserver pgp.mit.edu --recv-keys A1999E90 gpg: directory `/root/.gnupg' created gpg: new configuration file `/root/.gnupg/gpg.conf' created gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run gpg: keyring `/root/.gnupg/secring.gpg' created gpg: keyring `/root/.gnupg/pubring.gpg' created gpg: requesting key A1999E90 from hkp server pgp.mit.edu gpg: /root/.gnupg/trustdb.gpg: trustdb created gpg: key A1999E90: public key “Blastwave Software (Blastwave.org Inc.) <[email protected]>” imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1

Page 6: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

Selanjutnya kita akan menggunakan digital key tersebut dan memasangnya di lokal dengan 3 langkah berikut : 1 ) Verifikasi digital key # /opt/csw/bin/gpg --list-keys //.gnupg/pubring.gpg -------------------- pub 1024D/A1999E90 2008-08-17 [expires: 2011-08-17] uid Blastwave Software (Blastwave.org Inc.) <[email protected]> sub 2048g/E4845389 2008-08-17 [expires: 2011-08-17] 2 ) Tandai bahwa digital key tersebut telah sesuai : # /opt/csw/bin/gpg --edit-key A1999E90 gpg (GnuPG) 1.4.9; Copyright (C) 2008 Free Software Foundation, Inc. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. pub 1024D/A1999E90 created: 2008-08-17 expires: 2011-08-17 usage: SC trust: unknown validity: unknown sub 2048g/E4845389 created: 2008-08-17 expires: 2011-08-17 usage: E [ unknown] (1). Blastwave Software (Blastwave.org Inc.) <[email protected]> Command> Trust pub 1024D/A1999E90 created: 2008-08-17 expires: 2011-08-17 usage: SC trust: unknown validity: unknown sub 2048g/E4845389 created: 2008-08-17 expires: 2011-08-17 usage: E [ unknown] (1). Blastwave Software (Blastwave.org Inc.) <[email protected]> Please decide how far you trust this user to correctly verify other users' keys (by looking at passports, checking fingerprints from different sources, etc.) 1 = I don't know or won't say 2 = I do NOT trust 3 = I trust marginally 4 = I trust fully 5 = I trust ultimately m = back to the main menu Your decision? 5 Do you really want to set this key to ultimate trust? (y/N) y pub 1024D/A1999E90 created: 2008-08-17 expires: 2011-08-17 usage: SC trust: ultimate validity: unknown sub 2048g/E4845389 created: 2008-08-17 expires: 2011-08-17 usage: E [ unknown] (1). Blastwave Software (Blastwave.org Inc.) <[email protected]> Please note that the shown key validity is not necessarily correct unless you restart the program. Command> quit

Page 7: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

3) edit pkgutil.conf agar pkgutil menggunakan digital key tersebut : # Configuration file for pkgutil # # Nothing below is mandatory to change, pkgutil will use the default values # noted below for each option unless something is uncommented # Mirror to use for downloads # See http://www.blastwave.org/mirrors.php for alternative mirrors # Default: http://blastwave.network.com/csw/unstable #mirror=http://blastwave.network.com/csw/unstable # Solaris 10: If you wish to limit pkgutil to installing packages # only to the global zone, then uncomment this line. Note that pkgrm does not # have the same option # WARNING: do not modify this unless you know what you're doing # Default: blank #pkgaddopts=-G # Flags for use with wget, e.g. "-nv" for less verbose or "-q" for quiet # WARNING: do not modify this unless you know what you're doing # Default: blank #wgetopts=-q # To enable use of gpg or md5, uncomment these # NOTE: it doesn't make sense to use md5 but not gpg so your options should be: # 1. both disabled, 2. gpg enabled, 3. both enabled. # Default: false, false use_gpg=true use_md5=true

Instalasi MySQL 5 Instalasi MySQL 5 sangat mudah, cukup dengan melakukan 2 command berikut : # /opt/csw/bin/pkg-get -i mysql5 mysql5client mysql5devel mysql5rt # /opt/csw/bin/pkg-get -i mysql5test Seanjutnya buat file configuration di /opt/csw/mysql5/my.cnf, dengan mengacu pada salah satu file my-*.cnf di /opt/csw/mysql5/share/mysql/ dan melakukan seting sesuai kebutuhan, seperti mengaktifkan InnoDB jika diperlukan. Lakukan seting group untuk MySQL : # groupadd mysql # useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false mysql Inisialisasi MySQL database : cd /opt/csw/mysql5 ./bin/mysql_install_db chown -R mysql:mysql ./var

Page 8: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

Jalankan MySQL 5 : # cd /opt/csw/mysql5 ; /opt/csw/mysql5/bin/mysqld_safe &

Instalasi PHP 5 Instalasi PHP 5 sangat mudah, namun memerlukan beberapa aplikasi tambahan sebagai pendukung agar PHP bisa diinstalasi, yaitu autoconf, automake, dan gsed : global# pkg-get -i autoconf ... global# which autoconf && autoconf --version | head -2 /opt/csw/bin/autoconf autoconf (GNU Autoconf) 2.59 Written by David J. MacKenzie and Akim Demaille. global# pkg-get -i automake ... global# which automake && automake --version | head -2 /opt/csw/bin/automake automake (GNU automake) 1.8.3 Written by Tom Tromey <[email protected]>. global# pkg-get -i gsed ... global# which gsed && gsed --version | head -2 /opt/csw/bin/gsed GNU sed version 4.1.4 Copyright (C) 2003 Free Software Foundation, Inc. Selain itu dibutuhkan pula beberapa aplikasi pendukung lainnya : global# which gcc && gcc --version | head -2 /usr/sfw/bin/gcc gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath) Copyright (C) 2004 Free Software Foundation, Inc. global# which gmake && gmake --version | head -2 /usr/sfw/bin/gmake GNU Make 3.80 Copyright (C) 2002 Free Software Foundation, Inc. global# which flex && flex --version | head -2 /usr/sfw/bin/flex flex version 2.5.4 global# which bison && bison --version | head -2 /usr/sfw/bin/bison bison (GNU Bison) 1.875 Written by Robert Corbett and Richard Stallman.

Page 9: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

global# which gm4 && gm4 --version | head -2 /opt/csw/bin/gm4 GNU M4 1.4.3 Written by Rene' Seindal. global# which perl && perl -v | head -2 /opt/csw/bin/perl This is perl, v5.8.7, built for sun4-solaris-thread-multi global# which gunzip && gunzip -V | head -2 /usr/bin/gunzip gunzip 1.3.3-patch.1 (2002-03-08) global# which gtar && gtar --version | head -2 /usr/sfw/bin/gtar tar (GNU tar) 1.14 Copyright (C) 2004 Free Software Foundation, Inc. Langkah selanjutnya adalah menginstalasi PHP 5. Download source dari PHP 5 dari http://www.php.net/downloads.php#v5 dan ambil file dengan extensi tar.gz : global# gunzip -cd php-5.1.6.tar.gz | gtar xvpf – global# cd php-5.1.6 global# ./configure --with-apxs2=/usr/apache2/bin/apxs --enable-dbase \ --with-libxml-dir=/usr/local --with-config-file-path=/etc/apache2 \ --with-mysql=shared,/opt/csw/mysql5 \ --with-mysqli=shared,/opt/csw/mysql5/bin/mysql_config \ --with-xpm-dir=/usr --with-gd --with-tiff-dir=/usr --with-bz2=/usr/lib \ --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib --enable-mbstring \ --enable-calendar--enable-bcmath --enable-ftp --enable-exif global# gmake ... global# gmake install ... Installing PHP SAPI module: apache2handler /var/apache2/build/instdso.sh SH_LIBTOOL='/var/apache2/build/libtool' libphp5.la /usr/apache2/libexec /var/apache2/build/libtool --mode=install cp libphp5.la /usr/apache2/libexec/ cp .libs/libphp5.so /usr/apache2/libexec/libphp5.so chmod +x /usr/apache2/libexec/libphp5.so cp .libs/libphp5.lai /usr/apache2/libexec/libphp5.la libtool: install: warning: remember to run 'libtool --finish /build/php-5.1.2/libs' chmod 755 /usr/apache2/libexec/libphp5.so [activating module 'php5' in /etc/apache2/httpd.conf] Installing PHP CLI binary: /usr/local/bin/ Installing PHP CLI man page:/usr/local/man/man1/ Installing build environment: /usr/local/lib/php/build/ Installing header files: /usr/local/include/php/ Installing helper programs: /usr/local/bin/ program: phpize program: php-config

Page 10: SAMP (Solaris, Apache, MySQL, PHP)

SAMP @ Institut Manajemen Telkom (http://www.imtelkom.ac.id)

Installing man pages: /usr/local/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment:/usr/local/lib/php/ [PEAR] Archive_Tar - installed: 1.3.1 [PEAR] Console_Getopt - installed: 1.2 pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0) [PEAR] PEAR - installed: 1.4.6 Wrote PEAR system config file at: /usr/local/etc/pear.conf You may want to add: /usr/local/lib/php to your php.ini include_path Installing PDO headers: /usr/local/include/php/ext/pdo/ Selanjutnya copy file php.ini-dist dari directory php-5.1.6 ke directory Apache : global# cp php.ini-dist /etc/apache2/php.ini Dan edit file konfigurasi tersebut : ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; extension=mysql.so ; Directory in which the loadable extensions (modules) reside. extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20050922/" Pastikan bahwa modul mysql telah ada : # ls -l /usr/local/lib/php/extensions/no-debug-non-zts-20050922/ total 1088 -rwxr-xr-x1 root root103144 Aug 29 21:48 mysql.so -rwxr-xr-x1 root root429948 Aug 29 21:48 mysqli.so Dan tambahkan deklarasi modul PHP di file konfigurasi Apache 2 : LoadModule php5_module libexec/libphp5.so AddType application/x-httpd-php .php Start Apache 2: # svcadm enable apache2 # svcs | grep -i apache2 online 18:07:10 svc:/network/http:apache2