Installing SFTPGo on Ubuntu Server

Here is a step-by-step tutorial to guide you through the installation of SFTPGo on Ubuntu Server:

Prerequisites

Before installing SFTPGo, you will need:

Step 1: Install Dependencies

First, update the Ubuntu package manager and install the required dependencies:

sudo apt-get update
sudo apt-get install -y git curl make gcc

Step 2: Install Go

SFTPGo is written in Go language, so you need to install it first. You can download Go from the official website, or install it using the following commands:

cd ~
curl -O https://storage.googleapis.com/golang/go1.17.1.linux-amd64.tar.gz
sudo tar -zxvf go1.17.1.linux-amd64.tar.gz -C /usr/local

Once the installation is done, set up the Go environment by adding the following lines to your ~/.bashrc file:

export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

Reload your ~/.bashrc file with the following command:

source ~/.bashrc

Step 3: Clone SFTPGo repository

Clone the SFTPGo repository using the following command:

git clone https://github.com/drakkan/sftpgo.git

Step 4: Building SFTPGo

Change the directory to the cloned repository:

cd sftpgo

Now, build the SFTPGo binary using the following command:

make build

After a successful build, you should get a binary file named sftpgo in the bin directory.

Step 5: Configure SFTPGo

Create a configuration file named sftpgo.json in the bin directory using your favorite text editor and configure it according to your needs. You can refer to the example configuration file provided in the config directory.

Step 6: Running SFTPGo

You can start SFTPGo by running the following command from the bin directory:

sudo ./sftpgo serve -config sftpgo.json

You can also start SFTPGo as a background service by creating a systemd unit file. Create a new file named sftpgo.service in the /etc/systemd/system/ directory with the following content:

[Unit]
Description=SFTPGo Service
After=network.target

[Service]
Type=simple
ExecStart=/path/to/sftpgo/bin/sftpgo serve -config /path/to/sftpgo.json
Restart=on-failure

[Install]
WantedBy=multi-user.target

Replace /path/to/sftpgo with the actual path to the SFTPGo installation directory and /path/to/sftpgo.json with the actual path to your configuration file.

Save the file and reload systemd configuration by running the following command:

sudo systemctl daemon-reload

Start the SFTPGo service using the following command:

sudo systemctl start sftpgo.service

You can check the status of the service using the following command:

sudo systemctl status sftpgo.service

Conclusion

SFTPGo is now installed and running on your Ubuntu Server. You can create new users, set up permissions, and manage your SFTP server by modifying the configuration file. Happy file transferring!

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!