What is LAMP Stack?
LAMP (Linux Apache MySQL PHP) consists of the Linux operating system as a development environment, the Apache HTTP Server as web server, the MySQL relational database management system (RDBMS) as DB (DataBase) system, and the PHP programming language as Server-side (Back End) programming language.
LAMP is used as an Open Source stack of technologies solution to the web development area. Windows version of this stack is called WAMP (Windows Apache MySQL PHP)
Installing LAMP on Arch Linux
With this line we will install all the necessary packages in one step, and the last update:
pacman -Syu apache php php-apache mariadb
HTTP
Edit /etc/httpd/conf/httpd.conf Change ServerAdmin you@example.com as you need.
The folder of the WEB Pages by default is ServerRoot “/etc/httpd”. Directory must be set to the same folder, so change the line
<Directory "/etc/httpd">
This folder must have read and execution access, so
chmod o+x /etc/httpd
Change AllowOverride from none (default) to All so .htaccess will works
Now you need the ~/public_html folder for each user. (to get the root page of each user as http://localhost/~yourusername/. Unremark this line:
Include conf/extra/httpd-userdir.conf
Now as root you need to create the ~/public_html for each user and change the access to (755) of each one.
chmod 755 /home chmod 755 /home/username chmod 755 /home/username/public_html
You can comment out this line if you want to use SSL:
LoadModule ssl_module modules/mod_ssl.so
If you need to use virtual domains, uncomment the line:
Include conf/extra/httpd-vhosts.conf
and in /etc/httpd/conf/extra/httpd-vhosts.conf you must to add all the virtual domains. (plus into /etc/hosts if you want to test those virtuals domains)
Edit /etc/httpd/conf/extra/httpd-default.conf and change ServerSignature to Off and ServerToken to Prod for hiding critical data
PHP
Edit: /etc/httpd/conf/httpd.conf
Comment out: LoadModule mpm_event_module modules/mod_mpm_event.so Uncomment: LoadModule mpm_prefork_module modules/mod_mpm_prefork.so As last item in the LoadModule list, add LoadModule php7_module modules/libphp7.so As last item in the include list, add Include conf/extra/php7_module.conf Edit /etc/php/php.ini Uncomment extension=mysqli.so and extension=pdo_mysql.so
Change the timezone as you need, for example:
date.timezone = America/Argentina/Buenos_Aires, date.default_latitude = 0.0, date.default_longitude = 0.0
MySQL
Run as root:
mysql_install_db –user=mysql –basedir=/usr –datadir=/var/lib/mysql
Now you have the root of the MySQL Server.
Start MySQL daemon:
systemctl enable mysqld systemctl start mysqld
At last, run:
sh /usr/bin/mysql_secure_installation
That all to get a web server ready to be customized as you need.