This is one way to install Java 8 & a LAMP Stack for Debian 8.
You can use PuTTY or another SSH client to connect to your server.
Feel free to copy/paste what you need to. You can paste into PuTTY with right-click.
This tutorial is assuming you have a fresh installation of Debian 8.
The ending to this is very open ended. Getting your specific server online isn't covered. This is just Java, Linux, Apache, Mysql, and php.
LINUX
SSH into your server as root.
Enter each of the following commands, one at a time.
Code:
apt-get update -y
apt-get upgrade -y
apt-get install sudo screen vim unzip software-properties-common -y
This will fetch updates, upgrade your OS, and install a few packages.
We want to create a new user for the server, and we want to allow sudo. Run the next two commands, and create a password as needed.
Code:
adduser rsps
adduser rsps sudo
JAVA
Next, we'll need to add a new repository for the Java package we want, and fetch an update.
Code:
add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" -y
apt-get update
We'll use an installer to get Java 8 installed. You will need to agree to any licenses when prompted.
Code:
apt-get install oracle-java8-installer -y
Ensure Java has been installed.
Output should be similar to this
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
We want to copy our java path now, as we'll need it for later.
Code:
update-alternatives --config java
Copy the directory of your java installation. For me, the directory was...
/usr/lib/jvm/java-8-oracle/jre/bin/java
Make note of the directory. You will need it again.
We want to set our $JAVA_HOME variable now.
Run the following code to open a text editor.
Code:
vim /etc/environment
Press the INSERT key to be able to edit the file.
Paste (right click) the following into the editor...
Now navigate to the inside of the quotations, and enter the directory from the previous step.
Your editor should look like this;
JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre/bin/java"
Press ESC to exit insert mode.
Press : (colon key) followed by X and finally ENTER to save.
Finally, to make sure it worked, run the following command;
The output should be the directory from before.
APACHE
Run the following to install Apache.
Code:
apt-get install apache2 apache2-doc -y
Now, enter your server's IP address into a web browser, and make sure you end up on an apache splash page.
My url was: http://192.168.0.171/ (but this will not work for you)
MYSQL
Install the packages!
Set your root password! My (temporary) password will be: hardtoguessthis123
Code:
apt-get install mysql-server php5-mysql -y
We now want to initiate installation. You will need to use the root password you set (in my case "hardtoguessthis123").
Code:
mysql_secure_installation
When prompted...
REMOVE anonymous user.
REMOVE remote access.
REMOVE test DB/user.
Reload.
Lets make sure we can access the service.
When prompted, use your root password (in my case "hardtoguessthis123").
You will now be entering commands directly for mysql.
Lets check for some output!
You should get similar output:
Threads: 1 Questions: 66 Slow queries: 0 Opens: 51 Flush tables: 1 Open tables: 45 Queries per second avg: 0.258
Now we can exit mysql.
PHP
Install our packages.
Code:
apt-get install php5-common libapache2-mod-php5 php5-cli -y
Restart apache.
Code:
service apache2 restart
Lets change directories;
We want to make a simple php page to make sure everything is working as expected.
You will get a blank line after entering this command. In the blank line, enter:
Code:
<?php phpinfo(); ?>
Now, to escape this entry use the hotkey: CTRL+D.
We now want to make sure we can view the php page.
Once again, enter your server's IP address into a web browser, but with /info.php to the end. My url was: http://192.168.0.171/info.php (but this will not work for you)
Assuming you can see the info.php page, we can now remove it.
Finishing up
At this point, you'll have Java & a LAMP installation complete.
Your web directory should be: /var/www/html
If you used the same (temp) password as I did during the tutorial, make sure to change your passwords.
You can use a FTP client such as FileZilla to transfer files to/from your server.
You can use screen to open a session for your server, and keep it open after.
You can install forums/other web services as you wish.
You can run your RSPS with Java (after you upload it).
Changing passwords - replace USERNAME with your target.
Hopefully someone will find part of this useful.