i6LD0

## UBUNTU BIONIC SERVER

Download ISO here:

  http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/

  ubuntu-18.04-server-arm64.iso  2018-04-26 18:32   670M

Create VirtualBox VM:

  name: BioServer
  Machine: Ubuntu 64-bit
  RAM: 2048 MB
  CPU: 4 Core
  CD: ubuntu-18.04-server-arm64.iso
  HD: BioServer-16GB
  Network: NAT

  User: virtu
  Passwd: virtu
  Host: BIOBOX
  Automatic login

install

  Install Ubuntu Server
    English
    Location: Other Europe Estonia
    Locales: United States: en_US.UTF-8
    Keyboard layout: English (US)
    Hostname: BIOBOX
    user: virtu
    password: virtu
    time zone: Europe Tallinn
    Partitioning method: Guided -- Use entire disk
    Write changes to disk: Yes
    Proxy: No
    Upgrade: No automatic updates
    Software: [*] OpenSSH Server
    Install GRUB: MBR

Place scripts to /usr/local/bin:

  # chmod +x post-install
  # chmod +x clean
  # chmod +x report
  # chmod -x report_body

post-install:

  #!/bin/bash

  apt-get update
  apt-get -y upgrade
  apt-get -y install tree build-essential
  apt-get clean
  dd if=/dev/zero of=biiig
  rm biiig

clean:

  #!/bin/bash

  apt-get clean
  dd if=/dev/zero of=biiig
  rm biiig

report:

  #!/bin/sh
  sh -v `dirname $0`/report_body 2>&1 | tee -a ./report-$(date +%Y%m%d)

report_body:

  #!/bin/bash

  echo ### WHAT IS INSTALLED?:
  dpkg --list
  echo ### HOW MANY PACKAGES ARE INSTALLED?:
  dpkg --list | expr `wc -l` - 5
  echo ### FREE RAM?:
  free
  echo ### FREE DISK SPACE?:
  df
  echo ### HOW MANY FILES?:
  tree / | wc -l
  echo ### LONG LIST OF LOCAL SCRIPTS:
  ls -l /usr/local/bin

LAMP

  # tasksel install lamp-server
  # bash -c "echo -e '<?php\nphpinfo();\n?>' > \
      /var/www/html/phpinfo.php"

BioServer-16GB-6La.7z 375MB/2.5GB

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

#1# PHP Easy Steps

1. Upload single file

upload.php:

  <table width="500" border="0" align="center"
         cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr>
    <form action="upload_ac.php" method="post"
          enctype="multipart/form-data" name="form1" id="form1">
      <td>
      <table width="100%" border="0" cellpadding="3"
             cellspacing="1" bgcolor="#FFFFFF">
        <tr>
          <td><strong>Single File Upload </strong></td>
        </tr>
        <tr>
          <td>Select file
          <input name="ufile" type="file" id="ufile" size="50" /></td>
        </tr>
        <tr>
          <td align="center">
          <input type="submit" name="Submit" value="Upload" />
          </td>
        </tr>
      </table>
      </td>
    </form>
    </tr>
  </table>

upload_ac.php

  <?php
    //set where you want to store files
    //in this example we keep file in folder upload
    //$_FILES['ufile']['name']; = upload file name
    //for example upload file name cartoon.gif .
    //$path will be upload/cartoon.gif

    $path= "upload/".$_FILES['ufile']['name'];
    if($ufile !=none) {
      if(copy($_FILES['ufile']['tmp_name'], $path)) {
        echo "Successful<BR/>";

        //$_FILES['ufile']['name'] = file name
        //$_FILES['ufile']['size'] = file size
        //$_FILES['ufile']['type'] = type of file

        echo "File Name :".$_FILES['ufile']['name']."<br/>";
        echo "File Size :".$_FILES['ufile']['size']."<br/>";
        echo "File Type :".$_FILES['ufile']['type']."<br/>";
        echo "<img src=\"$path\" width=\"150\" height=\"150\">";
      }
      else {
        echo "Error";
      }
    }
  ?>

Note:

  mkdir /var/www/html/upload
  chmod 777 /var/www/html/upload

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

## ANNEX A. UBUNTU 18.04 ON WSL:

1. https://askubuntu.com/questions/985928
     /cannot-use-sudo-systemctl-restart-apache2-
     after-sudo-apt-get-install-apache2/985935#985935

..instead of systemctl to start Apache use the following

  sudo /etc/init.d/apache2 start
  
2. Level 0:

   https://medium.com/@fiqriismail
    /how-to-setup-apache-mysql-and-php-in-
    linux-subsystem-for-windows-10-e03e67afe6ee

  $ sudo service apache2 start
   * Starting Apache httpd web server apache2
  [Wed Nov 07 06:13:42.275664 2018] 
  [core:warn] [pid 8537] 
  (92)Protocol not available: AH00076: Failed to enable
  APR_TCP_DEFER_ACCEPT
   *
   
NOTE: Ignore the warning. We can still use Apache without any problem.

3. Level 1: 

  https://seld.be/notes/developing-on-windows-in-2018
  
4. Shutdown WSL Ubuntu (at least on 1809):

Run cmd as administrator.

  C:\Windows\system32> net stop LxssManager
  The LxssManager service is stopping.
  The LxssManager service was stopped successfully.

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

Links

  1. How To Install LAMP in Ubuntu 18.04 Bionic Beaver

  https://linuxconfig.org
  /how-to-install-lamp-ubuntu-18-04-bionic-beaver-linux-apache-mysql-php

  2. That just means you DID NOT define $HTTP_POST_FILES.
  Define it and you should be good. If you are trying
  to use the now deprecated $HTTP_POST_FILES, don't.
  Use $_FILES instead.

  https://stackoverflow.com/questions/11671914
  /undefined-variable-http-post-files-error

  3. PHP Easy Steps

  http://www.phpeasystep.com