K2L66

# ISO
-----

  RASPI-K VM settings: 4096MB, 4CPU, NAT
  Port forwarding rule (Network->Advanced):
  Host IP    127.0.0.1 
  Host Port  2222 
  Guest IP   10.0.2.15. 
  Guest Port 22
  On Putty: localhost 2222

Stage 0: install from ISO, allow only SSH:

  wget -c http://ftp.debian.org/debian/dists/buster/main
                  /installer-amd64/current/images/netboot/mini.iso
                  
Read this:

  https://wiki.debian.org/DebianInstaller/Preseed

  https://www.debian.org/releases/stable/example-preseed.txt

  https://www.howtoforge.com/tutorial/debian-minimal-server/
  
Manual install:
  
  [ ] Debian desktop environment
  [ ] ... GNOME
  [ ] ... Xfce
  [ ] ... KDE Plasma
  [ ] ... Cinnamon
  [ ] ... MATE
  [ ] ... LXDE
  [ ] ... LXQt
  [ ] web server
  [ ] print server
  [v] SSH server
  [ ] standard system utilities
  
How to change root password and shutdown:

  # passwd
  # systemctl poweroff

wget -c http://ftp.debian.org/debian/dists/buster/main/installer-amd64/current/images/netboot/mini.iso


# HISTORY
---------

  # apt update
  # apt upgrade
  # apt install wget ed gpg curl


# TIMEZONE
----------

# timedatectl status
# timedatectl list-timezones | grep 
# timedatectl set-timezone Europe/Tallinn

# ls -l /etc/localtime
lrwxrwxrwx 1 root root 36 Feb 21 06:09 /etc/localtime -> ../usr/share/zoneinfo/Europe/Tallinn


# SUDO
------

# touch 1-sudo.sh
# ed 1-sudo.sh
a
#!/bin/bash

echo -e "\n@@@ install sudo for user opilane@@@"
echo -e "@@@ and /etc/network/interfaces.dhcp@@@\n"

if [ "$UID" -eq "0" ]
then
  echo -e "\n@@@ Install sudo for user opilane @@@\n"

  apt-get update
  apt-get -y upgrade
  apt-get -y autoremove --purge sudo
  apt-get install sudo
  cp /etc/sudoers /etc/sudoers.init
  cat /etc/sudoers.init | \
      perl -pe 's/^root/opilane ALL=(ALL) NOPASSWD:ALL\nroot/' > /etc/sudoers
else
  echo "You are NOT root"
fi
.
w
q
# chmod +x 1-sudo.sh
# ./1-sudo.sh

NOTE: Use sudo -i to minimize risk of poisoning /home/opilane with root :root files. (To fix: sudo chown -R opilane:opilane <file or folder>)


# GRUB
------

# touch 2-grub.sh
# ed 2-grub.sh
a
#!/bin/bash

if [ "$UID" -eq "0" ]
then
  if [ ! -f /etc/default/grub.init ]
  then
    echo "Modifying initial grub configuration"
    sudo cp /etc/default/grub /etc/default/grub.init
    sudo cat /etc/default/grub.init | \
      sudo perl -pe 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=1/' | \
      sudo perl -pe 's/_DEFAULT="quiet"/_DEFAULT="" # "quiet"/' | \
      sudo tee /etc/default/grub > /dev/null
    sudo update-grub
  else
    echo "Grub configuration does not changed"
  fi
else
  echo "You are NOT root"
fi
.
w
q
# chmod +x 2-grub.sh
# ./2-grub.sh


# POWERSHELL 7
--------------

3-powershell

if [ "$UID" -eq "0" ]
then
  wget -c https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-rc.2/powershell-preview_7.0.0-rc.2-1.debian.10_amd64.deb
  dpkg -i powershell-preview_7.0.0-rc.2-1.debian.10_amd64.deb
  apt-get -y install -f
  rm powershell-preview_7.0.0-rc.2-1.debian.10_amd64.deb
  ln -s /usr/bin/pwsh-preview /usr/bin/pwsh
else
  echo "You are NOT root"
fi

EOF


# DOTNET
--------

4-dotnet.sh

#!/bin/bash

if [ "$UID" -eq "0" ]
then
  wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg
  mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
  wget -q https://packages.microsoft.com/config/debian/10/prod.list
  mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
  chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
  chown root:root /etc/apt/sources.list.d/microsoft-prod.list
  apt-get -y install apt-transport-https
  apt-get update
  apt-get -y install dotnet-sdk-3.1
else
  echo "You are NOT root"
fi

EOF


# USE dotnet
------------

  $ mkdir hello
  $ cd hello
  $ dotnet new console -o myApp
  $ cd myApp
  $ dotnet run
  Hello, World!


# GUI
-----

5-gui.sh

#!/bin/bash

