Install LAMP Centos 7

lamp

Salah satu alasan dari memiliki server sendiri adalah menjadikannya sebuah hosting web. Dengan hosting menggunakan server sendiri, performa/harga yang didapatkan bisa jauh lebih banyak daripada ketika di hosting menggunakan hostingan CPanel. Oleh karena itu, pada tutorial ini ada langkah-langkah dasar untuk melakukan instalasi LAMP (Linux Apache Mysql PHP)

  • Install dan update centos 7
    yum update -y
  • Install semua software yang dibutuhkan
    yum install httpd mariadb-server php php-mysql epel-release nano
    yum install phpmyadmin
  • Lakukan konfigurasi file /etc/httpd/conf.d/phpMyAdmin.conf  menjadi kurang lebih seperti berikut
    <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 127.0.0.1
         #Allow from ::1
         Allow from all
       </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
  • Jalankan dan enable software yang telah diinstall agar dapat berjalan saat server booting
    systemctl start httpd
    systemctl start mariadb
    systemctl enable httpd
    systemctl enable mariadb
  • Lakukan konfigurasi untuk mengamankan mysql
    mysql_secure_installation
    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 MariaDB
    root user without the proper authorization.
    
    New password: password
    Re-enter new password: password
    Password updated successfully!
    Reloading privilege tables..
     ... Success!
    
    By default, a MariaDB installation has an anonymous user, allowing anyone
    to log into MariaDB 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, MariaDB 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 MariaDB
    installation should now be secure.
    
    Thanks for using MariaDB!
  • Untuk mengakses server, masukkan http://<ip-server>
  • Untuk mengakses phpmyadmin, jalankan http://<ip-server>/phpmyadmin

Credit images: 1

Leave A Comment