INSTALL LAMP ON RASPBERRY PI

LAMP  is a software bundle OF Linux, Apache, MySQL, PHP  server on a Raspberry Pi which is used for web development.

Install Apache with commands :

sudo apt update && sudo apt upgrade -y

sudo apt install apache2 -y

 Apache is now installed

To check, open a browser enter http://localhost or use your local ip http://<your local ip>

Install PHP on Raspberry Pi

To install PHP on Raspberry Pi, run

sudo apt install php -y

Finally, restart Apache2:

sudo service apache2 restart

To check phpinfo create a file with following text :

cd /var/www/html

sudo nano phpinfo.php

copy & paste following text :

<?php
phpinfo();
?>

Install MySQL (MariaDB Server) on Raspberry Pi

sudo apt install mariadb-server php-mysql -y

sudo service apache2 restart

After installing MySQL (MariaDB Server), it’s recommend to run this command to secure your MySQL installation:

sudo mysql_secure_installation
This should appear in your Terminal window:

  • You will be asked Enter current password for root (type a secure password): press Enter
  • Type in Y and press Enter to Set root password
  • Type in a password at the New password: prompt, and press Enter. Important: remember this root password, as you will need it later
  • Type in Y to Remove anonymous users
  • Type in Y to Disallow root login remotely
  • Type in Y to Remove test database and access to it
  • Type in Y to Reload privilege tables now

When the installation is completed, you’ll see the message: “Thanks for using MariaDB!”.

Install phpMyAdmin on Raspberry Pi

To install phpMyAdmin on a Raspberry Pi, type the following command into the terminal:

cd /var/www/html

sudo apt install phpmyadmin -y

  • Select Apache2 when prompted and press the Enter key
  • Configuring phpmyadminOK
  • Configure database for phpmyadmin with dbconfig-commonYes
  • Type your password and press OK

Enable the PHP MySQLi extension and restart Apache2 for changes to take effect:

sudo phpenmod mysqli
sudo service apache2 restart

 If you experience any error to login into phpMyAdmin,When login to http://localhost/phpmyadmin use following commands :

mysql -u root -p
UPDATE mysql.user SET Password=PASSWORD(‘mypass’) WHERE User=’root’;
FLUSH PRIVILEGES;
Exit

Login to phpmyadmin http://localhost/phpmyadmin with ussername root & password

Leave a Reply

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