Install Apache,MariaDB, PHP (LAMP) di Manjaro Linux | Seperti yang kita ketahui bahwasahnya Apache, MariaDB,PHP adalah serangkaian komponen untuk membangun server di personal computer ataupun laptop kita.
Nantinya, server localhost ini bisa kita gunakan untuk membuat website yang tujuannya untuk uji coba.
Jika di Windows, XAMPP merupakan software yang paling banyak digunakan untuk membuat server localhost.
Untuk di linux, kita akan menggunakan terminal guna bisa menginstall LAMP.
LAMP adalah singkatan dari Linux, Apache, MySQL / MariaDB, PHP / Perl / Pyhton.
Pada kesempatan kali ini saya dari Bingungonline.com akan membagikan tutorial install Apache, MariaDB, PHP (LAMP) untuk Linux, Archlinux, manjaro, dan turunan lainnya.
Namun sebelumnya, buat kamu yang menyukai pembahasan-pembahasan seputar linux, kamu bisa membacanya di sini
Cara Install Apache,MariaDB, PHP (LAMP) di Manjaro Linux
1.Update Sistem
Jalankan perintah di bawah ini dengan akses root untuk mengupdate sistem linux kamu
sudo pacman -Syyu
Masukan password dan tekan enter
2. Install Apache
Setelah mengupdate sistem, sekarang silahkan install Apache Web Server dengan menggunakan perintah di bawah ini
sudo pacman -S apache
Edit /etc/httpd/conf/httpd.conf file,
sudo nano /etc/httpd/conf/httpd.conf
Cari kode seperti di bawah ini, dan berikan komen (tanda # di awal) :
[...]
# LoadModule unique_id_module modules/mod_unique_id.so
[...]
Simpan file dan keluar
Aktifkan apache
Untuk mengaktifkan apache di server kita, silahkan masukan perintah di bawah ini
sudo systemctl enable httpd
sudo systemctl restart httpd
Untuk memastikan apakah apache kita sudah aktif atau belum, errror atau tidak, jalankan perintah berikut :
sudo systemctl status httpd
Sample output:
httpd.service - Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor
preset: disabled)
Active: active (running) since Tue 2016-02-16 13:00:18 IST; 7s ago
Main PID: 1067 (httpd)
Tasks: 82 (limit: 512)
CGroup: /system.slice/httpd.service
├─1067 /usr/bin/httpd -k start -DFOREGROUND
├─1070 /usr/bin/httpd -k start -DFOREGROUND
├─1071 /usr/bin/httpd -k start -DFOREGROUND
└─1072 /usr/bin/httpd -k start -DFOREGROUND
Feb 16 13:00:18 server systemd[1]: `Started Apache Web Server.`
Feb 16 13:00:18 server httpd[1067]: AH00558: httpd: Could not reliably
dete...ge
Hint: Some lines were ellipsized, use -l to show in full.
Apache server is ready to use.
Jika pada terminal kamu muncul tampilan Active seperti di atas, artinya apache kita tidak memiliki error dan berjalan dengan baik
Test Apache
Mari kita buat contoh halaman sederhana untuk mengetest apache kita pada directory penyimpanan apache , i.e /srv/http.
sudo nano /srv/http/index.html
Tambahkan kode berikut:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Welcome</title>
</head>
<body>
<h2>Welcome to my Web Server test page</h2>
</body>
</html>
Jika sudah, silahkan buka browser kamu dan arahkan pada
http://localhost
or http://IP-address
.
Jika semuanya benar, maka akan tampil seperti pada gambar di bawah ini

