How to install & setup a Discord bot on a VPS

Colin Uncategorized 0 Comments

“A VPS is essentially a barebones environment from which you’ll build your stack — in this case, that’d consist of at least NodeJS — and is comparable to a Dedicated Server; you are in full control (i.e. you have root access).

This means that you need to be ready and willing to learn how to manage your own server, as well as secure it while maintaining your application(s).

To get started, you’ll need a way to connect to your Droplet (VPS). If you’re on MacOS (or OS X), you can use Terminal. If you’re on Windows, you’d use PuTTy.

For PuTTy, see the link below. From under Package Files, download putty-64bit-0.69-installer.msi.

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

If you’re using Terminal, you’ll start the app and run:

ssh [email protected]_IP
DROPLET_IP should be replaced with the actual IP address of your Droplet.

You’ll be prompted for a password — that’ll be the password that was e-mailed to you once set up of your Droplet completed. If you don’t see the e-mail, check spam/junk just in case it was flagged.

If you’re on Windows and using PuTTy, you’ll double-click the application icon to launch. From there, you’ll enter the Droplet IP Address in the “Host Name (or IP Address)” box and click on “Open.”

You’ll be prompted for a password — you’ll use the same password that was e-mailed to you, as noted above.

When you login for the first time, you’ll be asked to reset your password to something else. You’ll first enter the same password you just used to login, then enter a new password, and finally confirm the new password.

That new password is what you’ll use to login from here on — so make sure you remember it (but don’t use something basic, it should be a secure password — generally 16-32 characters and as random as you can make it).

Once logged in to SSH, you’ll want to update (sync) your repositories and upgrade any packages in need up upgrading. On Ubuntu, you can do that by running each of the following commands:

apt-get update
apt-get -y dist-upgrade
That will at least ensure that everything is up-2-date and provide a solid base from which to build on.

I’d recommend taking a good look at this guide for a few more basics:

https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04

I recommend the above as you really shouldn’t stay logged in as root, though you need to pay very close attention to the guide as it is relatively easy to lock yourself out of the VPS if you are not careful.

From here on, it’s all a matter of setting up your stack. For NodeJS, you need to figure out the version you need to run. Right now, that’d be 4.x, 5.x, 6.x, or 7.x. In most cases, 5.x or 6.x is what is supported by most applications.

To install NodeJS, I recommend the NodeSource repositories:

https://github.com/nodesource/distributions

To install any version, 4.x through 7.x, you’d simply run:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash –
sudo apt-get install -y nodejs
You’d replace 6.x in the command above with the version you want to install — you only need to change the 6 to a 4, 5, or 7 — the .x should stay as-is.

Once NodeJS is installed, you’ll have access to run node myapp.js ect — as well as access to npm.

As for uploading files, you can use scp or SFTP. If you’re on Windows, SFTP would be the main and preferred option and nothing more needs to be installed to use it.

You’d want to download FileZilla:

https://filezilla-project.org/

… and then install it. From there, you’ll connect much in the same way that you did with PuTTy.

File => Site Manager => New Site
Host => Droplet IP
Port => 22
Protocol => SFTP – SSH File Transfer Protocol
Logon Type => Normal
User => root
Password => The new root password you setup.
From there, you’ll need to choose where you want to upload your files. Generally, you’ll use either:

/var/www/html
or you’ll create a sub-directory within /home, such as:

/home/mynewapp
using:

mkdir -p /home/mynewapp
or by creating a directory through FileZilla.

Keep in mind, these are really just the basics. With a VPS or Dedicated Server, you’re going to be using the CLI a lot, so you need to become familiar with it and learn to love it :-).

Hopefully that’ll help to get you started. If you have any questions along the way, feel free to reply and I’ll do my best to help!”

Cheap VPS offered at https://SSDBlaze.com/servers

Sourced & All credit given to Jlittle1 on DigitalOcean

Leave a Reply