<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki42.maceys.net/index.php?action=history&amp;feed=atom&amp;title=Install_LAMP</id>
	<title>Install LAMP - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki42.maceys.net/index.php?action=history&amp;feed=atom&amp;title=Install_LAMP"/>
	<link rel="alternate" type="text/html" href="https://wiki42.maceys.net/index.php?title=Install_LAMP&amp;action=history"/>
	<updated>2026-04-14T06:01:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.3</generator>
	<entry>
		<id>https://wiki42.maceys.net/index.php?title=Install_LAMP&amp;diff=434&amp;oldid=prev</id>
		<title>Lynn: Created page with &quot;LAMP is short for Linux Apache MySQL/MariaDB and PHP. These are the foundations of most web servers.  ==Install Apache== &lt;syntaxhighlight lang=&quot;shell&quot; line&gt; apt update -y &lt;/dev/null apt install apache2 -y &lt;/dev/null a2enmod rewrite a2enmod headers chown -R www-data:www-data /var/www systemctl restart apache2 &lt;/syntaxhighlight&gt;  ==Install MariaDB== &lt;syntaxhighlight lang=shell line&gt; apt install mariadb-server -y &lt;/dev/null systemctl status mariadb echo Done &lt;/syntaxhighlig...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki42.maceys.net/index.php?title=Install_LAMP&amp;diff=434&amp;oldid=prev"/>
		<updated>2026-01-25T23:16:25Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;LAMP is short for Linux Apache MySQL/MariaDB and PHP. These are the foundations of most web servers.  ==Install Apache== &amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot; line&amp;gt; apt update -y &amp;lt;/dev/null apt install apache2 -y &amp;lt;/dev/null a2enmod rewrite a2enmod headers chown -R www-data:www-data /var/www systemctl restart apache2 &amp;lt;/syntaxhighlight&amp;gt;  ==Install MariaDB== &amp;lt;syntaxhighlight lang=shell line&amp;gt; apt install mariadb-server -y &amp;lt;/dev/null systemctl status mariadb echo Done &amp;lt;/syntaxhighlig...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;LAMP is short for Linux Apache MySQL/MariaDB and PHP. These are the foundations of most web servers.&lt;br /&gt;
&lt;br /&gt;
==Install Apache==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot; line&amp;gt;&lt;br /&gt;
apt update -y &amp;lt;/dev/null&lt;br /&gt;
apt install apache2 -y &amp;lt;/dev/null&lt;br /&gt;
a2enmod rewrite&lt;br /&gt;
a2enmod headers&lt;br /&gt;
chown -R www-data:www-data /var/www&lt;br /&gt;
systemctl restart apache2&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install MariaDB==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell line&amp;gt;&lt;br /&gt;
apt install mariadb-server -y &amp;lt;/dev/null&lt;br /&gt;
systemctl status mariadb&lt;br /&gt;
echo Done&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 ● mariadb.service - MariaDB 10.1.47 database server&lt;br /&gt;
    Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)&lt;br /&gt;
    Active: active (running) since Sun 2020-11-08 23:41:31 UTC; 1min 4s ago&lt;br /&gt;
      Docs: man:mysqld(8)&lt;br /&gt;
            https://mariadb.com/kb/en/library/systemd/&lt;br /&gt;
  Main PID: 6324 (mysqld)&lt;br /&gt;
    Status: &amp;quot;Taking your SQL requests now...&amp;quot;&lt;br /&gt;
     Tasks: 27 (limit: 4915)&lt;br /&gt;
    CGroup: /system.slice/mariadb.service&lt;br /&gt;
            └─6324 /usr/sbin/mysqld&lt;br /&gt;
 &lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6357]: performance_schema&lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6357]: Phase 6/7: Checking and upgrading tables&lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6357]: Processing databases&lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6357]: information_schema&lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6357]: performance_schema&lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6357]: Phase 7/7: Running &amp;#039;FLUSH PRIVILEGES&amp;#039;&lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6357]: OK&lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6388]: Checking for insecure root accounts.&lt;br /&gt;
 Nov 08 23:41:31 system /etc/mysql/debian-start[6392]: Triggering myisam-recover for all MyISAM tables and aria-recover f&lt;br /&gt;
 Nov 08 23:41:31 system systemd[1]: Started MariaDB 10.1.47 database server.&lt;br /&gt;
