sudo pip3 install PyMuPDF


sudo apt-get install gnuplot-qt
(allows you to set terminal to qt in maxima and octave)
(
% **********************************************************************
% Start Octave with :  octave --no-gui
% **********************************************************************
graphics_toolkit qt
)



ssh-keygen -t rsa -b 4096 -C "youremail@junk.com"

* Configure vim

greg@qoffee:~$ cat .vimrc
set viminfo=
:highlight Visual cterm=reverse ctermbg=NONE
set nowrap


* Install Linode with Debian11 and ngspice

   53  sudo apt-get update
   54  sudo apt-get install xterm
   55  sudo apt-get install imagemagick
   56  sudo apt-get install gnuplot-x11
   57  sudo apt-get install xmaxima
   58  sudo apt-get install octave-signal
   59  sudo apt-get install octave-jsonlab
   60  sudo apt-get install x11-apps
   61  sudo apt-get install x11-utils
   62  sudo apt-get install xbitmaps
   63  sudo apt-get install fig2dev
   64  sudo apt-get install git
   65  sudo apt-get install zip
   66  sudo apt-get install rsync
   67  sudo apt install vim
   68  sudo apt install xfstt xfonts-base xfonts-utils xfonts-100dpi xfonts-75dpi
   69  sudo apt update
   70  sudo apt install gcc
   71  sudo apt install make
   72  sudo apt install perl
   73  sudo apt install tk
   74  sudo apt install openssh-client
   75  sudo apt install epstool
   76  sudo apt install golang
   77  sudo apt install hugo
   78  sudo apt update
   79  sudo apt upgrade
   80  sudo apt install python3-pip python3-tk
   81  sudo -H pip3 install numpy
   82  sudo -H pip3 install matplotlib
   83  sudo -H pip3 install scipy
   84  sudo -H pip3 install Flask

  104  sudo apt-get install ufw
  105  sudo ufw status
  106  sudo ufw enable
  107  sudo ufw allow 22/tcp
  108  sudo ufw allow 80/tcp
  109  sudo ufw allow 443/tcp
  110  sudo ufw allow 8080/tcp
  111  sudo ufw allow 5000/tcp
  112  sudo ufw status

  127  mkdir sskk
  128  cd sskk

  139  sudo apt update
  140  sudo apt install build-essential libx11-dev libxaw7-dev libreadline-dev
  141  tar xvf ngspice-41.tar.gz
  142  cd ngspice-41/
  143  ./configure --with-x --disable-debug
  144  make
  145  sudo make install






* To stop and restart webserver

  ps aux | grep sscs  
  sudo kill 157452
  sudo go build -o sscs_mod main.go
  sudo ./sscs_mod &


  It seems that the cronjob to renew the certificate doesn't work because the hugo server needs to be stopped
  when the certificate is being renewed. You need to stop the webserver then run :

  sudo certbot renew --dry-run
  sudo certbot renew

  Then start the webserver with "sudo ./sscs_mod &"






* https

  search.google.com/search-console

  let's encrypt

https://letsencrypt.org/

https://certbot.eff.org/

1. ssh to server
   stop the webserver (kill sscs_mod)

2. Install snapd
      
    $ sudo apt update
    $ sudo apt install snapd

 
      (restart server)

    $ sudo snap install core
        core 16-2.45.2 from Canonical✓ installed

    $ sudo snap refresh core

    
    $ sudo snap install hello-world
        hello-world 6.3 from Canonical✓ installed

    $ hello-world
        Hello World!

3. Install Cerbot

   $ sudo snap install --classic certbot

   $ sudo ln -s /snap/bin/certbot /usr/bin/certbot

4. Get a certificate

   sudo certbot certonly --standalone

   (saved file how_certbot.txt)

8. Install certificate (in hugo)

