Install Apache - Mariadb - PHP (Lamp) Stack On Arch Linux 2016 - Ostechnix
Install Apache - Mariadb - PHP (Lamp) Stack On Arch Linux 2016 - Ostechnix
Home Open Source Technology Linux Unix Free Videos and EBooks Donate
Linux 2016
BY SK · FEBRUARY 16, 2016 FREE EBOOK OF THE WEEK
This tutorial walk you through installing and configuring Apache, MySQL, PHP (LAMP) stack on Arch Linux 2016. SHARE
As you probably know, LAMP is the the acronym of Linux, Apache, MySQL/MariaDB, PHP/Perl/Pyhton. For the
purpose of this article, I will be using the following test machine.
pacman -Syu
2. Install Apache
After updating the system, install Apache web server using command:
pacman -S apache
nano /etc/httpd/conf/httpd.conf
[...]
#LoadModule unique_id_module modules/mod_unique_id.so
[...]
Enable Apache service to start at boot and restart Apache service using commands:
Sample output:
Test Apache
Let us create a sample page in the Apache root directory , i.e /srv/http.
nano /srv/http/index.html
Now, open your web browser and navigate to http://localhost or http://IP-address. You will be pleased with
Apache server Test page.
3. Install MariaDB
Run the following command to install MariaDB:
pacman -S mysql
As you may know, MariaDB is now officially the default implementation of MySQL in Arch Linux since 2013. So,
you will be asked whether to install MariaDB or Percona server, just hit enter and then type “Y” and press enter
again. The default selection i.e MariaDB will be installed on your Arch Linux.
resolving dependencies...
looking for conflicting packages...
resolving dependencies...
looking for conflicting packages...
You need to initialize the MariaDB data directory prior to starting the service. To do so, run:
Then issue the following command to enable and start MariaDB service.
Sample output:
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.
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.
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
4. Install PHP
To install PHP in Arch Linux, run:
nano /etc/httpd/conf/httpd.conf
[...]
#LoadModule mpm_event_module modules/mod_mpm_event.so
[...]
[...]
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
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.
nano /srv/http/test.php
<?php
phpinfo();
?>
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.
nano /etc/php/php.ini
[...]
extension=bz2.so
extension=mcrypt.so
extension=mysqli.so
[...]
nano /etc/httpd/conf/extra/phpmyadmin.conf
nano /etc/httpd/conf/httpd.conf
Include conf/extra/phpmyadmin.conf
Test phpMyAdmin
Open your browser and navigate to http://IP-Address/phpmyadmin. You should see the following like
screen. Enter the MySQL/MariaDB root username and it’s password.
nano /etc/webapps/phpmyadmin/config.inc.php
/**
Here Welc0me1 is my secret passphrase. Save and close the file. Restart Apache service.
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.
Installing and configuring Nginx, MySQL, PHP (LEMP) stack on Arch Linux 2016
If you find this tutorial helpful, please share it on your social networks and support us.
Cheers!!
Share this:
Tags: Apache Apache HTTP Server Arch Linux 2016 LAMP Stack MariaDB PHP
How to fix “unable to lock database” error in Arch linux Install MATE Desktop in FreeBSD 10.2
30 RESPONSES
Comments 30 Pingbacks 0
Thanks!
Reply
If you run into missing msqli when testing your phpmyadmin, try checking your php.ini (“`sudo nano /etc/php/php.ini “`) for
extension=msqli
ERROR: Unauthorized
While trying to retrieve the URL http://localhost/:
There is a loop in network for HTTP traffic. Check your network topology and proxy & firewall configuration
Your cache administrator is webmaster.
Thank you very much for the tutorial, but there are a few things that are needed to change in it.
1. No need to install php-mcrypt anymore (since php 7.1 I think). After all, it can’t be installed via pacman -S php-mcrypt
2. blowfish_secret passcode is to short, but google for some blowfish generators, they do the job OK.
3. Configuring of tmp folder. Add ” $cfg[‘TempDir’] = ‘ /tmp/phpmyadmin’; ” (remove double quotes) to the end of the
/etc/webapps/phpmyadmin/config.inc.php file.
Reply
LEAVE A REPLY
Comment
Name * Email *
Website
Post Comment
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Select Month
About
Subscribe to our mailing list
Contact Us
Donate
Sign Up Now
Privacy Policy
We respect your privacy
OSTechNix © 2019. All Rights Reserved.
This site is licensed under CC BY-NC 4.0.