Ubuntu 10.04 Server'da Lighttpd & PHP5 ve MySQL Kurulumu

Ubuntu Server'da adım adım Lighttp,PHP5 ve MySQL Server kurulumu

1) Kuruluma başlamadan önce sudo su komutu ile root yetkilerine sahip oluyoruz.

admin@programlar-com:~$ sudo su
root@programlar-com:/home/admin#

2) Paket listesini güncellemek için apt-get update komutunu çalıştırıyoruz.

root@programlar-com:/home/admin# apt-get update
Hit http://tr.archive.ubuntu.com lucid Release.gpg
Ign http://tr.archive.ubuntu.com/ubuntu/ lucid/main Translation-en_US
Ign http://tr.archive.ubuntu.com/ubuntu/ lucid/restricted Translation-en_US
Ign http://tr.archive.ubuntu.com/ubuntu/ lucid/universe Translation-en_US
Ign http://tr.archive.ubuntu.com/ubuntu/ lucid/multiverse Translation-en_US
Get:1 http://tr.archive.ubuntu.com lucid-updates Release.gpg [198B]
Hit http://tr.archive.ubuntu.com hardy-backports/restricted Packages
Hit http://tr.archive.ubuntu.com hardy-backports/universe Packages
Hit http://tr.archive.ubuntu.com hardy-backports/multiverse Packages
Hit http://tr.archive.ubuntu.com hardy-backports/main Sources
Hit http://tr.archive.ubuntu.com hardy-backports/restricted Sources
Hit http://tr.archive.ubuntu.com hardy-backports/universe Sources
Hit http://tr.archive.ubuntu.com hardy-backports/multiverse Sources
Fetched 1,271kB in 2s (483kB/s)
Reading package lists... Done
root@programlar-com:/home/admin#

Not: Eğer sadece Lighttp ve PHP5 kullanmak istiyorsanız 3 - 4 ve 5. adımları pas geçebilirsiniz.

3) Kuruluma MySQL Server ile başlıyoruz, apt-get install mysql-server mysql-client komutunu çalıştırdıktan sonra gerekli olan paketlerin listesi geliyor, tüm paketleri indirip kurmak için gelen soruya y diyerek devam ediyoruz.

root@programlar-com:/home/admin# apt-get install mysql-server mysql-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16
libnet-daemon-perl libplrpc-perl mysql-client-5.1 mysql-client-core-5.1
mysql-common mysql-server-5.1 mysql-server-core-5.1
Suggested packages:
dbishell libipc-sharedcache-perl tinyca mailx
The following NEW packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient16
libnet-daemon-perl libplrpc-perl mysql-client mysql-client-5.1
mysql-client-core-5.1 mysql-common mysql-server mysql-server-5.1
mysql-server-core-5.1
0 upgraded, 13 newly installed, 0 to remove and 73 not upgraded.
Need to get 23.3MB of archives.
After this operation, 54.9MB of additional disk space will be used.
Do you want to continue [Y/n]?

4) Paketler indirildikten sonra kurulum başlıyor ve MySQL root hesabı için güvenli bir parola belirleyip devam ediyoruz.

Ubuntu 10.04 Server  da Lighttpd & PHP5 ve MySQL Kurulumu

Ubuntu 10.04 Server  da Lighttpd & PHP5 ve MySQL Kurulumu

5) MySQL Server kurulumu bitti, bağlanmak için mysql -u root -p komutunu kullanıyoruz ve bağlandıktan sonra örnek olarak MySQL server sürüm bilgisini gösteren SHOW VARIABLES LIKE "%version%"; komutunu çalıştırıyoruz, herhangi bir problem olmadığını gördükten sonra quit diyerek mysql bağlantısını kapatıyoruz.

