LAMP Stack for PI: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(21 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
<source lang="bash"> | <source lang="bash"> | ||
apt install apache2/stable | apt install apache2/stable | ||
CKI_A2_SERVER_NAME_FIND='#ServerName www.example.com';\ | |||
CKI_A2_SERVER_NAME_FILL='ServerName web.bgd.chorke.org';\ | |||
CKI_A2_SERVER_ADMN_FIND='ServerAdmin webmaster@localhost';\ | |||
CKI_A2_SERVER_ADMN_FILL='ServerAdmin [email protected]';\ | |||
systemctl reload apache2 | CKI_A2_DFAULT_SITE_CONF='/etc/apache2/sites-enabled/000-default.conf';\ | ||
sed -i "s|$CKI_A2_SERVER_NAME_FIND|$CKI_A2_SERVER_NAME_FILL|" "$CKI_A2_DFAULT_SITE_CONF";\ | |||
sed -i "s|$CKI_A2_SERVER_ADMN_FIND|$CKI_A2_SERVER_ADMN_FILL|" "$CKI_A2_DFAULT_SITE_CONF";\ | |||
systemctl reload apache2;\ | |||
apachectl -t | apachectl -t | ||
</source> | </source> | ||
Line 16: | Line 19: | ||
===PHP=== | ===PHP=== | ||
<source lang="bash"> | <source lang="bash"> | ||
apt install | apt install php7.3-fpm/stable libapache2-mod-php7.3/stable | ||
a2enmod proxy_fcgi setenvif | a2enmod proxy_fcgi setenvif | ||
a2enconf php7.3-fpm | a2enconf php7.3-fpm | ||
a2enmod php7.3 | |||
systemctl restart apache2 | systemctl restart apache2 | ||
</source> | </source> | ||
Line 26: | Line 28: | ||
===MySQL=== | ===MySQL=== | ||
<source lang="bash"> | <source lang="bash"> | ||
apt install mariadb-server-10.3/stable | |||
apt install phpmyadmin/stable | apt install phpmyadmin/stable | ||
sed -i "s/|\s*\((count(\$analyzed_sql_results\['select_expr'\]\)/| (\1)/g" /usr/share/phpmyadmin/libraries/sql.lib.php | sed -i "s/|\s*\((count(\$analyzed_sql_results\['select_expr'\]\)/| (\1)/g" /usr/share/phpmyadmin/libraries/sql.lib.php | ||
systemctl restart apache2 | systemctl restart apache2 | ||
</source> | </source> | ||
<source lang="sql"> | |||
CREATE SCHEMA IF NOT EXISTS chorke_boot_dev; | |||
CREATE USER 'chorke_boot_dev'@'%' IDENTIFIED BY 'chorke_boot_dev'; | |||
GRANT ALL PRIVILEGES ON chorke_boot_dev.* TO 'chorke_boot_dev'@'%'; | |||
DROP USER 'chorke_boot_dev'@'%' | |||
</source> | |||
==Remote== | |||
<code>nano /etc/mysql/mariadb.conf.d/50-server.cnf </code> | |||
<source lang="ini" start="26" line> | |||
# Instead of skip-networking the default is now to listen only on | |||
# localhost which is more compatible and is not less secure. | |||
bind-address = 127.0.0.1 | |||
</source> | |||
<source lang="bash"> | |||
systemctl restart mysql | |||
update-rc.d mysql disable | |||
</source> | |||
==Sequence== | |||
<source lang="sql"> | |||
CREATE SEQUENCE policy_1000 | |||
START WITH 46656 -- 1,000 | |||
MINVALUE 46656 -- 1,000 | |||
MAXVALUE 1679615 -- Z,ZZZ | |||
INCREMENT BY 1 | |||
CACHE 10 NOCYCLE ENGINE=InnoDB | |||
</source> | |||
==Knowledge== | |||
<source lang="sql"> | |||
SELECT user, plugin, host FROM mysql.user WHERE user = 'root'; | |||
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'p@$$w0rd'; | |||
UPDATE mysql.user SET plugin = 'mysql_native_password', authentication_string = PASSWORD('p@$$w0rd') WHERE User = 'root'; | |||
</source> | |||
==References== | |||
* [https://devanswers.co/phpmyadmin-access-denied-for-user-root-localhost/ Access denied for user <code>root@localhost</code>] | |||
* [https://mariadb.com/kb/en/sequence-overview/ MariaDB Sequence Overview] | |||
* [[Apache/Multilang Errordoc]] | |||
* [[Apache/AutoIndex]] | |||
* [[Apache/Proxy]] |
Latest revision as of 21:00, 23 January 2021
A LAMP stack is a group of open-source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP.
Install
Apache
apt install apache2/stable
CKI_A2_SERVER_NAME_FIND='#ServerName www.example.com';\
CKI_A2_SERVER_NAME_FILL='ServerName web.bgd.chorke.org';\
CKI_A2_SERVER_ADMN_FIND='ServerAdmin webmaster@localhost';\
CKI_A2_SERVER_ADMN_FILL='ServerAdmin [email protected]';\
CKI_A2_DFAULT_SITE_CONF='/etc/apache2/sites-enabled/000-default.conf';\
sed -i "s|$CKI_A2_SERVER_NAME_FIND|$CKI_A2_SERVER_NAME_FILL|" "$CKI_A2_DFAULT_SITE_CONF";\
sed -i "s|$CKI_A2_SERVER_ADMN_FIND|$CKI_A2_SERVER_ADMN_FILL|" "$CKI_A2_DFAULT_SITE_CONF";\
systemctl reload apache2;\
apachectl -t
PHP
apt install php7.3-fpm/stable libapache2-mod-php7.3/stable
a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm
a2enmod php7.3
systemctl restart apache2
MySQL
apt install mariadb-server-10.3/stable
apt install phpmyadmin/stable
sed -i "s/|\s*\((count(\$analyzed_sql_results\['select_expr'\]\)/| (\1)/g" /usr/share/phpmyadmin/libraries/sql.lib.php
systemctl restart apache2
CREATE SCHEMA IF NOT EXISTS chorke_boot_dev;
CREATE USER 'chorke_boot_dev'@'%' IDENTIFIED BY 'chorke_boot_dev';
GRANT ALL PRIVILEGES ON chorke_boot_dev.* TO 'chorke_boot_dev'@'%';
DROP USER 'chorke_boot_dev'@'%'
Remote
nano /etc/mysql/mariadb.conf.d/50-server.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
systemctl restart mysql
update-rc.d mysql disable
Sequence
CREATE SEQUENCE policy_1000
START WITH 46656 -- 1,000
MINVALUE 46656 -- 1,000
MAXVALUE 1679615 -- Z,ZZZ
INCREMENT BY 1
CACHE 10 NOCYCLE ENGINE=InnoDB
Knowledge
SELECT user, plugin, host FROM mysql.user WHERE user = 'root';
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'p@$$w0rd';
UPDATE mysql.user SET plugin = 'mysql_native_password', authentication_string = PASSWORD('p@$$w0rd') WHERE User = 'root';