-
-
Notifications
You must be signed in to change notification settings - Fork 79
Getting a VPS
This page will go through how to get and set up a Linux server which can be online 24/7 without the needing to keep your own computer or laptop running.
You can get a VPS from many different providers, but I recommend getting one from DigitalOcean OR Hetzner. If you want to use DigitalOcean, you can register from this link and get $100 that expires after 2 months, OR this link for Hetzner and get free €20 for a month!
If you don't have any Credit/Debit Card, Paypal account or you don't have an access to get one, I can help you to get one for your Team Fortress 2 pure. Click here to see the available services.
Next, what you need to do once you've created an account:
-
DigitalOcean:
- Click on Create button > Droplets.
- Select the highest Ubuntu LTS, (20.04) x64 (as of writing this).
- Select the Basic $5/month plan.
- Choose a region in which the VPS will be located.
- Generate your SSH key.
- On Authentication section, select SSH Keys and click on New SSH Key.
- Paste your SSH Public Key and click Add SSH Key.
- Edit your hostname to whatever you wanted.
- No volume or backups is needed.
- Click on "Create" to create the VPS.
-
Hetzner:
- Click + NEW PROJECT > Input a project name, example
tf2autobot
> Click on thetf2autobot
project > Click on ADD SERVER. - Choose a region in which the VPS will be located.
- Select the highest Ubuntu LTS, (20.04) x64 (as of writing this).
- Select the CX11 plan - €2.49/month (0% VAT).
- Ignore Volume, Network, and Additional features sections.
- Generate your SSH key
- Click on +ADD SSH KEY and paste your SSH Public Key and click ADD SSH KEY
- Edit your server/hostname to whatever you wanted.
- Click on "CREATE & BUY NOW" to create the VPS.
- Click + NEW PROJECT > Input a project name, example
SSH, or Secure Shell, is a remote administration protocol that allows users to control and modify their remote servers over the Internet.
If you're using:
- Go to https://www.putty.org/ and download the installation file. Once it is downloaded, run the file and go through the installation process.
- Search for
PuTTYgen
and open the app. - Click on
Generate
and move your mouse over the blank area. - Once the key has been generated, it's optional to change your "Key comment" and/or set your "Key passphrase" and confirm it.
- After you've edited (if you did edit your "Key comment" and/or set "Key passphrase"), your SSH Public Key are in the box. Example:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAwAloG4rFTBhM4/8t6OawuAKeG4MA5vImcNMr0V+X4PzKA554o8YrWX3/+sTqMeV4PHTEKL+CphpCN6XaXkp5ggPVp5vvXDAw6quNVeCBMUyjKkfRTqSXhWbHQB0y6KS0whXJkkjGizrY11RExFZbNPQfN+yl9WA5c5+7EHg+/966P+7vakx+wfvDABbK4mqk5IiEOWbDyogVaRIt/xq+1NNLdRF8VGfgIaWlnWEC4sSuGrU7+pv/0CHHVZTAqHUJBu0UzAy/J/jHDGGd/QDllmx70Eui9E9SEhD9uRJ7iyzw+WiRGeJsHdQfwMTFdbIDXnsRQrtGAUDG04GLeTA+sQ== rsa-key-20200904
- Copy and paste this SSH Public Key into the SSH Key section when creating your DigitalOcean or Hetzner VPS.
- Save your SSH Private Key somewhere safe on your computer by clicking on
Save private key
. You will need to use this private key to connect to your VPS. DO NOT SHARE THIS SSH PRIVATE KEY WITH ANYONE INCLUDING ME.
- Search for and Launch the Terminal app.
- Enter the following code and press enter:
ssh-keygen -t rsa
- Press ENTER to store the key in the default folder
/Users/Username/.ssh/id_rsa
or/home/Username/.ssh/id_rsa
. - Type a passphrase (characters will not appear in Terminal).
- Confirm your passphrase to finish SSH Keygen. You should get an output that looks something like this:
Your public key has been saved in /Users/myname/.ssh/id_rsa.pub.
The key fingerprint is:
ae:89:72:0b:85:da:5a:f4:7c:1f:c2:43:fd:c6:44:30 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . |
| E . |
| . . o |
| o . . S . |
| + + o . + |
|. + o = o + |
| o...o * o |
|. oo.o . |
+-----------------+
- Copy your Public SSH Key to your clipboard using the following code:
pbcopy < ~/.ssh/id_rsa.pub
- Use
Ctrl + V
or Right-Click to paste your Public SSH Key on DigitalOcean or Hetzner and you're good to go!
*Note: If you're using Ubuntu or other Linux distro and you got an error when running the code in step 6, you'll need to setup this: https://garywoodfine.com/use-pbcopy-on-ubuntu/
If you're using:
- Open PuTTY, fill in Host Name (or IP address) with your VPS IP address.
- Click on Data under the Connection section and fill in Auto-login username with
root
. - Expand SSH by clicking on the + on the left of SSH, and click on Auth, and click on Browse and select your SSH Private Key file.
- Scroll up and click on Sessions, fill in the Saved Sessions with whatever you want with "-root", like
something-root
, click Save and then click Open. - There will be a warning message, but just allow it (click Yes) as it's your first time connecting to your new VPS.
- Be sure to continue to Initial Setup of your VPS and follow the steps that are already in order.
- Download and install Termius: https://www.termius.com/
- Once installed, run and create a new account (or log in if you already have one).
- Open the terminal and run this command to copy your SSH Private Key:
pbcopy < ~/.ssh/id_rsa
- Click on
+ New host
and fill in:
- Label: anything
- *Address: Your VPS IP Address
- Group: You can ignore this or setup later
- Tags: anything like
tf2autobot
or leave empty - Username:
root
- Password:
- Select
Keys →
- Click on
+KEY
button - Fill in Label, example: VPS1
- Fill in the Passphrase of your SSH Key
- Paste your SSH Private Key with Ctrl + V in the Private Key box
- Leave the Public Key box empty
- Select
- Leave the other things empty/default, and then click on
Save
button. - Double click on the newly created Hosts. (remember, this one is on
root
, you will need to change username to another username after you've created one, follow the instructions in Initial setup of your VPS.
You're now connected and sign in to the VPS.
The root user is the administrative user in a Linux environment that has very broad privileges. Because of the heightened privileges of the root account, you are discouraged from using it on a regular basis. This is because part of the power inherent with the root account is the ability to make very destructive changes, even by accident. (Source: DigitalOcean)
The next step is to set up an alternative user account with a reduced scope of influence for day-to-day work.
Please follow the steps below. We assume you've already connected to your VPS on a root
username.
- Create a new username ubuntu:
adduser ubuntu
- Grant ubuntu administrative privileges:
usermod -aG sudo ubuntu
chmod 0700 /home/ubuntu
- Copy your SSH Public key from root to ubuntu:
rsync --archive --chown=ubuntu:ubuntu ~/.ssh /home/ubuntu
- Install updates:
sudo apt-get update && sudo apt-get upgrade -y
- Setup Firewall:
sudo ufw allow ssh
sudo ufw allow 22
sudo ufw allow proto tcp from any to any port 80,443
sudo ufw enable
- Reboot your system:
sudo reboot
- Now your VPS will reboot and you'll lose connection to your VPS. Do not panic. Close the current terminal.
- log in as
ubuntu
:
- Windows:
- Open PuTTY, on the Saved Sessions (assuming you've followed step 4 here), click on the
something-root
and click on Load. - Click on Connection > Data, change the value of Auto-login username from
root
toubuntu
. - Go back to the main page by clicking on the Session, change the name on the Saved Sessions box from
something-root
tosomething-ubuntu
and click on Save. - Now click on Open to connect to your VPS on a new
ubuntu
username.
- Open PuTTY, on the Saved Sessions (assuming you've followed step 4 here), click on the
- Mac OS/Linux:
- Open Termius and right-click on the newly created Hosts (assuming you've followed step 3 here) and select Edit.
- Scroll down to the Username box, change it from
root
toubuntu
. - Click on Save and double click on that host to reconnect to your VPS on a
ubuntu
username.
Initial setup of your new VPS done. You can continue downloading the bot section.
- Getting a VPS
- Downloading the bot
- Configuring the bot
- Running the bot (node and PM2)
- Introduction to pricelist
- Parameters
- Manage pricelist
- Other commands