Install Lamp stack
sudo apt install tasksel
sudo tasksel install lamp-server
MySQL
Log in to MySQL’s SQL shell:
sudo mysql -u root
About MySQL authentication By default, MySQL is configured to use the auth_socket authorization plugin. This authorization …
Create a database and a user with permissions for it. In this example, the database is called webdata, the user webuser, and password password. Be sure to enter your own password. This should be different from the root password for MySQL:
- CREATE DATABASE webdata;
- CREATE USER 'webuser' IDENTIFIED BY 'password';
- GRANT ALL ON webdata.* TO 'webuser';
Exit the SQL shell:
quit
Install Packages Separately
If you prefer not to install the bundled packages via Tasksel, you can instead install them separately:
Install Apache 2.4 from the Ubuntu repository:
sudo apt install apache2
Install the mysql-server package:
sudo apt install mysql-server
Install PHP, the PHP Extension and Application Repository, Apache support, and MySQL support:
sudo apt install php libapache2-mod-php php-mysql
Optionally, install additional cURL, JSON, and CGI support:
sudo apt install php-curl php-json php-cgi
Use the mysql_secure_installation tool to configure additional security options. This tool will ask if you want to set a new password for the MySQL root user, but you can skip that step:
sudo mysql_secure_installation
Answer Y at the following prompts:
- Remove anonymous users?
- Disallow root login remotely?
- Remove test database and access to it?
- Reload privilege tables now?