LAMP ( Linux, Apache, Mysql/Mariadb, PHP )

Seperti pada judul artikel ini LAMP adalah kependekan dari Linux, Apache, Mysql/Mariadb dan php, di tulisan saya kali ini akan kita bahas bagaimana caranya menginstall LAMP. Linux yang saya gunakan adalah linux Ubuntu server 20.04.

Install Database ( Mysql / Mariadb )
Untuk saat ini tersedia database, mysql yang sekarang dikembangkan oleh oracle dan mysql yang dikembangkan oleh pengembang asli dari mysql.
Dan dalam tulisan ini saya akan tunjukan cara install keduanya. Namun pada praktenya kita cukup install salah satu saja.

Mysql
Untuk menginstall mysql silahkan ketikan perintah ini

apt-get -y install mysql-server mysql-client

tunggu hingga proses install selesai, setelah proses install selanjutnya kita akan membuat password root dan menghilangkan user anonym dengan cara jalankan perintah.

mysql_secure_installation 

dan selanjutnya akan ada beberapa pertanyaan yang harus kita jawab.

Securing the MySQL server deployment.
Enter password for user root: 	< === tekan enter 

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No:
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : <-- y

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? (Press y|Y for Yes, any other key for No) : <-- 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? (Press y|Y for Yes, any other key for No) : <-- 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? (Press y|Y for Yes, any other key for No) : <-- y

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : <-- y

Mariadb
Dan untuk menginstall mariadb caranya adalah dengan menjalankan perintah ini 
apt-get -y install mariadb-server mariadb-client
tidak jauh berbeda dengan proses install mysql, setelah proses installasi selesai kita jalankan perintah 
mysql_secure_installation
dan akan muncul beberapa pertanyaan seperti dibawah ini 

Enter current password for root (enter for none): <-- press enter
Set root password? [Y/n] <-- y
New password: <-- Enter the new MariaDB root password here
Re-enter new password: <-- Repeat the password
Remove anonymous users? [Y/n] <-- y
Disallow root login remotely? [Y/n] <-- y
Reload privilege tables now? [Y/n] <-- y

Sampai disini mariadb dan mysql sudah terinstall.

Apache
Selanjutnya adalah install web server apache2 dengan mengeksekusi perintah.

apt install apache2

Jika apache sudah terinstall dengan baik maka ketika kita panggil ip server akan muncul tampilan default apache2.

Document root default apache ada pada di /var/www/html/ dan untuk main configurasi nya ada di /etc/apache2/apache2.conf. setelah proses install database dan apache langkah selanjutnya adalah install PHP.

Install PHP
PHP yang saya menggunakan php versi 7.2 dan agar nantinya bisa berjalan dengan baik kita akan menginstall php beserta paket pendukungnya caranya adalah dengan mengeksuki perintah dibawah ini.

Apt install php7.2 libapache2-mod-php7.2 php7.2-mysql php7.2-curl php7.2-gd php7.2-intl php-pear php-imagick php7.2-imap php-memcache  php7.2-pspell php7.2-recode php7.2-sqlite3 php7.2-tidy php7.2-xmlrpc php7.2-xsl php7.2-mbstring php-gettext php7.2-opcache php-apcu

Tunggu hingga proses selesei dan untuk menguji apakah sudah terinstall dengan baik silahkan buat file php dengan nama phpinfo.php dan letakan di /var/www/html. Isi dari phpinfo .php adalah.

<?php
phpinfo();

sekarang kita akses dari browser dengan cara http://ip_server/phpinfo.php jika berhasil maka akan tampil informasi tentang php yang terinstall diserver.

Leave a Reply

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

WordPress Appliance - Powered by TurnKey Linux