How To Install IPFS and Forward Ports In VM

작년

I have never posted on Steem. I have been in the community for quite awhile, peering from the shadows. Finally I have decided to start an IPFS node to support content on DTube. This guide will show you how to install IPFS alongside @techcoderx's Discord bot. This bot enables user backups of DTube videos, as well as backing up Dsound. It will also explain to you how to forward ports in a VM. Pre-requisite, How to use NANO and How to navigate in the Linux terminal

PortForwardIPFS.jpg

We deployed this on the Lubuntu 18.04 Linux Distribution.


Step One

  • Create a user name
    adduser username

  • Sudo the user.
    usermod -aG username


Step Two: Install Node

curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -

sudo apt-get install nodejs


Step Three: Install Git, Clone Github Repo

git clone https://github.com/techcoderx/DTube-IPFS-Bot.git


Step Four: Install the Discord Bot

cd DTube-IPFS-Bot

npm install


Step Five: Install IPFS

wget https://dist.ipfs.io/go-ipfs/v0.4.19/go-ipfs_v0.4.19_linux-amd64.tar.gz

tar xvfz go-ipfs_v0.4.19_linux-amd64.tar.gz
cd go-ipfs

sudo ./install.sh

ipfs init


Step Six: Configure IPFS

Edit your config file with

  • Disable mDNS discovery
    ipfs config --json Discovery.MDNS.Enabled false

  • Filter out local network addresses
    ipfs config --json Swarm.AddrFilters '[
    "/ip4/10.0.0.0/ipcidr/8",
    "/ip4/100.64.0.0/ipcidr/10",
    "/ip4/169.254.0.0/ipcidr/16",
    "/ip4/172.16.0.0/ipcidr/12",
    "/ip4/192.0.0.0/ipcidr/24",
    "/ip4/192.0.0.0/ipcidr/29",
    "/ip4/192.0.0.8/ipcidr/32",
    "/ip4/192.0.0.170/ipcidr/32",
    "/ip4/192.0.0.171/ipcidr/32",
    "/ip4/192.0.2.0/ipcidr/24",
    "/ip4/192.168.0.0/ipcidr/16",
    "/ip4/198.18.0.0/ipcidr/15",
    "/ip4/198.51.100.0/ipcidr/24",
    "/ip4/203.0.113.0/ipcidr/24",
    "/ip4/240.0.0.0/ipcidr/4"
    ]'


Step Seven: Edit Your Configuration File

Write down your port, and forward your local router or firewalls (if needed) for proper connection on said port. I suggest using high ports. 45,000+. Say your .ipfs folder is in your home directory you can bring up and edit your configuration file with a program called nano. See the commands below.

cd .ipfs
nano config
Here is a screenshot of it in my configuration file for reference.

IPFSconfigScreenshot.png

You may want to adjust high water and low water to suit your computers performance.
An example for lower end computers, put high water at 65 and the low water at 25.

For you reference the port configuration is under swarm.


Step Eight Create/Configure/Find Discord Bot Token

https://discordapp.com/developers/

DiscordDeveloper.PNG

Choose a good name for your bot.

DiscordDevelopername.PNG

Here you will see your client ID, this is very important. Make sure to copy it and save it for the time being. Take the client ID and create your invite link.

DiscorddeveloperID.PNG

Next you will want to add your bot.

discordDeveloperADDBOT.PNG

Here you will see how to get your bot token. You will need this to make your invite link.

DeveloperBotToken.PNG

Enter the token you got from the discord developers section into the "auth.json" file in the DTube-IPFS-Bot directory

BotTOkenJSON.png


Step Nine: Configure the settings for the discord bot in config.json

DiscordBot.PNG


Step Ten: Invite the bot to the discord you would like (by creating an invite link)

Right after client_id=, the zeroes represent where you need to put your client id. Which you can find in the discord developers section. This is how you make your invite link.

https://discordapp.com/oauth2/authorize?client_id=000000000000000000&scope=bot&permissions=523328


Step Eleven: Install pm2 software

sudo npm install pm2@latest -g


Step Tweleve:Node Start

This command starts your nodejs bot

pm2 start bot.js

This command starts your IPFS daemon

pm2 start "ipfs daemon --enable-gc"


Step Thirteen: Test to see if your bot is responding with a !ping command.

If successful, then test to see if the bot pins DTube/Dsound content.


Step Fourteen:Portr Forward in VM

This website was very helpful in helping me forward my Virtual machine port.

With the port you have selected, go into you router settings. If you do not know how to, you should have documentation on how to, or call you ISP. Input the IP address you obtained from your VM for the port forwarding IP.

A video explaining how to port forward.

To forward your port in your Virtual Machine, first you need to click on your connection.

Step14connectionRevised.png

As it states in the picture you only need the IP address and the port you have chosen to forward.

https://www.howtogeek.com/122641/how-to-forward-ports-to-a-virtual-machine-and-use-it-as-a-server/

In the picture, where it says guest IP, input the IP from your VM. For host leave blank. The host port and guest port will be the port you have chosen to forward.

portForwardGuestIP.PNG

Congratulations, you have successfully set up an IPFS node in a vm!!

Without @gray00's help none of this would have been possible.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
STEEMKR.COM IS SPONSORED BY
ADVERTISEMENT
Sort Order:  trending

Great explanation and sorely needed.
I just set up Dtube IPFS node and it was quite hard to do despite great help from @vaultec and @graylan.

I wish I'd had this detailed description with screenshots last week!

Don't forget to configure the bot in config.json file :D

And please change the node id to something that uniquely identifies your bot. It may be a string or a number. 1, 2 and 3 have been taken.

·

Ah, good tip. :D I forgot about the config.json

Nice! Love how simple you kept it

Congratulations @necroth! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You published your First Post
You got a First Vote
You received more than 50 upvotes. Your next target is to reach 100 upvotes.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness and get one more award and increased upvotes!

@necroth, thank you for supporting @steemitboard as a witness.

Here is a small present to show our gratitude
Click on the badge to view your Board of Honor.

Once again, thanks for your support!

Do not miss the last post from @steemitboard:

Are you a DrugWars early adopter? Benvenuto in famiglia!