root@programlar-com:/home/admin# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 41
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+---------------------+
| Variable_name | Value |
+-------------------------+---------------------+
| protocol_version | 10 |
| version | 5.1.41-3ubuntu12.10 |
| version_comment | (Ubuntu) |
| version_compile_machine | i486 |
| version_compile_os | debian-linux-gnu |
+-------------------------+---------------------+
5 rows in set (0.00 sec)

mysql> quit
Bye

6) Sıra Lighttp Server kurulumuna geldi, apt-get install lighttpd komutunu çalıştırıyoruz

root@programlar-com:/home/admin# apt-get install lighttpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
gamin libgamin0 libterm-readline-perl-perl spawn-fcgi
Suggested packages:
rrdtool apache2-utils
The following NEW packages will be installed:
gamin libgamin0 libterm-readline-perl-perl lighttpd spawn-fcgi
0 upgraded, 5 newly installed, 0 to remove and 73 not upgraded.
Need to get 0B/414kB of archives.
After this operation, 1,565kB of additional disk space will be used.
Do you want to continue [Y/n]? y

Lighttpd ve ilişkili diğer paketler kuruluyor...

Selecting previously deselected package libgamin0.
(Reading database ... 52652 files and directories currently installed.)
Unpacking libgamin0 (from .../libgamin0_0.1.10-1ubuntu3_i386.deb) ...
Selecting previously deselected package gamin.
Unpacking gamin (from .../gamin_0.1.10-1ubuntu3_i386.deb) ...
Selecting previously deselected package libterm-readline-perl-perl.
Unpacking libterm-readline-perl-perl (from .../libterm-readline-perl-perl_1.0303-1_all.deb) ...
Selecting previously deselected package lighttpd.
Unpacking lighttpd (from .../lighttpd_1.4.26-1.1ubuntu3_i386.deb) ...
Selecting previously deselected package spawn-fcgi.
Unpacking spawn-fcgi (from .../spawn-fcgi_1.6.3-1_i386.deb) ...
Processing triggers for ufw ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Setting up libterm-readline-perl-perl (1.0303-1) ...
Setting up spawn-fcgi (1.6.3-1) ...
update-alternatives: using /usr/bin/spawn-fcgi.standalone to provide /usr/bin/spawn-fcgi (spawn-fcgi) in auto mode.
update-alternatives: warning: not replacing /usr/share/man/man1/spawn-fcgi.1.gz with a link.

Setting up gamin (0.1.10-1ubuntu3) ...
Setting up libgamin0 (0.1.10-1ubuntu3) ...

Setting up lighttpd (1.4.26-1.1ubuntu3) ...
Syntax OK
* Starting web server lighttpd [ OK ]

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
root@programlar-com:/home/admin#

7) Lighttp Server kurulumu da tamamlandı, kontrol için herhangi bir tarayıcıda adres satırına Ubuntu Server'ın ip adresini yazıp giriyoruz.

Ubuntu 10.04 Server  da Lighttpd & PHP5 ve MySQL Kurulumu

8) Son adımda PHP5 kurulumunu yapacağız, bunun için apt-get install php5-cgi komutunu çalıştırıyoruz ve ilişkili paketlerin kurulumunu onaylıyoruz.

root@programlar-com:/home/admin# apt-get install php5-cgi
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
php5-common
Suggested packages:
php-pear php5-suhosin
The following NEW packages will be installed:
php5-cgi php5-common
0 upgraded, 2 newly installed, 0 to remove and 73 not upgraded.
Need to get 6,166kB of archives.
After this operation, 16.1MB of additional disk space will be used.
Do you want to continue [Y/n]? y

PHP5 ve ilgili paketler kuruluyor...

