To install any application you need root access , You can prefix sudo before every command or login to root user and execute the commands
Enter the password of your account
You need to update the local repo by fetching indexes from remote canonical repos
To install Apache you must install the Metapackage apache2. This can be done by running the following command.
apt-get install apache2
To install MySQL you must install the Meta package mysql-server.
apt-get install mysql-server
To install php and apache lib for php if required install other libs like mysql lib and lots of other libs are available
apt-get install php5 libapache2-mod-php5
Open a web browser and navigate to that ubuntu IP
You should see a message saying
You can check your PHP by executing any PHP file from within /var/www/.
Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file .
php -r ‘echo “nWow my installation is working.”;’