# Run HentaiAtHome On Portable External Hard Drive

## Install Required Tools

`sudo apt-get install screen`

`sudo apt-get install vim`

`sudo apt-get install openjdk-9-jdk`

`sudo apt-get install openjdk-9-jre`

## Auto Mount External Hard Drive

1. Use `df -h` command to check the disk and free space on the system ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCvnBSLOxIJOIU4U%2Fimg_1.jpg?generation=1544866559480248\&alt=media)
2. Use `lsblk` command to show the hard disk partition status and partition ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCvq3topI4wpBAWF%2Fimg_2.jpg?generation=1544866559673523\&alt=media)
3.  Use `sudo fdisk -l` to view details of the hard drive and volume ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCvspTVrOfXnnEni%2Fimg_3.jpg?generation=1544866559697770\&alt=media)

    The **/dev/sda** is the external dard drive ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCvu409_rOIpd-j4%2Fimg_4.jpg?generation=1544866559606838\&alt=media)
4. Use `sudo fdisk /dev/sda` to edit the external hard drive, first **d** and then **w** to delete the partition table and disk on the hard disk ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCvw1bGC9Zqv8Rfn%2Fimg_5.jpg?generation=1544866558046126\&alt=media)
5. Once again, use `sudo fdisk /dev/sda` to build disk partition\
   First type **`n`**\
   Next type **`p`**\
   And type **`1`**\
   Then press enter twice, if it shows `contains a ext4 signature` message,\
   just type **`Y`** to countine, finally type **`w`** to build partition on the hard disk ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCvy9dKZ4FBwzONY%2Fimg_6.jpg?generation=1544866557313260\&alt=media)
6. Use `sudo mkfs.ext4 /dev/sda1` to format the partition into **Ext4** ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCw-QEdgvwT_En-8%2Fimg_7.jpg?generation=1544866559484511\&alt=media)
7. Use `sudo mkdir /media/hd` to create a folder, then the external hard drive will be mounted here ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCw1ev45h5Jdq7_T%2Fimg_8.jpg?generation=1544866558963219\&alt=media)
8. Use `sudo chmod 777 /media/hd` to give it permission ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCw36pyZY1Hb5S_L%2Fimg_9.jpg?generation=1544866559360316\&alt=media)
9. Use `ls -lh /dev/disk/by-uuid` can see the UUID of the hard disk and partition ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCw5oj8CVdqiZeAB%2Fimg_10.jpg?generation=1544866558518155\&alt=media)
10. Use `sudo blkid /dev/sda1` to list UUIDs of external hard drive partitions ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCw7N6dvHpKqU2l5%2Fimg_11.jpg?generation=1544866558465667\&alt=media)
11. Remember the UUID of external hard drive, then use `sudo vim /etc/fstab` to edit **fstab** to let raspberry pi automatically mount the external hard drive after boot ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCw9s9nBEwGA64O7%2Fimg_12.jpg?generation=1544866559098120\&alt=media)

    you will see this: ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwB94FvEk2uKq6i%2Fimg_13.jpg?generation=1544866557786951\&alt=media) then press **`i`**, the `-- INSERT --` will display at buttom, it means now this file can be edit ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwDjd9Fnwcbazak%2Fimg_14.jpg?generation=1544866558268473\&alt=media) type `UUID=YOURUUID /media/hd ext4 defaults 0 2` ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwFB2U-pvDhBXjF%2Fimg_15.jpg?generation=1544866558377534\&alt=media) then press **`ESC`**, you will see that `-- INSERT --` disappear ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwHGzelEPk2tfii%2Fimg_16.jpg?generation=1544866559125044\&alt=media) now type **`:wq`**, then press enter ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwJRIt0dQGubaNW%2Fimg_17.jpg?generation=1544866557231190\&alt=media)
12. Use `sudo reboot` to reboot the device, and then use `df -h` to check if the external hard drive has been mounted ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwLSOqVVvMYXZA0%2Fimg_18.jpg?generation=1544866557907019\&alt=media)
13. Now use `sudo mkdir /media/hd/hath` to create a folder, and use `sudo chmod 777 /media/hd/hath` to give it permission ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwN0fzKFdmPwaao%2Fimg_19.jpg?generation=1544866558526710\&alt=media)

## Set up the server

You can use **`set-hath.sh`** to set up HentaiAtHome automatically

```
bash -c "$(curl https://raw.github.com/carry0987/Raspberry-Pi-Repo/master/HatH/set-hath.sh)"
```

Or just follow the tutorial below

1. Use `cd /media/hd/hath` to go to `hath` folder, then use `sudo wget https://repo.e-hentai.org/hath/HentaiAtHome_1.6.2.zip` to download the H@H ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-Lywm3yUQkTKrFCpVCr8%2F-LTlDCwPpuBzcHM6NgE2%2Fimg_20.jpg?generation=1579420245460931\&alt=media)
2. Use `sudo unzip HentaiAtHome_1.6.2.zip` to unzip H@H files ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-Lywm3yUQkTKrFCpVCr8%2F-LTlDCwRfu3kij59wguN%2Fimg_21.jpg?generation=1579420244551184\&alt=media)
3. Use `screen` to start terminal in background ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwT1AAlTmDt7dQc%2Fimg_22.jpg?generation=1544866558840875\&alt=media) you will see this ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwVCY6UeQhM0S56%2Fimg_23.jpg?generation=1544866559981317\&alt=media) just press enter to start ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwXmWAFNOYC08sM%2Fimg_24.jpg?generation=1544866558922519\&alt=media)
4. Use `sudo java -jar HentaiAtHome.jar` to start H@H ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwZAlOO2fbWxqVu%2Fimg_25.jpg?generation=1544866560193993\&alt=media)
5. Enter your Client ID and Client Key ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwakBRCrCxmqOZ1%2Fimg_26.jpg?generation=1544866560227807\&alt=media)
6. Running ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwchUgg-GauXTBg%2Fimg_27.jpg?generation=1544866558698764\&alt=media)
7. Now press **Ctrl + A** and then press **D** to detach H@H ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwepgMfaafKx98h%2Fimg_28.jpg?generation=1544866557969359\&alt=media)
8. Finish ![](https://1629731818-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LTkx9vj8rDQgjbGkVku%2F-LTlDC2gRIuHSiDNZUjc%2F-LTlDCwgX9v7QKQ5Mn3v%2Fimg_29.jpg?generation=1544866557649561\&alt=media)
