EasyCoding Short Tutorial: Webserver Setup (LAMP Stack)

in #php6 years ago

In this tutorial we will setup a Apache2 Webserver with PHP and MySQL.

Start by running “sudo apt-get update" to update your package list, followed by "sudo apt-get install apache2” to install apache2 in the terminal. Then open up your browser and visit localhost:80. It should display a page that says "It works!". Congrats! You just got yourself a basic webserver. The LA of LAMP.

Now, with a basic apache2 server setup, we can install PHP and MySQL.

To install MySQL, you run the following command: “sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql”. During the installation you will be asked to set a root password for MySQL. Unless you intend to use the system for production or a live site with real users you can use the defaults.

After the installation is done you need to activate MySQL with the following two commands. “sudo mysql_install_db” and “sudo /usr/bin/mysql_secure_installation”.

The latter will ask for your previously set MySQL root password. Type it in. In the following prompts you can just answer yes to anything.

We’re done with MySQL, the M in LAMP. Now we’ll install PHP.

Run “sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-mysql”, wait for it to finish and you’re done. Restart apache2 using “sudo apache2 restart” and you got a fully working LAMP server setup.

Any questions? Send me a message or leave a comment.

Coin Marketplace

STEEM 0.30
TRX 0.11
JST 0.033
BTC 64320.07
ETH 3154.23
USDT 1.00
SBD 4.34