[Linux] Cara Install Apache, MySQL, PHP, phpMyAdmin di CentOS 6

Install Apache

[INPUT]

1 2 3 sudo yum install httpd sudo service httpd start sudo chkconfig httpd on

Install MySQL

[INPUT]

1 2 3 sudo yum install mysql-server sudo service mysqld start sudo chkconfig mysqld on

Jalankan perintah untuk mengamankan MySQL; mengeset password username root, menghapus anonymous user, menonaktifkan root login remote, dan menghapus database test.

[INPUT]

1 sudo /usr/bin/mysql_secure_installation

Hasilnya

[INPUT]

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 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…   All done!  If you’ve completed all of the above steps, your MySQL installation should now be secure.   Thanks for using MySQL!

Install PHP

[INPUT]

1 sudo yum install php php-mysql

Mencari paket php yang dibutuhkan

[INPUT]

1 sudo yum search php-

Hasilnya

[INPUT]

1 2 3 4 5 6 7 8 9 php-bcmath.x86_64 : A module for PHP applications for using the bcmath library php-cli.x86_64 : Command-line interface for PHP php-common.x86_64 : Common files for PHP php-dba.x86_64 : A database abstraction layer module for PHP applications php-devel.x86_64 : Files needed for building PHP extensions php-embedded.x86_64 : PHP library for embedding in applications php-enchant.x86_64 : Human Language and Character Encoding Support php-gd.x86_64 : A module for PHP applications for using the gd graphics library php-imap.x86_64 : A module for PHP applications that use IMAP

Instalasi paketnya cukup nama paket saja yang ditulis, misalnya mau menginstalasi paket php-cli.x86_64.

[INPUT]

1 sudo yum install php-cli

Restart service Apache agar membaca modul PHP yang sudah diinstalasi

[INPUT]

1 sudo service httpd restart

Membuat file info.php yang berisi phpinfo untuk menguji apakah script PHP sudah bisa terbaca.

[INPUT]

1 sudo nano /var/www/html/info.php

Isi filenya

[INPUT]

1

Install phpMyAdmin

[INPUT]

1 sudo rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

[INPUT]

1 sudo yum update

[INPUT]

1 sudo yum install phpmyadmin

Ubah konfigurasi phpMyAdmin.conf agar bisa diakses, karena jika tidak akan tampil pesan *Forbidden 403*

[INPUT]

1 sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

Tambahkan *Allow from all* seperti di bawah ini

[INPUT]

1 2 3    AddDefaultCharset UTF-8    Allow from all

Restart service apache

[INPUT]

1 service httpd restart

Akses *http://localhost/phpmyadmin*

selamat mencoba 🙂

Leave a Reply

Your email address will not be published.

scroll to top