&lt;br /&gt;
To secure MariaDB server as much as possible, run the post installation script. The script will let you continue without adding a password for the MariaDB root user but it is preferred that the standard one be entered.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell&amp;gt;&lt;br /&gt;
mysql_secure_installation&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB&lt;br /&gt;
       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!&lt;br /&gt;
 &lt;br /&gt;
 In order to log into MariaDB to secure it, we&amp;#039;ll need the current&lt;br /&gt;
 password for the root user.  If you&amp;#039;ve just installed MariaDB, and&lt;br /&gt;
 you haven&amp;#039;t set the root password yet, the password will be blank,&lt;br /&gt;
 so you should just press enter here.&lt;br /&gt;
 &lt;br /&gt;
 Enter current password for root (enter for none):&lt;br /&gt;
 OK, successfully used password, moving on...&lt;br /&gt;
 &lt;br /&gt;
 Setting the root password ensures that nobody can log into the MariaDB&lt;br /&gt;
 root user without the proper authorisation.&lt;br /&gt;
 &lt;br /&gt;
 You already have a root password set, so you can safely answer &amp;#039;n&amp;#039;.&lt;br /&gt;
 &lt;br /&gt;
 Change the root password? [Y/n] &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 New password:&lt;br /&gt;
 Re-enter new password:&lt;br /&gt;
 Password updated successfully!&lt;br /&gt;
 Reloading privilege tables..&lt;br /&gt;
  ... Success!&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 By default, a MariaDB installation has an anonymous user, allowing anyone&lt;br /&gt;
 to log into MariaDB without having to have a user account created for&lt;br /&gt;
 them.  This is intended only for testing, and to make the installation&lt;br /&gt;
 go a bit smoother.  You should remove them before moving into a&lt;br /&gt;
 production environment.&lt;br /&gt;
 &lt;br /&gt;
 Remove anonymous users? [Y/n] &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
  ... skipping.&lt;br /&gt;
 &lt;br /&gt;
 Normally, root should only be allowed to connect from &amp;#039;localhost&amp;#039;.  This&lt;br /&gt;
 ensures that someone cannot guess at the root password from the network.&lt;br /&gt;
 &lt;br /&gt;
 Disallow root login remotely? [Y/n] &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
  ... skipping.&lt;br /&gt;
 &lt;br /&gt;
 By default, MariaDB comes with a database named &amp;#039;test&amp;#039; that anyone can&lt;br /&gt;
 access.  This is also intended only for testing, and should be removed&lt;br /&gt;
 before moving into a production environment.&lt;br /&gt;
 &lt;br /&gt;
 Remove test database and access to it? [Y/n] &amp;#039;&amp;#039;&amp;#039;n&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
  ... skipping.&lt;br /&gt;
 &lt;br /&gt;
 Reloading the privilege tables will ensure that all changes made so far&lt;br /&gt;
 will take effect immediately.&lt;br /&gt;
 &lt;br /&gt;
 Reload privilege tables now? [Y/n] &amp;#039;&amp;#039;&amp;#039;y&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
  ... Success!&lt;br /&gt;
 &lt;br /&gt;
 Cleaning up...&lt;br /&gt;
 &lt;br /&gt;
 All done!  If you&amp;#039;ve completed all of the above steps, your MariaDB&lt;br /&gt;
 installation should now be secure.&lt;br /&gt;
 &lt;br /&gt;
 Thanks for using MariaDB!&lt;br /&gt;
 root@system:~#&lt;br /&gt;
&lt;br /&gt;
===Make any changes to the MariaDB configuration.===&lt;br /&gt;
Note that if this is a system that was previously configured, changing the /etc/mysql entry to the symbolic link is all that is required.&lt;br /&gt;
&lt;br /&gt;
Stop the database engine&lt;br /&gt;
 systemctl stop mysql&lt;br /&gt;
