LAMP:Shell Script Install LAMP: Difference between revisions

No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
This script will update the system, install Apache, MariaDB, PHP 8.1 and all necessary dependencies. And enable PHP module for Apache and restart both Apache and MariaDB. At the end it will run command php -v to verify the installation.
This script will update the system, install Apache, MariaDB, PHP 8.1 and all necessary dependencies. And enable PHP module for Apache and restart both Apache and MariaDB. At the end it will run command <code>php -v</code> to verify the installation.


Please note that PHP 8.1 is currently not available in the default Ubuntu repository, so you will have to add the PPA repository from Ondřej Surý.
Please note that PHP 8.1 is currently not available in the default Ubuntu repository, so you will have to add the PPA repository from Ondřej Surý.
Line 33: Line 33:
php -v
php -v
</syntaxhighlight>
</syntaxhighlight>
This script will update the system, install Apache, MariaDB, PHP 7.4 and all necessary dependencies. And enable PHP module for Apache and restart both Apache and MariaDB. At the end it will run command <code>php -v</code> to verify the installation.
Please note that this script is for Ubuntu specifically. If you use other distribution of Linux, it may require some modification.
<syntaxhighlight lang="bash" line="1">
#!/bin/bash
# Update system
sudo apt-get update
# Install Apache
sudo apt-get install apache2 -y
# Install MariaDB
sudo apt-get install mariadb-server mariadb-client -y
# Install PHP 7.4 and dependencies
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get update
sudo apt-get install php7.4 php7.4-common php7.4-cli php7.4-fpm php7.4-mysql -y
# Enable PHP module for Apache
sudo a2enmod php7.4
# Restart Apache and MariaDB
sudo service apache2 restart
sudo service mariadb restart
# Verify installation
php -v
</syntaxhighlight>
[[Category:Apache]]
[[Category:Apache]]
[[Category:Linux]]
[[Category:Linux]]