Install Apache

First, update your package manager.

sudo apt-get update -y
sudo apt-get upgrade -y

Install and start Apache.

sudo apt-get install apache2 -y
sudo systemctl start apache2.service

Verify that Apache was installed without errors by accessing it from your local browser. Enter hostname -I to obtain your IP address for the server and navigate to http://SERVER_IP/. You will see the default Apache2 page.

Install MySQL

Install the MariaDB database server (a fork of MySQL).

sudo apt-get install mysql-server -y

Then, run the mysql_secure_installation.

sudo mysql_secure_installation

You will be asked to set a password, followed by some other questions. Enter a secure password and then press ENTER to select the defaults.

Install PHP

First, install PHP.

sudo apt-get install php -y

Then install common PHP extensions such as gdmysql and so forth.

sudo apt-get install php-{bcmath,bz2,intl,gd,mbstring,mysql,zip,fpm} -y

Starting Apache and MySQL on boot

This is necessary to start your web environment on boot.

sudo systemctl enable apache2.service
sudo systemctl enable mysql.service

Finally, restart Apache to allow PHP to run.

systemctl restart apache2.service

Conclusion

Congratulations, you've successfully installed a LAMP stack on your Ubuntu 18.04 VPS.

Esta resposta foi útil? 0 Utilizadores acharam útil (0 Votos)