&lt;br /&gt;
===Allow Remote Access and Turn on the slow query log===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell line&amp;gt;&lt;br /&gt;
sed -i &amp;#039;s/= 127.0.0.1/= 0.0.0.0/&amp;#039; /etc/mysql/mariadb.conf.d/50-server.cnf&lt;br /&gt;
sed -i &amp;#039;s/#slow_query_log_file/slow_query_log_file/&amp;#039; /etc/mysql/mariadb.conf.d/50-server.cnf&lt;br /&gt;
sed -i &amp;#039;/slow_query_log_file/a slow_query_log         = 1&amp;#039; /etc/mysql/mariadb.conf.d/50-server.cnf&lt;br /&gt;
sed -i &amp;#039;s/#long_query_time        = 10/long_query_time        = 1/&amp;#039; /etc/mysql/mariadb.conf.d/50-server.cnf&lt;br /&gt;
sed -i &amp;#039;s/#log_slow_rate_limit/log_slow_rate_limit/&amp;#039; /etc/mysql/mariadb.conf.d/50-server.cnf&lt;br /&gt;
sed -i &amp;#039;s/#log_slow_verbosity/log_slow_verbosity/&amp;#039; /etc/mysql/mariadb.conf.d/50-server.cnf&lt;br /&gt;
sed -i &amp;#039;s/#log-queries-not-using-indexes/log-queries-not-using-indexes/&amp;#039; /etc/mysql/mariadb.conf.d/50-server.cnf&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Restart the Database Engine===&lt;br /&gt;
 systemctl start mysql&lt;br /&gt;
