# apt-get update # apt-get install apache2 apache2-utils
Add the server's domain name at the end of /etc/apache2/apache2.conf
Restart the server with either of the following commands:
# service apache2 restart # /etc/init.d/apache2 restart
To install PHP5 package and all related package dependencies run the following command below. by default ubuntu server 16.04 LTS will install PHP 7.0.
List installed php packages with the first command, then remove unneeded packages with sudo aptitude purge your_packages_here or if you want to directly remove them all use the second command:
dpkg -l | grep php| awk '{print $2}' |tr "\n" " " sudo apt-get purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
sudo add-apt-repository ppa:ondrej/php
If you get add-apt-repository: command not found run the following command first :
sudo apt-get install software-properties-common
sudo apt-get update sudo apt-get install php5.6 sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-gd php5.6-curl
sudo apt-get install php5.6-cli sudo php -v
# apt-get install php libapache2-mod-php php-mcrypt php-mysql php-pear php-gd php-curl
To install Mysql Server package and all related package dependencies run the followong command:
# apt-get install mysql-server # apt-get install phpmyadmin
During the installation, you’ll be asked to setup the MySQL root user password. This is an administrative account in MySQL that has increased privileges, Enter the password and select [OK].
Enter the following to your virtual host configuration to restrict access to phpmyadmin to a specific ip address or a browser signature:
# Allow access without password BrowserMatch "Mozilla" webmaster Require env webmaster Require ip 8.8.8.8
# find / -name my.cnf
# /etc/init.d/mysql stop # chown -R mysql:mysql /var/lib/mysql/<folder> # /etc/init.d/mysql start