Tutorial Instal LAMP di Debian



LAMP merupakan akronim dari "Linux Apache MySQL and PHP", yakni sekumpulan aplikasi yang digunakan untuk menjalankan web service. Seperti namanya, LAMP merupakan aplikasi yang terdiri dari Apache yang berfungsi sebagai web server, MySQL atau MariaDB yang berfungsi sebagai database server, serta PHP/Perl/Phyton yang merupakan bahasa pemrograman untuk membangun sebuah web. Semuanya tergabung menjadi satu dan berjalan pada sistem operasi Linux.

LAMP biasa digunakan untuk keperluan web server dan dapat diinstal di berbagai distro linux, salah satunya adalah di Debian. Pada postingan ini akan dibahas cara menginstal LAMP pada sistem operasi Debian 8. 

Alat dan bahan yang perlu disiapkan antara lain :
  • PC atau laptop
  • Sistem operasi Debian 8
  • Software virtualisasi (apabila debian diinstal pada virtual machine)
  • DVD debian 8 (apabila menggunakan repositori offline berupa dvd)
  • Koneksi internet (apabila menggunakan repositori online)
  • Untuk repositori debian 8 bisa kamu cek disini.


Update repositori

Pertama-tama lakukan update repositori terlebih dahulu agar daftar paket aplikasi yang terdapat pada repositori terunduh sehingga komputer tidak akan bingung ketika akan menginstal paket-paket aplikasi nanti.
root@webserv:~# apt update

Instalasi Apache

Langkah selanjutnya adalah menginstal paket apache yang digunakan untuk menjalankan web server.
root@webserv:~# apt install apache2

Cek apakah service web server telah berjalan dengan cara mengakses ip web server pada browser.



Instalasi MySQL

Setelah menginstal paket web server, langkah berikutnya adalah menginstal mysql server untuk keperluan database server.
root@webserv:~# apt install mysql-server

Setelah instalasi selesai, lakukan secure instalation untuk mengamankan mysql dengan perintah :
root@webserv:~# mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n
 ... skipping.

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
 ... Failed!  Not critical, keep moving...
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!
Konfirmasi setiap pertanyaan yang ada. Jika ragu bisa diisi dengan Y semua.

Instalasi PHP

Tahap selanjutnya setelah sukses menginstal mysql adalah menginstal paket php.
root@webserv:~# apt install php5 php5-mysql phpmyadmin
Apabila terdapat pertanyaan untuk memasukkan password, isikan password seperti yang digunakan pada mysql. Kamu juga dapat menambahkan paket-paket php yang lain apabila diperlukan.

Setelah instalasi selesai, cek apakah service php telah berjalan. Buat sebuah file pada direktori /var/www/html dengan ekstensi .php misal info.php .
root@webserv:~# nano /var/www/html/info.php

Isi file dengan script berikut :
<?php
phpinfo();
?>
Kemudian simpan.

Selanjutnya akses file tersebut melalui browser dengan url seperti berikut :
http://ip_address_web_server/nama_file.php
Silahkan sesuaikan ip address dan nama file yang telah dibuat.

Jika browser menampilkan tampilan seperti di bawah ini maka service php telah berjalan.


Selamat, kamu telah berhasil menginstal LAMP. 

Perlu diketahui bahwa konfigurasi-konfigurasi dan paket aplikasi yang digunakan pada tutorial ini masih sangat standart. Jika ingin membangun web server yang baik dan aman, kamu perlu melakukan konfigurasi dan menginstal aplikasi tambahan serta meningkatkan kemanan (hardening) web server. Sekian tutorial mengenai instalasi LAMP pada Debian, semoga bermanfaat.


Referensi :
id.wikipedia.com
Linuxku.com
tecmint.com



Load Comments