&lt;br /&gt;
==Install PHP/PHPMyAdmin==&lt;br /&gt;
=== Install ===&lt;br /&gt;
Since phpmyadmin depends upon PHP, installing phpmyadmin covers most of it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell&amp;gt;&lt;br /&gt;
apt install phpmyadmin php-cli php-mbstring php-intl php-pear -y&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The install will open a dialog box and ask a few questions. It will be looking for the MariaDB password and select apache2 as the webserver.&lt;br /&gt;
=== Configure PHP for Production ===&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;sed -i &amp;quot;s|.*upload_max_filesize\s*=.*|upload_max_filesize = 16M|g&amp;quot; /etc/php/7.4/fpm/php.ini&lt;br /&gt;
sed -i &amp;quot;s|.*upload_max_filesize\s*=.*|upload_max_filesize = 16M|g&amp;quot; /etc/my.cnf.d/mariadb-server.cnf&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Allow Login With Root Account ===&lt;br /&gt;
Allow root user to login to the phpmyadmin console&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell line&amp;gt;&lt;br /&gt;
mysql -u root &amp;lt;&amp;lt;EOF&lt;br /&gt;
use mysql;&lt;br /&gt;
update user set plugin=&amp;#039;&amp;#039; where User=&amp;#039;root&amp;#039;;&lt;br /&gt;
flush privileges;&lt;br /&gt;
\q&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install Python==&lt;br /&gt;
Python3 is installed as part of the default Ubuntu 20.04 release but, verify:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell&amp;gt;&lt;br /&gt;
python --version&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
To install if necessary:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell&amp;gt;&lt;br /&gt;
apt install python3&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
The response here will likely be to display that it is version 2. To fix that do the following:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell line&amp;gt;&lt;br /&gt;
cd /usr/bin&lt;br /&gt;
ls -l python*&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If python is not symlink to python version 3.12 do this:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell line&amp;gt;&lt;br /&gt;
rm python&lt;br /&gt;
ln -s python3.12 python&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Install pip==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell line&amp;gt;&lt;br /&gt;
apt install python3-pip -y &amp;lt;/dev/null&lt;br /&gt;
cd /usr/bin&lt;br /&gt;
ln -s pip3 pip&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Configure Apache2/PHP==&lt;br /&gt;
===Apache2===&lt;br /&gt;
Using this tool [https://www.ssllabs.com/ssltest/analyze.html SSL Labs SSL Server Test] should result in an A+ (Whoo Hoo!) rating. The following changes were needed to get past a B+.&lt;br /&gt;
&lt;br /&gt;
Update the /etc/apache2/mods-available/ssl.conf file. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=shell line&amp;gt;&lt;br /&gt;
sed -i &amp;#039;s/SSLCipherSuite HIGH:!aNULL/SSLCipherSuite &amp;quot;EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA RC4 !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS&amp;quot;/&amp;#039; /etc/apache2/mods-available/ssl.conf&lt;br /&gt;
sed -i &amp;#039;s/#SSLHonorCipherOrder/SSLHonorCipherOrder/&amp;#039; /etc/apache2/mods-available/ssl.conf&lt;br /&gt;
sed -i &amp;#039;s/SSLProtocol all -SSLv3/SSLProtocol all -SSLv2 -SSLv3/&amp;#039; /etc/apache2/mods-available/ssl.conf&lt;br /&gt;
sed -i &amp;#039;s/# H2Push/H2Push/g&amp;#039; /etc/apache2/mods-available/http2.conf&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Enable HTTP/2===&lt;br /&gt;
Some of the mod installations may have been done earlier.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot; line&amp;gt;&lt;br /&gt;
 apt install php8.3-fpm -y &amp;lt;/dev/null&lt;br /&gt;
 a2dismod php8.3&lt;br /&gt;
 a2enconf php8.3-fpm&lt;br /&gt;
 a2enmod proxy_fcgi&lt;br /&gt;
 a2dismod mpm_prefork&lt;br /&gt;
 a2enmod mpm_event&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Edit the php8.3-fpm config file to improve performance. The file is: /etc/php/8.3/fpm/pool.d/www.conf. Change dynamic to static and increase the value of pm.max_children to 25.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot; line&amp;gt;&lt;br /&gt;
sed -i &amp;#039;s/pm = dynamic/pm = static/&amp;#039; /etc/php/8.3/fpm/pool.d/www.conf&lt;br /&gt;
sed -i &amp;#039;s/pm.max_children = 5/pm.max_children = 25/&amp;#039; /etc/php/8.3/fpm/pool.d/www.conf&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Change dynamic to static and increase the value of pm.max_children to 25.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot; line&amp;gt;&lt;br /&gt;
a2enmod http2&lt;br /&gt;
systemctl restart apache2&lt;br /&gt;
systemctl start php8.3-fpm&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Note- The php.ini file will not be read by simply restarting apache&lt;br /&gt;
&lt;br /&gt;
Since we are using certificates provided by Cloudflare, the SSL sections of the sites files should be commented out or removed.&lt;br /&gt;
&lt;br /&gt;
===Performance Improvements===&lt;br /&gt;
====Install memcached====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot; line&amp;gt;&lt;br /&gt;
apt install memcached libmemcached-tools -y &amp;lt; /dev/null&lt;br /&gt;
systemctl status memcached&lt;br /&gt;
apt install php-memcached -y &amp;lt;/dev/null&lt;br /&gt;
pip install pymemcache&lt;br /&gt;
pip install python-memcached&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Test Functionality==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;shell&amp;quot; line&amp;gt;&lt;br /&gt;
echo &amp;#039;&amp;lt;?php&amp;#039; &amp;gt; /var/www/html/phpinfo.php&lt;br /&gt;
echo &amp;#039;    phpinfo( );&amp;#039; &amp;gt;&amp;gt; /var/www/html/phpinfo.php&lt;br /&gt;
echo &amp;#039;?&amp;gt;&amp;#039; &amp;gt;&amp;gt; /var/www/html/phpinfo.php&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open browser to http://192.168.86.1/phpinfo.php&lt;br /&gt;
&lt;br /&gt;
====Install Thumbor====&lt;br /&gt;
Thumbor is a self hosted CDN the resizes images on the fly.&lt;br /&gt;
&lt;br /&gt;
[[ Install Mediawiki]]&lt;br /&gt;
&lt;br /&gt;
[[Allowing Access]]&lt;br /&gt;
&lt;br /&gt;
[[Configure Backend]]&lt;/div&gt;</summary>
		<author><name>Lynn</name></author>
	</entry>
</feed>