Simple VPS Client
This is the simplest possible implementation of a Virtual Private Server (VPS). It spins up a Raspbian-based Docker container with SSH shell access. There is no persistent storage, so everything is held in memory and deleted if the device is rebooted. The SSH user also does not have sudo privileges so is pretty strongly restricted in what they can do.
However, by keeping it simple, this client is preferred for testing. If you're a beginner at setting up a P2P VPS client, you should start by following the directions below. It's also much easier to troubleshoot if you build this client before building the flash-storage client.
These instructions assume you are starting with a Raspberry Pi v3 B+ with an 8GB or larger SD card. It also assumes that you are starting with a fresh install of Raspbian OS, which can be installed via NOOBS.
It will take an hour or two for the Raspberry Pi to execute all the instructions in this document. If you are provisioning several Pi's for use on the P2P VPS network, it's much faster to copy the SD card image after completing setup on the first device. The built-in SD card copier feature in Raspbian is the easiest way to do this. Unfortunately, there is no command-line version of that application.
After installing Raspbian, you need to enable SSH and ensure you can connect to your RPi over your local area network using SSH. I prefer to use Putty as my SSH terminal on Windows. It's light weight and powerful.
The first thing to do after logging into the Raspberry Pi is change the default password. From the SSH command line terminal, issue the command
passwdand change the default password for the user
(optional) A fresh install of Raspbian on an 8GB card does not leave much room. If you plan to designate this device as a dedicated VPS, it will be advantageous to remove a lot of unneeded software. Follow the commands below to remove a lot of the default applications in Raspbian.
sudo apt-get --purge -y remove libreoffice libreoffice-avmedia-backend-gstreamer libreoffice-base libreoffice-base-core libreoffice-base-drivers libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw libreoffice-gtk libreoffice-impress libreoffice-java-common libreoffice-math libreoffice-report-builder-bin libreoffice-sdbc-hsqldb libreoffice-style-galaxy libreoffice-writer bluej wolfram-engine scratch geany geany-common greenfoot sonic-pi sudo apt-get --purge -y remove minecraft-pi chromium-browser sudo apt-get -y autoremove
- This is a great time to update the software on the device, including any security patches.
sudo apt-get -y update sudo apt-get -y remove nodejs curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs build-essential sudo apt-get -y upgrade
- (optional) For renting out as a VPS, I usually hard connect the RPi with an
ethernet cord. That makes it possible to disable to the WiFi and Bluetooth to
reduce power, save money, and prevent an attack vector. It's easy to disable by
adding these two lines to the bottom of
- You'll also need to install Docker on the RPi. Prior to running the instructions below, this is a great time to reboot your device. It seems to prevent errors with installing Docker.
curl -sSL https://get.docker.com | sh
- Follow the on-screen instructions to add the user 'pi' to the docker group. You'll need to open a new terminal, or reboot your device, after entering this instruction:
sudo usermod -aG docker pi
- Now, downgrade Docker (until they fix issues with the newer versions):
sudo apt install docker-ce=17.09.0~ce-0~raspbian
- (optional) create a directory for your node applications, like this one:
- Clone this repository:
git clone https://github.com/P2PVPS/p2pvps-client
- Setup the Client program by running:
cd p2pvps-client/client npm install ./init
- Change into the
rpidirectory and run the
cd rpi ./init
- Change into the RPi
- Install the dependencies:
Get your device GUID from the P2P VPS marketplace. You'll need to create an account. The GUID is provided in the Owned Devices view by clicking the +Add New Device button. Paste this GUID into the
Launch the simple client. The first time will take a while as it will need to download and build several Docker containers:
That's it! Once the application presents the message
Docker image has been built and is running.,
your device is now connected to the P2P VPS server and listed on the market for rent.
Continue by installing the flash client