DigitalOcean initial configuration

In the DigitalOcean Droplet configuration select Ubuntu OS, then manually-set password for root.

Logging in

From my laptop can then log into the server using

  $ ssh root@SERVERIPHERE
  

On the droplet, create a new user and group

# sudo adduser pdg
# sudo adduser pdg sudo
# sudo addgroup pdg_grp
# sudo usermod -aG pdg_grp pdg

The -a (append) and -G (groups) options ensure the user is added to the new group without being removed from their other groups.

Validating,

# groups pdg
pdg : pdg sudo users pdg_grp
# id pdg
uid=1000(pdg) gid=1000(pdg) groups=1000(pdg),27(sudo),100(users),1001(pdg_grp)

Copy my public cert from my laptop to the server

$ ssh-copy-id pdg@SERVERIPHERE

On the server I exited the root SSH session and logged back in as pdg:

$ ssh -i ~/.ssh/KEYNAMEHERE pdg@SERVERIPHERE
$ sudo vi /etc/ssh/sshd_config
     PermitRootLogin no
     PubkeyAuthentication yes
     PasswordAuthentication no
     PermitEmptyPasswords no
     AuthorizedKeysFile      .ssh/authorized_keys .ssh/authorized_keys2

Updating bash configuration

Added to ~/.bash_aliases

 
alias vi='vim'

alias s='git status'
alias p='git push'

# do not overwrite existing files
set -o noclobber

alias nothing='docker ps; git pull; git push; git status'
alias ll="ls -hal"
alias ..="cd .."
alias grin="grep -R -i -n --color"

and to ~/.bashrc

# HISTSIZE determines the number of commands remembered in memory during the current session.
# HISTFILESIZE determines the maximum number of lines allowed in the history file
export HISTSIZE=100000
export HISTFILESIZE=200000

export HISTTIMEFORMAT="%h %d %H:%M:%S "

shopt -s histappend
shopt -s cmdhist

OS updates

$ sudo apt update
$ sudo apt upgrade
$ sudo apt -y install make

Install Docker

$ sudo apt update
$ sudo apt install apt-transport-https curl
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
$ sudo apt update
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
$ sudo systemctl is-active docker
active

as per https://linuxiac.com/how-to-install-docker-on-ubuntu-24-04-lts/

Then add pdg to docker group

$ sudo usermod -a -G docker pdg

as per https://stackoverflow.com/questions/47854463/docker-got-permission-denied-while-trying-to-connect-to-the-docker-daemon-socke/48450294#48450294

Enable Upload to GitHub

$ ssh-keygen
$ cat ~/.ssh/id_ed25519.pub

Upload public key to my profile, https://github.com/settings/keys

Clone git repo

On the server

$ git clone git@github.com:allofphysicsgraph/ui_v8_website_flask_neo4j.git
$ cd /home/pdg/ui_v8_website_flask_neo4j

On my laptop

$ scp -i ~/.ssh/KEYNAMEHERE neo4j_pdg/plugins/apoc.jar pdg@SERVERIPHERE:/home/pdg
  

On the server

cd /home/pdg/ui_v8_website_flask_neo4j
echo "UID=$(id -u)" > .env
echo "GID=$(id -g)" >> .env