Thread: Debian 8 - Java & LAMP Stack Installation

Results 1 to 2 of 2
  1. #1 Debian 8 - Java & LAMP Stack Installation 
    Registered Member
    Necrotic's Avatar
    Join Date
    Mar 2016
    Posts
    158
    Thanks given
    156
    Thanks received
    56
    Rep Power
    130
    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.
    Code:
    java -version
    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...
    Code:
    JAVA_HOME=""
    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;
    Code:
    echo $JAVA_HOME
    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").
    Code:
    mysql -u root -p
    You will now be entering commands directly for mysql.
    Lets check for some output!
    Code:
    status
    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.
    Code:
    exit



    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;
    Code:
    cd /var/www/html
    We want to make a simple php page to make sure everything is working as expected.
    Code:
    cat > info.php
    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.
    Code:
    rm info.php



    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.
    Code:
    passwd USERNAME
    Hopefully someone will find part of this useful.
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    You should automate this with something like puppet
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Play Runescape without java installed
    By Paladin in forum Chat
    Replies: 9
    Last Post: 05-22-2010, 04:54 PM
  2. Replies: 2
    Last Post: 05-06-2010, 07:13 AM
  3. Problem with installing Java
    By Ryequis in forum Application Development
    Replies: 9
    Last Post: 04-20-2010, 02:55 AM
  4. java.lang.RuntimeException: Stack overflow
    By R0cky 0wnz in forum Help
    Replies: 0
    Last Post: 12-24-2009, 11:03 AM
  5. Error installing java with my linux vps
    By Dawgg in forum Software
    Replies: 3
    Last Post: 06-01-2008, 08:49 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •