• About
  • Contact
  • Disclaimer
  • Privacy Policy
  • Sitemap

Install LAMP Server (Apache, MySQL, PHP) di CentOS 6.x

 on Saturday, December 5, 2015  

LAMP adalah kombinasi dari sistem operasi dan perangkat lunak open-source stack. Akronim LAMP berasal dari huruf pertama dari Linux, Apache HTTP Server, database MySQL, dan PHP / Perl / Python.

Dalam tutorial ini mari kita lihat bagaimana untuk setup LAMP server pada CentOS Linux 6.x. Berikut x singkatan versi seperti 6.1, 6.2, 6.3, 6.4, 6.5 dll 

Hostname dan IP address server saya adalah server.jawaracyber.com dan 192.168.1.210


Install Apache

Apache merupakan open-source multi-platform server web. Ini menyediakan berbagai fitur web server termasuk CGI, SSL dan domain virtual.

Untuk menginstal Apache, masukkan perintah berikut dari terminal Anda:

# yum install httpd -y

Mulai service Apache dan membiarkannya untuk memulai secara otomatis setiap kali reboot: 

# service httpd start
# chkconfig httpd on
Biarkan port server Apache standar 80 melalui firewall/router jika Anda ingin terhubung dari sistem remote. Untuk melakukan itu, mengedit berkas /etc/sysconfig/iptables,

# vi /etc/sysconfig/iptables

Tambahkan baris berikut.

[...]
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEP
[...]
Restart iptables 
# service iptables restart

 Test Apache:

Buka browser web Anda dan arahkan ke http://localhost/ atau http://server-ip-address/.
  


Install MySQL 

MySQL adalah kelas enterprise, open source, database kedua di dunia yang paling sering digunakan. MySQL adalah pilihan populer database untuk digunakan dalam aplikasi web, dan merupakan komponen utama dari banyak digunakan perangkat lunak LAMP aplikasi web open source stack.

Untuk menginstal MySQL, masukkan perintah berikut:


# yum install mysql mysql-server -y 

Mulai service MySQL dan membiarkannya untuk memulai secara otomatis setiap kali reboot:


# service mysqld start
# chkconfig mysqld on

Setup password root MySQL

Secara default, user root mysql tidak memiliki password. Untuk mengamankan mysql, kita harus setup mysql password root user.

# 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):     ## Tekan Enter ##
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]     ## Tekan Enter ##
New password:                ## Masukan password baru ##
Re-enter new password:       ##Masukan ulang 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]     ## Tekan Enter ##
... 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]     ## Tekan Enter ##
... 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]     ## Press Enter ##
- 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]     ## Press Enter ##
... 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

PHP (singkatan rekursif dari PHP: Hypertext Preprocessor) adalah banyak digunakan open-source tujuan umum bahasa scripting yang sangat cocok untuk pengembangan web dan dapat ditanamkan ke dalam HTML.

Instal PHP dengan perintah berikut:
 

# yum install php -y

Buat sampel "testphp.php" file di folder document root Apache dan menambahkan baris seperti berikut: 

# vi /var/www/html/testphp.php

Tambahkan baris berikut.

<?php
phpinfo();
?>
Restart httpd service:

# service httpd restart

Arahkan ke http://server-ip-address/testphp.php. Ini akan menampilkan semua rincian tentang php seperti versi, tanggal dan perintah membangun dll

Jika Anda ingin mendapatkan dukungan MySQL di PHP, Anda harus menginstal "php-mysql" paket. Jika Anda ingin menginstal semua modul php Anda hanya menggunakan perintah "yum install php *"
# yum install php-mysql -y

Sekarang buka file phptest.php di browser Anda menggunakan http://ip-address/testphp.php atau http://domain-name/testphp.php. Gulir ke bawah dan Anda akan melihat modul mysql akan disajikan di sana.

Install phpMyAdmin 

phpMyAdmin adalah open source tool antarmuka web gratis, digunakan untuk mengelola database MySQL Anda. Secara default phpMyAdmin tidak ditemukan dalam repositori resmi CentOS. Jadi mari kita menginstalnya menggunakan repositori EPEL.

Untuk menginstal repositori EPEL, ikuti link di bawah ini:

- Install EPEL Repository pada RHEL / CentOS linux 6.x dan 5.x
  
Sekarang instal phpMyAdmin

# yum install phpmyadmin -y

Konfigurasi phpMyAdmin

Edit file phpmyadmin.conf
 
 


# vi /etc/httpd/conf.d/phpMyAdmin.conf

Cari dan beri tanda # seluruh bagian / <Directory> untuk tidak mengaktifkan konfigurasi seperti yang ditunjukkan di bawah ini:  

[...]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
#<Directory /usr/share/phpMyAdmin/ >
#   <IfModule mod_authz_core.c>
#     # Apache 2.4
#     Require local
#   &lt;/IfModule&gt;
#   &lt;IfModule !mod_authz_core.c&gt;
#     # Apache 2.2
#     Order Deny,Allow
#     Deny from All
#     Allow from 127.0.0.1
#     Allow from ::1
#   </IfModule>
#</Directory>
[...]
   
Buka "config.inc.php" file dan perubahan dari "cookie" untuk "http" untuk mengubah otentikasi di phpMyAdmin:
# cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php
# vi /usr/share/phpMyAdmin/config.inc.php

Mengubah cookie untuk http.

[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] ='http'
[...]
Restart service apache :

# service httpd restart

Sekarang Anda dapat mengakses konsol phpmyadmin dengan menavigasi ke http://server-ip-address/phpmyadmin/ dari browser Anda.

Masukkan username dan password yang telah Anda berikan pada langkah sebelumnya MySQL Anda. Dalam kasus saya yang "root" dan "CentOS".
 



Sekarang Anda akan diarahkan ke dashboard.page phpmyadmin seperti yang ditunjukkan di bawah ini.



Sekarang Anda akan mampu mengelola database MySQL Anda dari antarmuka web phpMyAdmin.

Itu saja. LAMP server Anda adalah membuat dan siap untuk digunakan.

Cheers!

Install LAMP Server (Apache, MySQL, PHP) di CentOS 6.x 4.5 5 Codingster Saturday, December 5, 2015 LAMP adalah kombinasi dari sistem operasi dan perangkat lunak open - source stack . Akronim LAMP berasal dari huruf pertama dari Lin...


No comments:

Post a Comment