Skip to content

Instantly share code, notes, and snippets.

@oakes
Last active September 28, 2022 21:46
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oakes/47cd1eaaae83eab634e8 to your computer and use it in GitHub Desktop.
Save oakes/47cd1eaaae83eab634e8 to your computer and use it in GitHub Desktop.
Running a JAR on Digital Ocean
  • Create a Digital Ocean account
  • In the OS X terminal, run ssh-keygen, then hit enter until it is done
  • Create a droplet
    • Select Ubuntu 16.10 x64
    • In Finder, Go -> Go to Folder... then type ~/.ssh
    • Open id_rsa.pub with TextEdit
    • Copy the contents of the file and paste them in the "New SSH Key" text field
    • Click "Create"
  • In the Terminal app, run ssh root@YOUR_IP_ADDRESS
  • Run apt-get update
  • Run apt-get install openjdk-8-jdk
  • Run apt-get install haveged
  • Clone your git repo into the VPS and cd into it
  • Run the JAR file with a >> output.log & at the end like this:
    • java -jar MyProject-0.0.1.jar >> output.log &
  • To search for all java processes, do this:
    • ps aux | grep java
  • To kill a particular process id, do this:
    • kill PROCESS_ID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment