Install Apache, MySQL dan PHP pada server Linux Debian 7

Persiapan :

[root@server ~]# apt-get update

Langkah Pertama – Install Apache

buka terminal dan masukkan perintah berikut :

[root@server ~]# apt-get install apache2

untuk mencek apakah apache kita sudah berjalan dengan benar, bisa langsung di akses melalui browser dengan mengetik IP address server kita (misal. http://12.34.56.789).

maka akan tampil sebuah halaman “It works!”.

 

Langkah Kedua – Install MySQL

kembali ke terminal dan masukkan perintah berikut :

[root@server ~]# apt-get install mysql-server

Selama proses instalasi, MySQL akan meminta password untuk root akses database, silahkan masukkan password yang anda inginkan.

Langkah terakhir setting script MySQL :

[root@server ~]# mysql_secure_installation

masukkan password root MySQL yang sudah anda buat sebelumnya, dan ikuti perintah selanjutnya.

Enter current password for root (enter for none):

OK, successfully used password, moving on...
Then the prompt will ask you if you want to change the root password. Go ahead and choose N and move on to the next steps.
It’s easiest just to say Yes to all the options. At the end, MySQL will reload and implement the new changes.
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...
... Success!

- 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...

dan yang terakhir adalah instalasi PHP pada server.

Langkah Ketiga – Install PHP

masih pada terminal dan ketik perintah berikut :

[root@server ~]# apt-get install php5 php-pear php5-mysql

tinggal jawab Yes sebanyak 2 kali, proses intalasi php berjalan dengan sendirinya

Setelah selesai, kita restarting apache:

[root@server ~]# service apache2 restart

Langkah Terakhir – HASILNYA : melihat PHP di Server kita

kita akan membuat sebuah file halaman berisi php info :

[root@server ~]# nano /var/www/info.php

masukkan script berikut:

<?php

phpinfo();

?>

Simpan dan Keluar dari editor nano.

terakhir tinggal kita check di browser dengan mengakses halaman yg kita buat tadi seperti ini http://12.34.56.789/info.php

Posted on 7 April, 2017 in Technology

Share the Story

Leave a reply

Your email address will not be published. Required fields are marked *

Back to Top