if [ "$UID" -eq "0" ]
then
  apt-get -y install xserver-xorg lxde lightdm lxappearance
  apt -y install build-essential module-assistant dkms

  cp /etc/apt/sources.list /etc/apt/sources.list.orig

  echo -e \
  "deb http://archive.raspberrypi.org/debian/ buster main ui" | \
  sudo tee -a /etc/apt/sources.list > /dev/null

  echo -e \
  "# deb-src http://archive.raspberrypi.org/debian/ buster main ui" | \
  tee -a /etc/apt/sources.list > /dev/null

  apt-get update

  cd /etc/apt/
  wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key
  apt-key add raspberrypi.gpg.key
  apt-get update
  apt-get -y install raspberrypi-ui-mods

  cd /etc/apt/
  wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key
  apt-key add raspberrypi.gpg.key

  apt-get update

  apt-get -y install raspberrypi-ui-mods

  cp /etc/systemd/system/autologin@.service \
         /etc/systemd/system/autologin@.service.init

  cat /etc/systemd/system/autologin@.service.init | \
    perl -pe 's/ pi / opilane /' | \
    tee /etc/systemd/system/autologin@.service > /dev/null
else
  echo "You are NOT root"
fi

EOF

Alter mouse doubleclick speed

  $ lxappearance
  Icon theme -> Gnome  Apply, Close

As the result .gtkrc-2.0 configuration file will be created. Now you may switch back to PiXflat theme (which is nice).

  $ ls -la .gtkrc-2.0
    -rw-r--r-- 1 opilane opilane  582 Feb 21 16:32 .gtkrc-2.0

Create following file and relogin

  $ ed .gtkrc-2.0.mine 

  gtk-double-click-time=500
  gtk-double-click-distance=20


# NANO
------

5-prenano.sh

#!/bin/bash

if [ "$UID" -eq "0" ]
then
  apt-get -y install autoconf automake autopoint git pkg-config
  apt-get -y install libncurses-dev libncursesw5-dev gettext texinfo
  autoconf --version | head -n 1
  automake --version | head -n 1
  autopoint --version | head -n 1
  gcc --version | head -n 1
  gettext --version | head -n 1
  git --version | head -n 1
  groff --version | head -n 1
  make --version | head -n 1
  pkg-config --version | head -n 1
  makeinfo --version | head -n 1
else
  echo "You are NOT root"
fi

EOF

6-banano.sh

#!/bin/bash

if [ "$UID" -eq "0" ]
then
  git clone git://git.savannah.gnu.org/nano.git nano
  cd nano/
  ./autogen.sh
  ./configure
  make
  apt-get -y remove nano
  make install nano
  ln -s /usr/local/bin/nano /usr/bin/nano
else
  echo "You are NOT root"
fi

EOF


# VISUAL STUDIO CODE
--------------------

7-vscode.sh

#!/bin/bash

if [ "$UID" -eq "0" ]
then
  curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
  install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/microsoft-archive-keyring.gpg
  sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
  apt-get update
  apt-get install code
else
  echo "You are NOT root"
fi

EOF

C# support

  https://code.visualstudio.com/docs/languages/csharp
  
You can install it from within VS Code by searching for 'C#' in the Extensions view (Ctrl+Shift+X) 

DotNet Tutorials

  https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/run
  https://channel9.msdn.com/Blogs/dotnet/Get-started-VSCode-Csharp-NET-Core-Windows



# TUI
-----

  apt-get -y install libtool libtool-bin
  cd /usr/lib/x86_64-linux-gnu
  ln -s libncurses.so.6 libncurses.so.5
  ln -s libncursesw.so.6 libncursesw.so.5

As opilane:

8-tui.sh

#!/bin/bash

if [ "$UID" -ne "0" ]
then
  sudo ln -s /usr/lib/x86_64-linux-gnu/libncursesw.so.6.1 /usr/lib/x86_64-linux-gnu/libncursesw.so.5
  git clone https://github.com/elw00d/consoleframework
  cd consoleframework
  dotnet build
  cd native/
  tar xf libtermkey-0.18.tar.gz
  cd libtermkey-0.18
  make
  cd .libs/
  sudo cp libtermkey.so libtermkey.so.1 libtermkey.so.1.12.0 /usr/lib/x86_64-linux-gnu/
  cd ../..
else
  echo "You COULD NOT BEE root"
fi

EOF

Test your build with

  # ^d to Exit
  dotnet run --project ExamplesStandalone/ManyControls
  # ^d to Exit
  dotnet run --project ExamplesStandalone/TextEditor/


# VIRTUALBOX GUEST ADDITIONS
----------------------------

Insert virtualbox guest additions ISO

  # sh /media/cdrom0/VBoxLinuxAdditions.run
  

# CLEANUP

  # apt-get autoremove
  # apt-get clean
  # dd if=/dev/zero of=biig; rm biig
  
Clone virtual hard disk and compress with 7z. (1.04 GB)

  
# MARKS
-------

1. $ pwsh
   PowerShell 7.0.0-rc.2
   Copyright (c) Microsoft Corporation. All rights reserved.
   ..
   
2. $ dotnet run
   Hello..

3. nano 4.x

4. VisualStudioCode

5. TUI

  dotnet run --project ExamplesStandalone/ManyControls
  dotnet run --project ExamplesStandalone/TextEditor/


# LINKS
-------

1. https://devconnected.com/how-to-change-the-timezone-on-debian-10-buster/

2. https://4sysops.com/archives/how-to-install-powershell-7-on-windows-and-linux/

3. https://docs.microsoft.com/en-us/dotnet/core/install/linux-package-manager-debian10

4. https://git.savannah.gnu.org/cgit/nano.git/tree/README.GIT

5. https://github.com/elw00d/consoleframework
