WebServer - Basic LAMP Stack Install

From Da Nerd Mage Wiki
Revision as of 22:16, 13 January 2022 by Tinker (talk | contribs)
Jump to navigation Jump to search
Proven on:
Logo Mint.png
Logo LMDE.png
Logo Debian.png
Logo Sparky.png
Logo Ubuntu.png
19.3 / 20.3 4 11 (bullseye) 5.11 20.04.3

Install the LAMP Stack

Install the packages

  • sudo apt install apache2 libapache2-mod-php php-xml php-mbstring php-apcu php-intl imagemagick inkscape php-gd php-cli php-cgi php mysql-server mysql-client php-mysql
    • Say Yes to Continue
    • Configuring mysql-community-server (Doesn't happen on Mint but DOES happen on LMDE)
      • Pick a good root password...
      • I tend to select Use Legacy Authentication Method because Use Strong Password Encryption is annoying as hell. (Your choice here...)

Now Do A Backup!

Configure MySQL

  • sudo mysql_secure_installation
    • Would you like to setup VALIDATE PASSWORD component?
      • I select No (because I'd rather manage my own password policies, thanks...)
    • root password
      • Please set the password for root here.
        • Pick a good root password...
    • or... (depends on install...)
      • Using existing password for root.
        • Say No (Which actually means yes... The question being asked is "Change the password for root?")
    • Remove anonymous users?
      • Duh... Yes
    • Disallow root login remotely?
      • Your choice, but I tend to say No.
    • Remove test database and access to it?
      • Duh... Yes again.
    • Reload privilege tables now?
      • Yes
  • (Extra Instructions if you've never configured MySQL before)

& Test it

  • sudo vi /var/www/html/info.php
<?php
phpinfo();
?>

Browse to http://ServerAddress/ & you should see the default page.

Browse to http://ServerAddress/info.php & you should see a whole bunch of info about your PHP subsystem.

Notice that those 2 addresses are HTTP, and NOT HTTPS. This is important and Chrome will mess with you.

Now Do A Backup!

Set up at least one user in mysql

  • sudo mysql -u root -p
CREATE USER 'USERNAME'@'localhost' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
EXIT;

(Hint: This'd be a good time to create yourself as that user with your non-admin password of choice...)

Now Do A Backup!