i10iR

Debian Stretch. Session 2
=========================

I. INITIAL SETUP
~~~~~~~~~~~~~~~~

  VirtualBox 5.2.4:

    Name:           stretchONE
    OS:             Linux Debian 64Bit
    RAM:            1024MB
    Connection:     Bridged
    HD:             16GB
    OS:             ISO: debian-9.2.1-amd64-netinst.iso

  Graphical Install:

    Country:        Estonia
    Default Locale: en-US.UTF-8
    keyboard:       Estonian
    host:           stretchONE
    domain name:
    root password:  root
    user:           virtu
    password:       virtu

  Partitioning disks:

    Guided -- Use entire disk
    SCSI3(0,0,0) (sda) -17.2 GB ATA VBOX HSRDDISK
    All files in one partition

  Package manager:

    Debian archive mirror country: Estonia
    Debian archive mirror: ftp.ee.debian.org
    no proxy
    Participate.. survey?:    No

  Choose software to install:

    [ ] ..Debian desktop environment
    [ ] ..GNOME
    [ ] ..Xfce
    [ ] ..KDE
    [ ] ..Cinnamon
    [ ] ..MATE
    [ ] ..LXDE
    [ ] web server
    [ ] print server
    [v] SSH server
    [ ] standard system utilities

  Install GRUB boot loader to the master boot record?: Yes
  Device for boot loader installation: /dev/sda (.. )
  Installation complete/Reboot

Post Install: sudo
------------------

  # ls -l /etc/sudoers
  -r--r----- 1 root root 700 Dec  3 20:00 /etc/sudoers

Note: use w!

  $ su -
  Password:
  # apt-get install sudo
  # cat /etc/sudoers | grep 'root\|virtu'
  ### This file MUST be edited with the 'visudo' command as root.
  root    ALL=(ALL:ALL) ALL
  virtu   ALL=(ALL) NOPASSWD:ALL

Post Install: development
-------------------------

  # apt-get install build-essential module-assistant dkms
  # apt-get install mc git subversion wget curl
  # apt-get install autogen autoconf automake autopoint
  # apt-get install libncurses5-dev libncursesw5-dev gettext texinfo
  # m-a prepare

Post Install: dillo
-------------------

  apt-get install xserver-xorg dillo

Post Install: apache2
---------------------

  apt-get install apache2
  service apache2 status

Post Install: Oracle java
-------------------------

  https://linuxconfig.org
  /how-to-install-oracle-java-se-development-kit-
  on-debian-9-stretch-linux

II. EMSCRIPTEN + DOSBOX
~~~~~~~~~~~~~~~~~~~~~~~

Prerequisites:

  apt-get install python2.7 clang cmake nodejs dosbox

  Also, check that you have X11 installed on the client end:

    https://askubuntu.com/questions/61690
    /ssh-x-xt-error-cant-open-display-0-0

  wget -c --no-check-certificate \
    https://s3.amazonaws.com/mozilla-games/emscripten
    /releases/emsdk-portable.tar.gz

  tar xf emsdk-portable.tar.gz
  cd emsdk-portable
  ./emsdk update
  ./emsdk install latest
  ./emsdk activate latest
  source ./emsdk_env.sh

  emcc -v
  ..
  WARNING:root:closure compiler will not be available
  Now in plain English: install Oracle Java 8*.

------
*) https://linuxconfig.org
     /how-to-install-oracle-java-se-development-kit-
     on-debian-9-stretch-linux
------

DOS-Box
-------

  cd ~
  git clone https://github.com/dreamlayers/em-dosbox.git
  cd em-dosbox
  ./autogen.sh
  emconfigure ./configure   ### (~1min)
  make                      ### (~10min)

Packaging games
---------------

Next is to change the PYTHON to 'python' inside of src/packager.py. This file tries to use emscripten's file_packager and uses the mysterious PYTHON variable. Since script is going to fail, it's time to open it up and change it

  nano src/packager.py
  change PYTHON to 'python'

Install some game..

  pscp loom.zip virtu@xxx.xxx.xxx.xxx:/home/virtu/em-dosbox/src
  cd /home/virtu/em-dosbox/src
  unzip loom.zip
  ./packager.py loom loom LOOM.EXE

Relocate important stuff to apache2 www root:

  virtu@stretchONE:~/em-dosbox/src$ ls -l /var/www/html/
  total 8212
  -rw-r--r-- 1 virtu virtu  107006 Dec 31 20:53 dosbox.html
  -rw-r--r-- 1 virtu virtu  316775 Dec 31 20:52 dosbox.html.mem
  -rw-r--r-- 1 virtu virtu 5575468 Dec 31 20:53 dosbox.js
  -rw-r--r-- 1 root  root    10701 Dec 31 19:25 index.html
  -rw-r--r-- 1 virtu virtu 2261722 Dec 31 20:59 loom.data
  -rw-r--r-- 1 virtu virtu  120535 Dec 31 20:59 loom.html

Run game inside firefox (ESC to release mouse)

  http://xxx.xxx.xxx.xxx/loom.html

------------------------------------------------------------------------

Annex A. How to install Oracle Java SE Development Kit
         on Debian 9 Stretch Linux
------------------------------------------------------

  https://linuxconfig.org
  /how-to-install-oracle-java-se-development-kit-
  on-debian-9-stretch-linux

Instructions

Download Oracle Java SE Development Kit

First step is to use your browser to download Oracle Java SE Development Kit from the official Oracle website. Alternatively, if you do not have access to GUI your can download Oracle Java SE Development Kit from the command line using curl command.

NOTE: The URLs used below to download Oracle Java SE Development Kit may be outdated, so please update where necessary.

Retrieve 64bit Oracle Java SE Development Kit tarball URL using curl command. If curl is not yet available on your system you can install by

  # apt install curl:

  $ curl -s http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html | grep "otn-pub" | cut -d \" -f12 | grep linux-x64.tar.gz

output:

http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz
http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.tar.gz

Next, use the above URL from curl's output do download the actual Oracle Java SE Development Kit tarball:

  $ curl -LOb "oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.tar.gz

If all went well the Oracle Java SE Development Kit tarball should be available within your current working directory:

  $ ls
  jdk-8u152-linux-x64.tar.gz

Install and Configure

At this stage we will extract the previously downloaded package into /opt/java-jdk directory and make is default system-wide:

  # mkdir /opt/java-jdk
  # tar -C /opt/java-jdk -zxf jdk-8u152-linux-x64.tar.gz

Next, use update-alternatives command to make it default on your Debian stretch system:

  # update-alternatives --install /usr/bin/java java /opt/java-jdk/jdk1.8.0_152/bin/java 1
  # update-alternatives --install /usr/bin/javac javac /opt/java-jdk/jdk1.8.0_152/bin/javac 1

Confirm Install

The Oracle SE Development Kit should now be default on your system. To confirm, query java's version:

  $ java -version
  java version "1.8.0_152"
  Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
  Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