Get:1 http://tr.archive.ubuntu.com/ubuntu/ lucid-updates/main php5-common 5.3.2-1ubuntu4.7 [543kB]
Get:2 http://tr.archive.ubuntu.com/ubuntu/ lucid-updates/main php5-cgi 5.3.2-1ubuntu4.7 [5,624kB]
Fetched 6,166kB in 6s (1,003kB/s)
Selecting previously deselected package php5-common.
(Reading database ... 52764 files and directories currently installed.)
Unpacking php5-common (from .../php5-common_5.3.2-1ubuntu4.7_i386.deb) ...
Selecting previously deselected package php5-cgi.
Unpacking php5-cgi (from .../php5-cgi_5.3.2-1ubuntu4.7_i386.deb) ...
Processing triggers for man-db ...
Setting up php5-common (5.3.2-1ubuntu4.7) ...
Setting up php5-cgi (5.3.2-1ubuntu4.7) ...
Creating config file /etc/php5/cgi/php.ini with new version
update-alternatives: using /usr/bin/php5-cgi to provide /usr/bin/php-cgi (php-cgi) in auto mode.
update-alternatives: using /usr/lib/cgi-bin/php5 to provide /usr/lib/cgi-bin/php (php-cgi-bin) in auto mode.
root@programlar-com:/home/admin#

9) Kurulum süreci bitti, şimdi lighttp ile php arasındaki iletişimi sağlayacak son işlemleri yapıyoruz.

İlk olarak /etc/php5/cgi/php.ini dosyasını herhangi bir metin editörü (vi, vim, nano vs) ile açıp sonuna cgi.fix_pathinfo = 1 satırını ekliyoruz.

root@programlar-com:/home/admin# nano /etc/php5/cgi/php.ini

Ubuntu 10.04 Server  da Lighttpd & PHP5 ve MySQL Kurulumu

Lighttp'nin fastcgi modülünü etkinleştirmek için lighttpd-enable-mod fastcgi komutunu çalıştırıyoruz.

root@programlar-com:/home/admin# lighttpd-enable-mod fastcgi
Available modules: auth cgi fastcgi proxy rrdtool simple-vhost ssi ssl status userdir
Already enabled modules:
Enabling fastcgi: ok
Run /etc/init.d/lighttpd force-reload to enable changes
root@programlar-com:/home/admin#

Fastcgi konfigürasyonunu etkinleştirmek için /etc/lighttpd/conf-available/10-fastcgi.conf dosyasını /etc/lighttpd/conf-enabled altına sembolik link (symlink) olarak eklemek gerekiyor.

root@programlar-com:/home/admin# cd /etc/lighttpd/conf-enabled/
root@programlar-com:/etc/lighttpd/conf-enabled# ln -s /etc/lighttpd/conf-available/10-fastcgi.conf

ls -l komutuyla linkin doğru dosyayı gösterdiğini kontrol ediyoruz.

root@programlar-com:/etc/lighttpd/conf-enabled# ls -l
total 0
lrwxrwxrwx 1 root root 44 2011-02-26 13:00 10-fastcgi.conf -> /etc/lighttpd/conf-available/10-fastcgi.conf

Lighttpd'nin konfigürasyon dosyalarını tekrar yüklemesi için aşağıdaki komutu veriyoruz.

root@programlar-com:/etc/lighttpd/conf-enabled# /etc/init.d/lighttpd force-reload
Syntax OK
* Reloading web server configuration lighttpd [ OK ]
root@programlar-com:/etc/lighttpd/conf-enabled#

PHP'yi test etmek için aşağıdaki kodu /var/www/phpinfo.php (uzantısı php olan herhangi bir dosya ismi de verebilirsiniz) dosyasına kaydedin.

phpinfo();
?>

Ubuntu 10.04 Server  da Lighttpd & PHP5 ve MySQL Kurulumu

Bu işlemin ardından yeni bir tarayıcı penceresi açıp php dosyamızı çağırıyoruz.

Ubuntu 10.04 Server  da Lighttpd & PHP5 ve MySQL Kurulumu

Yukarıdaki sayfayı gördüyseniz taze demlenmiş bir bardak çay hakedilmiş demektir :)



Ekleyen
baktas
Güncelleme Zamanı
26.02.2011