9. Test automatic renewal

   $ sudo certbot renew --dry-run

    (should be something in one of these) 
      /etc/crontab/
      /etc/cron.*/*
      systemctl list-timers











    


0. Add packages

   sudo apt-get update
   sudo apt-get install xterm
   sudo apt-get install imagemagick
   sudo apt-get install gnuplot-x11
   sudo apt-get install xmaxima
   sudo apt-get install octave-signal octave-jsonlab
   sudo apt-get install x11-apps
   sudo apt-get install fig2dev
   sudo apt-get install git
   sudo apt-get install zip
   sudo apt-get install rsync


   sudo apt install vim
   sudo apt install xfstt xfonts-base xfonts-utils xfonts-100dpi xfonts-75dpi

   sudo apt update
   sudo apt upgrade
   sudo apt install python3-pip python3-tk

   sudo -H pip3 install numpy
   sudo -H pip3 install matplotlib
   sudo -H pip3 install scipy
   sudo -H pip3 install Flash


   (if needed)

   sudo apt install gcc make perl
   sudo apt install tk
   sudo apt install x11-apps x11-utils xbitmaps
   sudo apt install openssh-client
   sudo apt install epstool
   sudo apt install golang

   sudo apt install hugo
          or
   (sudo snap install hugo  --> but first have to install snapd and enable snap)








00. Change passwords


sudo useradd -m johnny
sudo passwd johnny
sudo usermod -aG sudo johnny


* To install ruby

  sudo yum update
  sudo yum install ruby
  ruby -y

  sudo gem install jekyll



* You need to update C:\Users\gooyw\DD\LDemo\how_linode2.txt

  to install 

  sudo yum install zip



* You can set up the linode firewall outside (on top) of your vm

  Each firewall you create has a label, but you still need to assign the firewall to a linode
  even if it has the same name as the label. (I should not have named the label the same and the
  linode)

  I can set ssh based on ip address  /32 means all the bits count   /16 means only the first two hex count

  148.123.77.19/32      151.167.0.0/16



* Monitor logins and login attempts


sudo last  | head
sudo lastb | head


* Disable ssh root login and any ssh login with password

  sudo diff /etc/ssh/sshd_config /etc/ssh/sshd_config.orig

  38c38
  < PermitRootLogin no
  ---
  > PermitRootLogin yes
  65c65
  < PasswordAuthentication no
  ---
  > PasswordAuthentication yes

* added 8/18/2023
  104  sudo apt-get install ufw
  105  sudo ufw status
  106  sudo ufw enable
  107  sudo ufw allow 22/tcp
  108  sudo ufw allow 80/tcp
  109  sudo ufw allow 443/tcp
  110  sudo ufw allow 8080/tcp
  111  sudo ufw allow 5000/tcp
  112  sudo ufw status







* **************************************************************************************************


   78  sudo pip3 install --force-reinstall Pillow==8.3.2
   79  sudo pip3 install --force-reinstall matplotlib



  117  sudo firewall-cmd --list-ports
  118  sudo firewall-cmd --zone=public --permanent --add-port=8080/tcp
  119  sudo firewall-cmd --zone=public --permanent --add-service=http
  120  sudo firewall-cmd --zone=public --permanent --add-service=https
  121  sudo firewall-cmd --reload
  122  sudo firewall-cmd --list-ports


  140  sudo firewall-cmd --state
  141  history
  142  sudo firewall-cmd --zone=public --permanent --add-port=5000/tcp
  143  sudo firewall-cmd --reload
  144  sudo firewall-cmd --state
  145  sudo firewall-cmd --list-ports
  146  cd
  147  sudo yum update
  148  sudo yum install mosquitto.x86_64
  149  sudo yum install golang.x86_64
  150  cd
  151  mosquitto -d -p 5000
  152  ps aux | grep mosqui


on redhat

In terminal 1 :

  mosquitto_sub -h subckt.com -p 5000 -t "warwar/test"

In terminal 2 :

  mosquitto_pub -h subckt.com -p 5000 -t "warwar/test" -m 'Haha Greg'
* **************************************************************************************************

ssh greg@subckt.com -X
(you will get an error message the first time, but that's ok, it create .Xauthority file)

* **************************************************************************************************
*** Note on linode firewall
* **************************************************************************************************
(It seems that the linode firewall runs on top of everything, so you would probably need to disable
the centos7 firewall if you want that one to work. In google cloud, somehow the internal centos7 firewall
is running, but the google cloud firewall can control it. Anyway, for now I'm just using the centos7 firewall)

Note : you could disable the centos7 filewall with

(CAUTION CAUTION) sudo systemctl stop firewalld

and then use the linode one. 
* **************************************************************************************************






------------------------------
https://www.linode.com/docs/guides/getting-started/


Create --> Linode --> CentOS 7



ssh root@subckt.com

yum update

hostnamectl set-hostname gobox
(notice that I set the host name to the name of the "label" when I created this linode)
(you don't have to name these the same)


exit


ssh root@subckt.com

74.207.253.71 gobox.subckt.com gobox


(also set an A record for gobox to also point to 74.207.253.71)



timedatectl list-timezones

timedatectl set-timezone 'America/Los_Angeles'


exit
ssh root@subckt.com
date


useradd greg && passwd greg

usermod -aG wheel greg

exit

ssh greg@subckt.com


    5  mkdir .ssh
    6  cd .ssh
    7  vim authorized_keys
    8  lls
    9  cd
   10  pwd
   11  sudo chmod -R 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys


exit
ssh greg@subckt.com

(note : to get to google cloud - ssh gregwarwar@subckt.org)

compare sudo ss -atpu on both cloud machines