Install apache, php, mysql, phpmyadmin di centos

0
757

Selamat siang sobat sekolahlinux, kali ini saya akan membuat tutorial install apache, php, mysql dan phpmyadmin di centos, langsung ikuti tahapan-tahapan dibawah ini

pastikan anda sebagai mode root dan kalian sudah install repository epel pada linux centos anda, caranya seperti dibawah

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

jika sudah maka update linux anda dengan perintah ini

yum update -y

berikutnya kita lakukan instalasi untuk apache php mysql dan phpmyadmin

yum install mysql mysql-server php httpd phpmyadmin

lalu jalankan command ini pada terminal anda

chkconfig httpd on
chkconfig mysqld on
service httpd start
service mysqld start

buat file info.php untuk mengetahui apakah phpnya berjalan dengan baik dan apachenya juga berjalan dengan baik, ikuti command dibawah ini

vim /var/www/html/info.php
<?php
phpinfo();
?>

jika sudah coba akses dari browser anda alamat ip server http://ip_server/info.php

jika tidak bisa dibuka coba cek filrewallnya apakah sudah dibuka atau blum akses ke server tersebut, atau coba matikan firewallnya

lalu kita berikan root mysql yang terinstall password agar nantinya lebih aman, ikuti command dibawah ini ketikkan mysql_secure_installation

[root@node2 ~]# 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.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


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] n
 ... skipping.

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] n
 ... skipping.

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!

jika sudah maka edit pengaturan phpMyAdmin.conf seperti dibawah ini, agar semua komputer dari jaringan manapun dapat mengakses phpmyadminnya

vim /etc/httpd/conf.d/phpMyAdmin.conf
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       #Require ip 127.0.0.1
       #Require ip ::1
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     #Deny from All
     Allow from all
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
       #Require ip 127.0.0.1
       #Require ip ::1
       Require all granted
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     #Deny from All
     Allow from all
     Allow from ::1
   </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>
#</IfModule>

jika sudah restart service apachenya seperti dibawah ini

service httpd restart

lalu jika sudah coba buka browser anda dan buka alamat ini http://ip_server/phpmyadmin

jika semua benar maka harusnya anda sudah berhasil masuk ketampilan login phpmyadmin, isikan user root dan password yang anda buat untuk user root mysql anda.

selamat mencoba dan semoga bermanfaat 😀 jika ada kesulitan silahkan komentar nanti akan saya bantu

LEAVE A REPLY

Please enter your comment!
Please enter your name here