HOWTO: Install LAMP Stack (On Raspbian Stretch June 2018)
HOWTO: Install LAMP Stack (On Raspbian Stretch June 2018)
Search
Login
Register
12 posts • Page 1 of 1
procount
Posts: 1652
Joined: Thu Jun 27 , 2013 12:32 pm
Location: UK
HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 1/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
I needed to install a LAMP stack (Linux Apache My SQL PHP) for a student to run a project on.
I found it a little tricky since v ersions had changed since I last did this, but finally I found this tutorial that worked:
https://pchelp.ricmedia.com/setup-lamp- ... y -guide/3/ (https://pchelp.ricmedia.com/setup-lamp-serv er-raspberry -pi-3-complete-diy -guide/3/) (starting on page 3,
since I already had Raspbian installed)
I adv ise following the abov e tutorial for completeness as it includes an additional step, but for a quick summary and [tl;dr]:
Code:
#Update system
sudo apt-get update
sudo apt-get upgrade -y
#Install Apache2
sudo apt-get install apache2 -y
sudo a2enmod rewrite
sudo service apache2 restart
#Install PHP
sudo apt-get install php libapache2-mod-php -y
#Install MySQL
sudo apt-get install mysql-server php-mysql -y
sudo service apache2 restart
#Install PhpMyAdmin
sudo apt-get install phpmyadmin -y
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 2/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
I found a few additional setup commands were needed to get it to work which are detailed below:
Out of the box, my sql has no root password, but unlike prev ious v ersions, this v ersion of My SQL with MariaDB won't work with an emtpy root password unless it is used
with sudo.
Here is one way to rev ert this behav iour:
Code:
Likewise, phpmy admin won't allow access with an empty password by default.
To allow passordless access, uncomment the lines in /etc/phpmy admin/config.inc.php where 'AllowNoPassword' is mentioned.
But y ou should be using a proper password.
Finally , the installation did not properly configure apache to use phpmy admin conf files, so I added a couple of sy mlinks as follows:
Code:
cd /etc/apache2/conf-available
sudo ln -s ../../phpmyadmin/apache.conf phpmyadmin.conf
cd /etc/apache2/conf-enabled
sudo ln -s ../conf-available/phpmyadmin.conf phpmyadmin.conf
sudo service apache2 restart
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 3/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
Pointing y our browser at http://127 .0.0.1/phpmy admin (http://127 .0.0.1/phpmy admin) should then giv e access to the phpmy admin tool
fbe
Posts: 47 0
Joined: Thu Aug 17 , 2017 9:08 pm
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
Finally , the installation did not properly configure apache to use phpmy admin conf files, so I added a couple of sy mlinks as follows:
During installation of phpmy admin y ou are asked to select a webserv er. Use the up/down key to select a webserv er, use the space key to enable or disable the
configuration.
Don't change the order of statements. Y ou must install phpmy admin (and I suppose other debian packages too, that need to install a database) before y ou mess up y our
root account. If y ou first make y our my sql installation secure and later decide to use phpmy admin, y ou are on y our own.
fy lloxera
Posts: 2
Joined: Sat Dec 26, 2015 9:46 pm
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 4/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
Finally , the installation did not properly configure apache to use phpmy admin conf files, so I added a couple of sy mlinks as follows:
Please post the the sy mlinks, they are not v isible on the site. Thank y ou
procount
Posts: 1652
Joined: Thu Jun 27 , 2013 12:32 pm
Location: UK
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
Well, @fbe suggested I missed something out, so if y ou follow their adv ice, y ou may not need the sy mlinks.
Howev er, if y ou want to follow my original steps, I included the instructions to create the sy mlinks in the code block, which I repeat below. Just open a terminal and ty pe
the following in:
Code:
cd /etc/apache2/conf-available
sudo ln -s ../../phpmyadmin/apache.conf phpmyadmin.conf
cd /etc/apache2/conf-enabled
sudo ln -s ../conf-available/phpmyadmin.conf phpmyadmin.conf
sudo service apache2 restart
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 5/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
m0j01
Posts: 1
Joined: Sat Dec 01, 2018 9:48 am
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
Y o, thank y ou for the post. It is nice to be able to create tables in phpmy admin.
U-Rock
eMEsut
Posts: 4
Joined: Wed Apr 17 , 2019 2:12 pm
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
I got some errors with sy mlinks, but i can login phpmy admin with root user, before i tried other tutorials but i couldn't login with root and couldn't create database
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 6/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
AndieB
Posts: 3
Joined: Mon Jul 18, 2016 12:37 pm
Location: Sweden
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
Hi,
thank y ou for a great and simple HOWTO guide to hav e LAMP on Raspberry Pi.
Thanks!
~AndieB
procount
Posts: 1652
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 7/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
Last edited by procount on Thu Apr 25, 2019 10:42 am, edited 1 time in total.
PINN - NOOBS with the extras... https://www.raspberrypi.org/forum s/viewtopic.php?f=63&t=142574
procount
Posts: 1652
Joined: Thu Jun 27 , 2013 12:32 pm
Location: UK
Re: HOWTO: Install LAMP stack (on Raspbian Stretch April 2019) Quote
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 8/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
I needed to install a LAMP stack (Linux Apache My SQL PHP) for a student to run a project on.
I found it a little tricky since v ersions had changed since I last did this, but finally I found this tutorial that worked:
https://pchelp.ricmedia.com/setup-lamp- ... y -guide/3/ (https://pchelp.ricmedia.com/setup-lamp-serv er-raspberry -pi-3-complete-diy -guide/3/) (starting on page 3,
since I already had Raspbian installed)
This installed:
Apache2
PHP 7 .0.33-0+deb9u3 (cli) (built: Mar 8 2019 10:01:24) ( NTS )
my sql Ver 15.1 Distrib 10.1.37 -MariaDB, for debian-linux-gnueabihf (armv 8l) using readline 5.2
I adv ise following the abov e tutorial for completeness as it includes an additional step, but for a quick summary and [tl;dr]:
Code:
#Update system
sudo apt-get update
sudo apt-get upgrade -y
#Install Apache2
sudo apt-get install apache2 -y
sudo a2enmod rewrite
sudo systemctl apache2 restart
#Install PHP
sudo apt-get install php libapache2-mod-php -y
#Install MySQL
sudo apt-get install mysql-server php-mysql -y
sudo systemctl apache2 restart
#Install PhpMyAdmin
sudo apt-get install phpmyadmin -y
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 9/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
During the installation of phpmy admin, it will ask y ou to choose a webserv er. Y ou should choose Apache 2.
There will be a little red square on this selection already , but this is just the cursor; it does not mean it has already been selected! So press the space bar to select Apache2
befpore continuing.
I found a few additional setup commands were needed to get it to work which are detailed below:
Out of the box, my sql has no root password, but unlike prev ious v ersions, this v ersion of My SQL with MariaDB won't work with an emtpy root password unless it is used
with sudo.
Here is one way to rev ert this behav iour:
Code:
Likewise, phpmy admin won't allow access with an empty password by default.
To allow passordless access, uncomment the lines in /etc/phpmy admin/config.inc.php where 'AllowNoPassword' is mentioned.
But y ou should be using a proper password.
(So hav ing now properly selected the Apache2 webserv er when installing phpmy admin, there is no need to mess with the sy mlinks as in the prev ious tutorial as these will
be created correctly .)
Pointing y our browser at http://127 .0.0.1/phpmy admin (http://127 .0.0.1/phpmy admin) should then giv e access to the phpmy admin tool
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 10/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
DarkPlatinum
Posts: 829
Joined: Thu Nov 02, 2017 2:30 pm
Location: Unknown
Contact: Website
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
fbe
Posts: 47 0
Joined: Thu Aug 17 , 2017 9:08 pm
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
It "works". But y ou should be aware that uses the my sql root user to run wordpress, it writes the my sql root password into wp-config.php and leav es it readable for
any one who can login to the serv er and it giv es the webserv er write access to the document root.
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 11/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
The my sql_secure_installation is useless in that tutorial, though it doesn't hurt. The "GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY
'Y OURPASSWORD';" statement doesn't grant any priv ilege ('root'@'localhost' already has all priv ileges) but does what the my sql_secure_installation was supposed to do -
it enables password authentication and sets the password for root (the IDENTIFIED BY clause does it). The "FLUSH PRIVILEGES" is useless.
If y ou want to do something serious, almost ev ery thing beginning with "Download WordPress" is wrong.
Andy roo
Posts: 3502
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.
Re: HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) Quote
It "works". But y ou should be aware that uses the my sql root user to run wordpress, it writes the my sql root password into wp-config.php and leav es it readable for
any one who can login to the serv er and it giv es the webserv er write access to the document root.
...
I do not know where this idea has come from. I was alway s taught that each application has minimal access to ANY THING with only sufficient to do the job they need
(role based authentication). Giv en it’s only a few seconds extra work to create a user specifically for WP and giv e access only to the WP database I wish that would become
the standard document.
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 12/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
This should be qualified in that the ‘flush’ is not needed in this case as the internal security routines capture and apply changes when done with GRANT as here. It’s only
needed when the security tables are updated directly with update / insert / delete.
As for the final statement WP still has a major following BUT is rapidly showing its age and ev en Gutenberg is a last minute gasp to win back users who are seeing ‘drag-
and-drop’ tools dev eloping sites that look better. Too many add-ins are not updated, clash or hav e security weaknesses that it’s a concern to mov e any site from v ersion
to v ersion and the whole idea of auto-updating the base of a multi-user site may well sit fine with WP teams but giv es me nightmares as I cannot test it before rolling it out.
The other worry in the majority of installs is no thought is giv en to security of the box - ev en a simple firewall rule should be included AS A MINIMUM with Fail2Ban etc
added.
Sort by
Post time
Ascending
Go
Post Reply
12 posts • Page 1 of 1
Jump to
Board index
All times are UTC
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 13/14
30/7/2019 HOWTO: Install LAMP stack (on Raspbian Stretch June 2018) - Raspberry Pi Forums
ABOUT US SUPPORT
About us Help
Our team Documentation
Governance Projects
Safeguarding Training
Our supporters Downloads
Jobs Research
Contact us FAQ
SUBSCRIBE
RASPBERRY PI FOUNDATION
UK REGISTERED CHARITY 1129409
https://www.raspberrypi.org/forums/viewtopic.php?t=218354 14/14