How to Setup an IPFS Node on a VPS

How to Setup an IPFS Node on a VPS (head image)

In the ever-evolving landscape of the internet, traditional methods of hosting and sharing files are being redefined by innovative technologies. One such groundbreaking solution is the InterPlanetary File System, commonly known as IPFS. This decentralized and distributed protocol is revolutionizing the way we store, share, and access information on the web. Let us start with how to setup an IPFS Node on a VPS.

Brief Overview of IPFS and its Benefits

IPFS functions as a peer-to-peer hypermedia protocol, designed to make the web faster, safer, and more open. Unlike traditional hosting methods, IPFS doesn’t rely on a central server. Instead, it distributes content across a network of nodes, creating a more resilient and censorship-resistant infrastructure. This not only enhances the reliability of file retrieval but also mitigates issues like data redundancy and server downtime. 

The benefits of IPFS extend beyond mere file storage. The protocol utilizes content-addressing, ensuring that files are identified by their unique cryptographic hash. This not only guarantees data integrity but also enables efficient caching and sharing, reducing the load on individual nodes. As we delve into the practical aspects of hosting on IPFS, understanding these advantages is useful for harnessing the full potential of the protocol. 

Why Choose Contabo for Hosting an IPFS Node

When it comes to hosting an IPFS node, selecting the right provider is paramount because…. Contabo emerges as a standout choice for hosting your IPFS node, offering a reliable and user-friendly environment. As a hosting provider known for its commitment to what sort of? price-performance ratio and customer satisfaction, Contabo provides the ideal infrastructure for seamlessly integrating IPFS into your web hosting strategy. 

Moreover, Contabo is the second largest IPFS nodes host with over 3400 nodes hosted globally. Its 99.996% uptime over the last 12 months ensures that your IPFS node will stay active. 

In the upcoming chapters, we will guide you through the practical steps of using IPFS to host Web3 files, with a focus on the seamless integration and performance advantages provided by Contabo. From setting up your IPFS node to optimizing its functionality, this guide will equip you with the knowledge and tools to navigate the decentralized future of web hosting.  

Installing IPFS Node on Contabo VPS

Setting up your IPFS node on Contabo’s VPS is a straightforward process that begins with a cloud-init script for quick and efficient deployment. 

For more information, also check out our official IPFS Node documentation.

Using Cloud-Init Script for Quick Setup

Step 1: Accessing the Customer Control Panel 

Begin by logging into the Customer Control Panel using your Contabo account. Once logged in, navigate to the VPS Control section. 

How to Setup an IPFS Node on a VPS - Customer Control Panel --> Select VPS Control

Step 2: Enabling Cloud-Init for Your VPS 

By default, Cloud-Init is disabled. Head to the VPS control section for your corresponding server and enable it by toggling the dedicated switch. 

How to Setup an IPFS Node on a VPS - Enable Cloud-Init

Step 3: Selecting the IPFS-Node Cloud-Init Script 

To configure your server with the IPFS-Node Cloud-Init Script, go to the VPS control section and click on “Reinstall.” 

Reinstall the server to apply the cloud-init script

Next, select “Advanced/Custom Image Installation” in the subsequent menu. Opt for Ubuntu 22.04 (LTS) for optimal compatibility. 

How to Setup an IPFS Node on a VPS - Advanced/Custom Image Installation

Complete the required fields and, in the “Cloud-Init” section, choose the “IPFS Node” script. You can review the full Cloud-Init script to see the commands that will be executed. 

For a deeper understanding of Cloud-Init and the script’s construction, refer to our article “What is Cloud-Init and Why is it so Cool?” 

To conclude the setup, click on “Install,” and relax as Contabo’s system automates the installation of your IPFS node, saving you valuable time and effort. 

Checking Installation Success

Ensuring IPFS Daemon is Running

Once the Cloud-Init script has been applied, it’s time to verify the success of the installation. Access your VPS terminal or SSH into your server. 

Switch to the ipfs user using the following command: 

sudo -u ipfs -i

This ensures that you are operating within the context of the IPFS user for subsequent commands. 

Test the IPFS version to confirm a successful installation: 

ipfs version

The expected output should be similar to: 

ipfs version 0.22.0

This confirms that the IPFS daemon is installed and running on your Contabo VPS. With these simple steps, you’ve successfully set up an IPFS node, laying the foundation for decentralized and efficient file hosting. 

In the next chapter, we’ll look at the configuration options and additional tweaks to optimize your IPFS node on Contabo for the best performance and reliability. 

Uploading Files to IPFS Node

As your IPFS node stands ready, the next crucial step is populating it with files. This chapter explores the process of uploading files to your IPFS node using a straightforward approach. 

Using an SFTP Client (e.g., WinSCP) for File Upload

Connecting to the IPFS Node via SFTP

Utilize an SFTP client, such as WinSCP, to establish a secure connection to your IPFS node. Input the relevant credentials, including the IP address of your server, username, and password. 

Transferring Files to the IPFS Node

Navigate to the designated directory for IPFS data storage, typically located at “/var/lib/ipfs/staging/.” In our example, we will upload the folder “testIpfsData” which contains some files to this directory.  

Pinning Files on IPFS

Understanding the Importance of Pinning

In the world of IPFS, pinning is akin to bookmarking – a crucial step to ensure the permanence and availability of your files on the network. When you pin a file, you make a commitment to host and share it, contributing to the decentralized nature of IPFS. 

Pinning Files

Execute the following command to recursively add and pin files to IPFS: 

ipfs add -r /export/testIpfsData

The output will provide you with the unique CID (Content Identifier) associated with the pinned content. 

Accessing Files via Browser

Generating IPFS Content Identifier (CID)

Retrieve the CID from the output of the pinning command. This unique identifier serves as the address for accessing your files on IPFS. 

Navigating and Retrieving Files through a Web Browser 

Construct the URL using the CID and the filename:

https://ipfs.io/ipfs/{CID}/{filenameInFolder}

Standard IPFS protocol format:

ipfs://{CID}/{filenameInFolder

Replace “{CID}” with the specific CID of your content and “{filenameInFolder}” with the name of the file you wish to access. This URL can be shared and accessed via any web browser, showcasing the decentralized and distributed nature of IPFS. 

Congratulations! With these steps, you’ve successfully uploaded, pinned, and accessed files on your IPFS node. 

For more details about IPFS Node hosting at Contabo, check out our corresponding IPFS landing page

There you will also find our predefined bundles for IPFS Node hosting that are: 

Storage VPS S: Ideal for hosting a Small Node 

Storage VPS M: Perfect for hosting a Medium Node 

Cloud VPS XL: Good for hosting a Large Node 

AMD Ryzen 12 Cores: The perfect solution for hosting a Gateway Node 

Scroll to Top