Installing H@H on Debian

From EHWiki
Jump to navigationJump to search

Requirements

  • Being able to use Google.
  • Basic Linux knowledge.
  • A running Debian GNU/Linux server.
  • A Java 8 Runtime Environment or above (H@H 1.6.0)
  • PuTTY or any other SSH program to connect to your server. This allows for copying/pasting of commands.


A couple things to be aware of before starting

  • Linux IS case sensitive on file names. Therefore, it is best to use lower case names everywhere to make it easier for yourself.
  • Commands you should type are given in Green;
  • Output from the command prompt is given in Red;
  • Text in commands that you'll probably need to change is given in Blue.
  • Commands starting with $ are to be run as current user, those starting with # - as root (using su/sudo).
  • We strongly recommend you to install the sudo package and add your admin user to the sudo group. There are plenty of tutorials for that that can be found with Google.
  • H@H 1.6.0 and above uses SSL certificates. For them to work properly, you need the ntp package (it syncs the server's date and time). It is normally installed by default, but package updates may make it fail.
  • This manual is based on a virtual server (VPS/VDS). The use of a physical server, home PC or any program other than VMware to virtualize your server may require doing some things differently.


Installing Java

To run H@H you will need the Java Runtime Environment to be installed on your server. There are 3 different methods to do so. Just pick the one you prefer and be aware that each one has its pros and cons. We will simply list them in the order we recommend these. At any point of the steps used to install the Java Runtime Environment, you can use the following command to check the version currently installed:

$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

The result written here may differ depending on the version and the method used. This one here is Java 7 and needs to be uninstalled, before installing a new one. You can find tutorials on the web to uninstall Java if you're in this case.

OpenJDK packages

Using the OpenJDK packages allows you to choose the version of Java you want and install it very simply. These are updated frequently. Currently, these packages support up to Java 8, which is exactly what we need to run H@H. To do this, connect to your server and run the following commands either as root, or by prefixing them by sudo (if you have the sudo package installed):

# apt-get update
# apt-get install openjdk-8-jre

Once done, verify the version of Java, to make sure that it's been properly installed:

$ java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-1~deb9u1-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)

And there's nothing else to do.

You can find other versions of OpenJDK here: http://openjdk.java.net/install/

Default JRE

You can use the defauot JRE provided with your distribution of Debian. This is very easy to install and it is guaranteed to work, but you can't choose the version of Java.
Point.png Don't use Debian 8's repository for H@H 1.6.0 and above. The JRE provided in the packages for Debian 8 is Java 7, and H@H 1.6.0 needs Java 8 or above. If you are running Debian 8, use either OpenJDK or the official Java releases.

To install the default JRE of your distribution of Debian, connect to your server and run the following commands either as root, or by prefixing them by sudo (if you have the sudo package installed):

# apt-get update
# apt-get install default-jre

Once done, you may want to check what version of Java installed.

And that's it, you're already done. Simple isn't it?

Official Oracle release (Downloaded archive)

This method is a bit more tricky, but allows you to really choose what version of Java you want, including newer versions. The Oracle archives are also frequently updated. If you can't (or don't want to) use the method that uses the Debian packages, you will need to download and install an archive from the Oracle website. Select your Java package on official download page (use a "Server JRE Download" for 64 bits distributions, "JRE Download" for 32 bits), accept the license and copy download link.

Downloading the JRE can be with the following command (modify the download link with the one you've copied):

$ wget --no-check-certificate "Cookie: oraclelicense=accept-securebackup-cookie" "https://download.oracle.com/otn/java/jdk/8u251-b08/3d5a2bb8f8d4428bbe94aed7ec7ae784/server-jre-8u251-linux-x64.tar.gz"

Create a directory for the Java Virtual Machine in /opt:

# mkdir /opt/java-oracle

Unpack the downloaded archive in /opt (again, modify the file name with the one you have):

# tar -zxf server-jre-8u251-linux-x64.tar.gz -C /opt/java-oracle

Set our JVM to be used as the default Java on the system (again, modify what's needed):

$ Java_Home=/opt/java-oracle/jre1.7.0_67
# update-alternatives --install /usr/bin/java java ${Java_Home%*/}/bin/java 20000
# update-alternatives --install /usr/bin/javac javac ${Java_Home%*/}/bin/javac 20000
# update-alternatives --install /usr/bin/javaws javaws ${Java_Home%*/}/bin/javaws 20000

Verify (or set) JVM to be used as a default Java on the system:

# update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /opt/java-oracle/jre1.7.0_67/bin/java
Nothing to configure.

Once done, you may want to check the version of Java installed on your system.

Installing H@H

For more security let's create new user for H@H:

# adduser hath

Now login as the new user and create a directory for H@H client:

# login hath
$ mkdir hath

Download H@H (check for the latest version here):

$ wget https://repo.e-hentai.org/hath/HentaiAtHome_1.6.1.zip

Unzip the downloaded archive (install unzip if you haven't yet):

$ unzip HentaiAtHome_1.6.1.zip -d hath/

Well done, let's launch it!

$ cd hath
$ java -jar HentaiAtHome.jar

You will be prompted for your client ID and Password which you can find on your H@H page

You will need to configure your client settings on the above page before you get your client password. If you have not applied to run a H@H client yet, you will have to do so first.

To stop the server, press "Ctrl+C" and wait for a couple seconds.

Controlling H@H with the screen utility

To make it very short and simple, the screen utility is a package available in many Linux distributions, that allows one to run commands in a dedicated environement. It is very useful when it comes to run a H@H client, as you can simply start your H@H client in a "screen" and leave it there to work, allowing you to perform other actions, like closing your SSH connection.

Installing the screen utility

First, download and install the package from the depository:

$ apt-get install screen

And that's all.

Using the screen utility to control your H@H client

First connect to your server using a SSH connection, as the user 'hath'. Then start the screen utility by entering the following command:

$ screen -r

You are now "inside" the screen utility, which looks and acts just like the command line. You can control the utility itself with the following key combinations:

Ctrl+A, then C - Create a new screen window
Ctrl+A, then N - Switch to next screen window
Ctrl+A, then P - Switch to previous screen window
Ctrl+A, then K - Kill the current screen window
Ctrl+A, then D - Detach from the screen utility (quit without closing)

To start your H@H client, follow these steps:

  1. Create a new window (Ctrl+A, then N)
  2. Start your H@H client in the window's command line
  3. Detach from the screen utility (Ctrl+A, then D)
  4. You can now close your SSH connection, the H@H client will keep running.

Point.png Always detach from the screen utility before closing your SSH connection. Otherwise, the screen utility and its windows will be killed, which means your H@H client will be shut down improperly.

You can control how your client is performing later on, by connecting to your server and perform the following actions:

  1. Start the scren utility (screen -r)
  2. Browse through your windows with Ctrl+A, then P (previous) or N (next) until you see your H@H client's command line
  3. Again, use Ctrl+A then D to detach once you're done
  4. You can close the SSH connection


See also