Knowledgebase
Sarail Net > Support Ticket > Knowledgebase

Search help:


How to Install Apache, MySQL and PHP on Ubuntu 16.04

Solution

Step 1: Install Apache

First, update your package manager.

sudo apt-get update -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/.

Step 2: Install MySQL

Enter the following into the shell prompt.

sudo apt-get install mysql-server -y

This will install the MariaDB database server (a fork of MySQL). You will be asked to enter a password for the MySQL root user, so go ahead and do that.

Then, run sudo /usr/bin/mysql_secure_installation. Press "y".

Depending on the level of security, you'll have the option to adjust the password complexity. For now, we'll be using the strong security preset.

For any of the following options, press "y" and continue.

Step 3: Install PHP

The last thing we'll be doing in this article is installing PHP.

Install PHP:

sudo apt-get install php -y

Then install common PHP extensions such as GD, MySQL, and so forth.

sudo apt-get install -y php-{bcmath,bz2,intl,gd,mbstring,mcrypt,mysql,zip} && sudo apt-get install libapache2-mod-php  -y

Step 4: 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
 
Was this article helpful? yes / no
Related articles How to Install Apache, MySQL, and PHP on CentOS 6.10
Install ISPConfig on CentOS 6
How to Install PhpMyAdmin on CentOS 6.9?
How to Install VPN PPTP in ubuntu 16.04
How to Install stable version of PHP 5.4, PHP 5.5 or PHP 5.6 on a CentOS 6
Article details
Article ID: 19
Category: Knowledgebase
Rating (Votes): Article rated 3.4/5.0 (5)

 
« Go back

 
Powered by Help Desk Software HESK, in partnership with SysAid Technologies