3. Install MariaDB
Jalan perintah berikut untuk menginstall MariaDB
sudo pacman -S mysql
Seperti yang kita ketahui, MariaDB sekarang adalah default implementation dari MySQL di Arch Linux sejak 2013.
Jadi, kita akan mendapatkan beberapa pertanyaan untuk install MariaDB atau Percona server, cukup tekan enter
dan tekan y
lalu tekan enter lagi.
[root@server ~]# pacman -S mysql
:: There are 2 providers available for mysql:
:: Repository extra
1) mariadb
:: Repository community
2) percona-server
Enter a number (default=1): `## Press Enter`
resolving dependencies...
looking for conflicting packages...
Packages (7) boost-libs-1.60.0-2 icu-56.1-2 jemalloc-4.0.4-1libmariadbclient-10.1.11-1 libxml2-2.9.3-1
mariadb-clients-10.1.11-1 mariadb-10.1.11-1
Total Download Size: 30.68 MiB
Total Installed Size: 218.10 MiB
:: Proceed with installation? [Y/n]
Kamu perlu menginstall MariaDB di directory, untuk melakukannya jalankan perintah berikut:
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Untuk mengaktifkan mysqld, jalankan perintah berikut :
sudo systemctl enable mysqld
sudo systemctl start mysqld
Untuk memastikannya, sama seperti tadi. Silahkan cek dengan perintah berikut
sudo systemctl status mysqld
Sample output:
mysqld.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled;
vendor preset: disabled)
Active: active (running) since Tue 2016-02-16 13:19:50 IST; 44s ago
Process: 1406 ExecStartPost=/usr/bin/mysqld-post (code=exited,
status=0/SUCCESS)
Main PID: 1405 (mysqld)
Tasks: 26 (limit: 512)
CGroup: /system.slice/mysqld.service
└─1405 /usr/bin/mysqld --pid-file=/run/mysqld/mysqld.pid
Feb 16 13:19:49 server mysqld[1405]: 2016-02-16 13:19:49 139930931222400
[N...a.
Feb 16 13:19:49 server mysqld[1405]: 2016-02-16 13:19:49 139930931222400
[N...e.
Feb 16 13:19:49 server mysqld[1405]: 2016-02-16 13:19:49 139930931222400
[N...rt
Feb 16 13:19:49 server mysqld[1405]: 2016-02-16 13:19:49 139930931222400
[N...19
Feb 16 13:19:49 server mysqld[1405]: 2016-02-16 13:19:49 139930516817664
[N...ed
Feb 16 13:19:49 server mysqld[1405]: 2016-02-16 13:19:49 139930931222400
[N...d.
Feb 16 13:19:49 server mysqld[1405]: 2016-02-16 13:19:49 139930931222400
[N...'.
Feb 16 13:19:49 server mysqld[1405]: 2016-02-16 13:19:49 139930931222400
[N...s.
Feb 16 13:19:49 server mysqld[1405]: Version: '10.1.11-MariaDB-log'
socket...er
Feb 16 13:19:50 server systemd[1]: `Started MariaDB database server.`
Hint: Some lines were ellipsized, use -l to show in full.
Setup MySQL/MariaDB root user password
Kita harus mengatur passwod untuk akun root kita.
Untuk mengatur password, jalankan perintah berikut :
sudo mysql_secure_installation
Sample output:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, 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): `## Press Enter`
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] `## Press Enter`
New password: `## Enter password`
Re-enter new password: `## Re-enter 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] `## Press 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] `## Press Enter`
... 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] `## 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 MariaDB
installation should now be secure.
Thanks for using MariaDB!
MariaDB has been installed and ready to use.
4. Install PHP
Untuk menginstall PHP di Linux jalankan perintah berikut :
- Manjaro Arch Linux
sudo pacman -S php php-apache
- Ubuntu dan Debian
sudo apt-get install PHP
- Fedora
sudo dnf install PHP
Setelah berhasil install PHP, kita perlu melakukan konfigurasi Apache PHP module.
Untuk melakukannya, edit /etc/httpd/conf/httpd.conf
file,
sudo nano /etc/httpd/conf/httpd.conf
Cari baris berikut :
[...]
#LoadModule mpm_event_module modules/mod_mpm_event.so
[...]
Uncomment baris tersebut sehingga menjadi seperti ini:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
Then, add the following lines at the bottom:
LoadModule php7_module modules/libphp7.so
AddHandler php7-script php
Include conf/extra/php7_module.conf
Save and close the file.
Test PHP
Now create a test.php
file in the Apache root directory.
sudo nano /srv/http/test.php
Add the following lines:
<?php
phpinfo();
Restart httpd service.
sudo systemctl restart httpd
Open up your web browser and navigate to http://ip-address/test.php
. You should the screen like
below.

###5. Install phpMyAdmin
phpMyAdmin is a graphical MySQL/MariaDB administration tool that can be used to create, edit and delete databases.
To install it, run:
sudo pacman -S phpmyadmin
After installing, edit php.ini
file,
sudo nano /etc/php/php.ini
Make sure the following lines are uncommented.
[...]
extension=bz2
extension=mysqli
[...]
Save and close the file.
Next, create configuration file for phpMyAdmin,
sudo nano /etc/httpd/conf/extra/phpmyadmin.conf
Add the following lines:
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
DirectoryIndex index.php
AllowOverride All
Options FollowSymlinks
Require all granted
</Directory>
Then, open Apache configuration file,
sudo nano /etc/httpd/conf/httpd.conf
Add the following line at the end:
Include conf/extra/phpmyadmin.conf
Save and close the file.
Restart httpd service.
sudo systemctl restart httpd
Test phpMyAdmin
Open your browser and navigate to http://IP-Address/phpmyadmin
.

Enter the MySQL/MariaDB root username and it’s password.
Here it is how my phpMyAdmin web console looks like.

You might see an error that says “The configuration file now needs a secret passphrase (blowfish_secret)” at the bottom of phpMyAdmin dashboard.

To get rid of this error, edit /etc/webapps/phpmyadmin/config.inc.php file,
sudo nano /etc/webapps/phpmyadmin/config.inc.php
Find the following line and specify bluefish secret passphrase:
$cfg['blowfish_secret'] = '`MyP@$S`'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH!$ /**
Save and close the file. Restart Apache service.
sudo systemctl restart httpd
The error will be gone now.
That’s all for now. At this stage, you have a working LAMP stack, and is ready to host your websites.
If you want to use Nginx instead of Apache web server, refer the following article.
Baca juga :
Cara Mendapatkan dan Mengetahui User ID Twitter
Cara Membuat Copyright yang Benar untuk Website dan Blog (format copyright)
7 Rekomendasi Font Untuk Design UI Mobile Apps
Cara membuat efek button hover di Figma
6 Playlist Spotify Untuk Teman Bekerja
Tutorial Membuat Horizontal Scrolling Prototype di Figma
Cara memasang design mobile app ke mockup iphone di Figma
Sudikah kau kupinang dengan seperangkat alat generator invoice