Difference between revisions of "WebServer - Basic LAMP Stack Install"

From The TinkerNet Wiki
Jump to navigation Jump to search
(Undo revision 1423 by Grant (talk))
Tag: Undo
Line 1: Line 1:
This part stolen fair and square from Tinkernet Wiki... https://wiki.tinkernet.ca
 
 
 
*Proven on Mint 19.3 ... (Seems to get MySQL 5.7)
 
*Proven on Mint 19.3 ... (Seems to get MySQL 5.7)
 
*Proven on Mint 20 ... (Gets MySQL 8.0)
 
*Proven on Mint 20 ... (Gets MySQL 8.0)
 +
*Proven on SparkyLinux 5.11 ... (You'll have to [https://tecadmin.net/install-mysql-server-on-debian9-stretch/ fix the missing MySQL] thing & install vim first)
 +
**[[Getting MySQL onto SparkyLinux]]
  
 
===Install the LAMP Stack===
 
===Install the LAMP Stack===
 +
<span style="color:#c0392b">'''Note:'''  On Mint 19.3, this installs php 7.2.24. On Mint 20, this installs php 7.4.3.  This ''MIGHT'' be an important point to keep in mind for later...</span>
 +
 +
If you expect to need php newer than 7.2.24 on a Mint 19.3 server, force it to upgrade before you move on to installing the packages:
 +
 +
*<code>sudo add-apt-repository ppa:ondrej/php # Press enter to confirm.</code>
 +
*<code>sudo apt update</code>
 +
*<code>sudo apt upgrade</code>
 +
*<code>php -v</code>
 +
 +
(Verify that it's showing a suitable version of php. I'm seeing 7.4.10 in testing...)
 +
 
====Install the packages====
 
====Install the packages====
  
 
*<code>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</code>
 
*<code>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</code>
 
**Say Yes to Continue
 
**Say Yes to Continue
 +
**<u>Configuring mysql-community-server</u> (Doesn't happen on Mint)
 +
***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...)
  
 
====Configure MySQL====
 
====Configure MySQL====
Line 29: Line 43:
 
**<u>Reload privilege tables now?</u>
 
**<u>Reload privilege tables now?</u>
 
***Yes
 
***Yes
 +
*([[WebServer - MySQL Notes|Extra Instructions if you've never configured MySQL before]])
  
 
====& Test it====
 
====& Test it====
Line 49: Line 64:
 
  EXIT;
 
  EXIT;
 
('''Hint:'''  This'd be a good time to create yourself as that user with your non-admin password of choice...)
 
('''Hint:'''  This'd be a good time to create yourself as that user with your non-admin password of choice...)
 
 
Now. go back to the list... [[WEB_SERVER_FROM_A_TO_Z]]
 

Revision as of 23:19, 30 January 2021

Install the LAMP Stack

Note: On Mint 19.3, this installs php 7.2.24. On Mint 20, this installs php 7.4.3. This MIGHT be an important point to keep in mind for later...

If you expect to need php newer than 7.2.24 on a Mint 19.3 server, force it to upgrade before you move on to installing the packages:

  • sudo add-apt-repository ppa:ondrej/php # Press enter to confirm.
  • sudo apt update
  • sudo apt upgrade
  • php -v

(Verify that it's showing a suitable version of php. I'm seeing 7.4.10 in testing...)

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)
      • 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...)

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
    • 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.

Set up at least one user in mysql

  • sudo mysql -u root -p
CREATE USER 'someone'@'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...)