Add repository
1 | sudo add-apt-repository ppa:webupd8team/java |
Update
1 | sudo apt-get update |
Install Java
1 | sudo apt-get install oracle-java8-installer |
Setting Java environment variables
1 | sudo apt-get install oracle-java8-set-default |
chk java version
1 | java -version |
Get installation path
1 | which java |
Switching between Oracle Java 8 and Java 7
1 | sudo update-java-alternatives -s java-7-oracle |
Setting Up JAVA_HOME
Edit /etc/profile (sudo nano /etc/profile ) and add the following
1 | export JAVA_HOME=/usr/lib/jvm/java-8-oracle |
save the file and execute
1 | <span class="pln">source </span></code>/etc/profile |
Tasksel installation
First we need to install Tasksel (Tasksel is a Debian/Ubuntu tool that installs multiple related packages as a co-ordinated “task” onto your system. This program is used during the installation process, but users can also use tasksel at any time.)
open teminal (Ctrl+Alt+T) and execute the command
1 | sudo apt-get install tasksel |
After installing Tasksel open the tasksel
1 | sudo tasksel |
Move the cursor using arrow key and keep cursor near LAMP server and press space button from keyboard for selection, after selecting you can see a star inside the square bracket (press the space again for remove selection )
Press enter key for proceed installation
while installing it will ask for mysql user password and confirm password. Provide password and press enter key to proceed
You are done with the installation,
You can see a www folder created in /var folder.
Open your browser and type http://localhost you can see a default page.
Now you can create your php files inside /var/www/html (Document root) folder, if you kee the folder outside html folder (/var/www) it will not work.
Open default.conf file (located in /etc/apache2/site-available/000-default.conf) with super user permission
1 | sudo gedit /etc/apache2/sites-available/000-default.conf |
You can see the DocumentRoot /var/www/html, this you can change to /var/www (you can set any of your folder as document root just give your folder path after DocumentRoot )
Save this file
create a php file outside html folder (/var/www) and add some content
Restart apache and test http://localhost/index.php in your browser