manual, sysadmins, ipfs

This commit is contained in:
Mik-TF 2024-05-14 13:04:07 -04:00
parent 8f74e1e9bf
commit 3540d7d64d
2 changed files with 50 additions and 50 deletions

View File

@ -30,7 +30,7 @@ We start by deploying a full VM on the ThreeFold Playground.
* Minimum storage: 50GB * Minimum storage: 50GB
* After deployment, note the VM IPv4 address * After deployment, note the VM IPv4 address
* Connect to the VM via SSH * Connect to the VM via SSH
* ``` ```
ssh root@VM_IPv4_address ssh root@VM_IPv4_address
``` ```
@ -39,39 +39,39 @@ We start by deploying a full VM on the ThreeFold Playground.
We create a root-access user. Note that this step is optional. We create a root-access user. Note that this step is optional.
* Once connected, create a new user with root access (for this guide we use "newuser") * Once connected, create a new user with root access (for this guide we use "newuser")
* ``` ```
adduser newuser adduser newuser
``` ```
* You should now see the new user directory * You should now see the new user directory
* ``` ```
ls /home ls /home
``` ```
* Give sudo capacity to the new user * Give sudo capacity to the new user
* ``` ```
usermod -aG sudo newuser usermod -aG sudo newuser
``` ```
* Switch to the new user * Switch to the new user
* ``` ```
su - newuser su - newuser
``` ```
* Create a directory to store the public key * Create a directory to store the public key
* ``` ```
mkdir ~/.ssh mkdir ~/.ssh
``` ```
* Give read, write and execute permissions for the directory to the new user * Give read, write and execute permissions for the directory to the new user
* ``` ```
chmod 700 ~/.ssh chmod 700 ~/.ssh
``` ```
* Add the SSH public key in the file **authorized_keys** and save it * Add the SSH public key in the file **authorized_keys** and save it
* ``` ```
nano ~/.ssh/authorized_keys nano ~/.ssh/authorized_keys
``` ```
* Exit the VM * Exit the VM
* ``` ```
exit exit
``` ```
* Reconnect with the new user * Reconnect with the new user
* ``` ```
ssh newuser@VM_IPv4_address ssh newuser@VM_IPv4_address
``` ```
@ -81,19 +81,19 @@ We set a firewall to monitor and control incoming and outgoing network traffic.
For our security rules, we want to allow SSH, HTTP and HTTPS (443 and 8443). For our security rules, we want to allow SSH, HTTP and HTTPS (443 and 8443).
We thus add the following rules: We thus add the following rules:
* Allow SSH (port 22) * Allow SSH (port 22)
* ``` ```
sudo ufw allow ssh sudo ufw allow ssh
``` ```
* Allow port 4001 * Allow port 4001
* ``` ```
sudo ufw allow 4001 sudo ufw allow 4001
``` ```
* To enable the firewall, write the following: * To enable the firewall, write the following:
* ``` ```
sudo ufw enable sudo ufw enable
``` ```
* To see the current security rules, write the following: * To see the current security rules, write the following:
* ``` ```
sudo ufw status verbose sudo ufw status verbose
``` ```
You now have enabled the firewall with proper security rules for your IPFS deployment. You now have enabled the firewall with proper security rules for your IPFS deployment.
@ -109,23 +109,23 @@ If you want to run pubsub capabilities, you need to allow **port 8081**. For mor
We install the [IPFS Kubo binary](https://docs.ipfs.tech/install/command-line/#install-official-binary-distributions). We install the [IPFS Kubo binary](https://docs.ipfs.tech/install/command-line/#install-official-binary-distributions).
* Download the binary * Download the binary
* ``` ```
wget https://dist.ipfs.tech/kubo/v0.24.0/kubo_v0.24.0_linux-amd64.tar.gz wget https://dist.ipfs.tech/kubo/v0.24.0/kubo_v0.24.0_linux-amd64.tar.gz
``` ```
* Unzip the file * Unzip the file
* ``` ```
tar -xvzf kubo_v0.24.0_linux-amd64.tar.gz tar -xvzf kubo_v0.24.0_linux-amd64.tar.gz
``` ```
* Change directory * Change directory
* ``` ```
cd kubo cd kubo
``` ```
* Run the install script * Run the install script
* ``` ```
sudo bash install.sh sudo bash install.sh
``` ```
* Verify that IPFS Kubo is properly installed * Verify that IPFS Kubo is properly installed
* ``` ```
ipfs --version ipfs --version
``` ```
@ -134,23 +134,23 @@ We install the [IPFS Kubo binary](https://docs.ipfs.tech/install/command-line/#i
We initialize IPFS and run the IPFS daemon. We initialize IPFS and run the IPFS daemon.
* Initialize IPFS * Initialize IPFS
* ``` ```
ipfs init --profile server ipfs init --profile server
``` ```
* Increase the storage capacity (optional) * Increase the storage capacity (optional)
* ``` ```
ipfs config Datastore.StorageMax 30GB ipfs config Datastore.StorageMax 30GB
``` ```
* Run the IPFS daemon * Run the IPFS daemon
* ``` ```
ipfs daemon ipfs daemon
``` ```
* Set an Ubuntu systemd service to keep the IPFS daemon running after exiting the VM * Set an Ubuntu systemd service to keep the IPFS daemon running after exiting the VM
* ``` ```
sudo nano /etc/systemd/system/ipfs.service sudo nano /etc/systemd/system/ipfs.service
``` ```
* Enter the systemd info * Enter the systemd info
* ``` ```
[Unit] [Unit]
Description=IPFS Daemon Description=IPFS Daemon
[Service] [Service]
@ -163,27 +163,27 @@ We initialize IPFS and run the IPFS daemon.
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
* Enable the service * Enable the service
* ``` ```
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable ipfs sudo systemctl enable ipfs
sudo systemctl start ipfs sudo systemctl start ipfs
``` ```
* Verify that the IPFS daemon is properly running * Verify that the IPFS daemon is properly running
* ``` ```
sudo systemctl status ipfs sudo systemctl status ipfs
``` ```
## Final Verification ## Final Verification
We reboot and reconnect to the VM and verify that IPFS is properly running as a final verification. We reboot and reconnect to the VM and verify that IPFS is properly running as a final verification.
* Reboot the VM * Reboot the VM
* ``` ```
sudo reboot sudo reboot
``` ```
* Reconnect to the VM * Reconnect to the VM
* ``` ```
ssh newuser@VM_IPv4_address ssh newuser@VM_IPv4_address
``` ```
* Check that the IPFS daemon is running * Check that the IPFS daemon is running
* ``` ```
ipfs swarm peers ipfs swarm peers
``` ```
## Questions and Feedback ## Questions and Feedback

View File

@ -31,7 +31,7 @@ We start by deploying a micro VM on the ThreeFold Playground.
* Minimum storage: 50GB * Minimum storage: 50GB
* After deployment, note the VM IPv4 address * After deployment, note the VM IPv4 address
* Connect to the VM via SSH * Connect to the VM via SSH
* ``` ```
ssh root@VM_IPv4_address ssh root@VM_IPv4_address
``` ```
@ -40,11 +40,11 @@ We start by deploying a micro VM on the ThreeFold Playground.
We install the prerequisites before installing and setting IPFS. We install the prerequisites before installing and setting IPFS.
* Update Ubuntu * Update Ubuntu
* ``` ```
apt update apt update
``` ```
* Install nano and ufw * Install nano and ufw
* ``` ```
apt install nano && apt install ufw -y apt install nano && apt install ufw -y
``` ```
@ -57,20 +57,20 @@ For our security rules, we want to allow SSH, HTTP and HTTPS (443 and 8443).
We thus add the following rules: We thus add the following rules:
* Allow SSH (port 22) * Allow SSH (port 22)
* ``` ```
ufw allow ssh ufw allow ssh
``` ```
* Allow port 4001 * Allow port 4001
* ``` ```
ufw allow 4001 ufw allow 4001
``` ```
* To enable the firewall, write the following: * To enable the firewall, write the following:
* ``` ```
ufw enable ufw enable
``` ```
* To see the current security rules, write the following: * To see the current security rules, write the following:
* ``` ```
ufw status verbose ufw status verbose
``` ```
@ -91,23 +91,23 @@ If you want to run pubsub capabilities, you need to allow **port 8081**. For mor
We install the [IPFS Kubo binary](https://docs.ipfs.tech/install/command-line/#install-official-binary-distributions). We install the [IPFS Kubo binary](https://docs.ipfs.tech/install/command-line/#install-official-binary-distributions).
* Download the binary * Download the binary
* ``` ```
wget https://dist.ipfs.tech/kubo/v0.24.0/kubo_v0.24.0_linux-amd64.tar.gz wget https://dist.ipfs.tech/kubo/v0.24.0/kubo_v0.24.0_linux-amd64.tar.gz
``` ```
* Unzip the file * Unzip the file
* ``` ```
tar -xvzf kubo_v0.24.0_linux-amd64.tar.gz tar -xvzf kubo_v0.24.0_linux-amd64.tar.gz
``` ```
* Change directory * Change directory
* ``` ```
cd kubo cd kubo
``` ```
* Run the install script * Run the install script
* ``` ```
bash install.sh bash install.sh
``` ```
* Verify that IPFS Kubo is properly installed * Verify that IPFS Kubo is properly installed
* ``` ```
ipfs --version ipfs --version
``` ```
@ -116,15 +116,15 @@ We install the [IPFS Kubo binary](https://docs.ipfs.tech/install/command-line/#i
We initialize IPFS and run the IPFS daemon. We initialize IPFS and run the IPFS daemon.
* Initialize IPFS * Initialize IPFS
* ``` ```
ipfs init --profile server ipfs init --profile server
``` ```
* Increase the storage capacity (optional) * Increase the storage capacity (optional)
* ``` ```
ipfs config Datastore.StorageMax 30GB ipfs config Datastore.StorageMax 30GB
``` ```
* Run the IPFS daemon * Run the IPFS daemon
* ``` ```
ipfs daemon ipfs daemon
``` ```
@ -133,19 +133,19 @@ We initialize IPFS and run the IPFS daemon.
We set the IPFS daemon with zinit. This will make sure that the IPFS daemon starts at each VM reboot or if it stops functioning momentarily. We set the IPFS daemon with zinit. This will make sure that the IPFS daemon starts at each VM reboot or if it stops functioning momentarily.
* Create the yaml file * Create the yaml file
* ``` ```
nano /etc/zinit/ipfs.yaml nano /etc/zinit/ipfs.yaml
``` ```
* Set the execution command * Set the execution command
* ``` ```
exec: /usr/local/bin/ipfs daemon exec: /usr/local/bin/ipfs daemon
``` ```
* Run the IPFS daemon with the zinit monitor command * Run the IPFS daemon with the zinit monitor command
* ``` ```
zinit monitor ipfs zinit monitor ipfs
``` ```
* Verify that the IPFS daemon is running * Verify that the IPFS daemon is running
* ``` ```
ipfs swarm peers ipfs swarm peers
``` ```
@ -154,11 +154,11 @@ We set the IPFS daemon with zinit. This will make sure that the IPFS daemon star
We reboot and reconnect to the VM and verify that IPFS is properly running as a final verification. We reboot and reconnect to the VM and verify that IPFS is properly running as a final verification.
* Reboot the VM * Reboot the VM
* ``` ```
reboot -f reboot -f
``` ```
* Reconnect to the VM and verify that the IPFS daemon is running * Reconnect to the VM and verify that the IPFS daemon is running
* ``` ```
ipfs swarm peers ipfs swarm peers
``` ```