This topic explains how to install the Dragonfly server.
Install supernode in one of the following ways:
- Deploying with Docker.
- Deploying with physical machines: Recommended for production usage.
When deploying with Docker, the following conditions must be met.
Required Software | Version Limit |
---|---|
Git | 1.9.1+ |
Docker | 1.12.0+ |
When deploying with physical machines, the following conditions must be met.
Required Software | Version Limit |
---|---|
Git | 1.9.1+ |
Golang | 1.12.x |
Nginx | 0.8+ |
You can get it from DockerHub directly.
-
Obtain the latest Docker image ID of the supernode.
docker pull dragonflyoss/supernode:1.0.0
Or you can build your own supernode image.
-
Obtain the source code of Dragonfly.
git clone https://github.com/dragonflyoss/Dragonfly.git
-
Enter the project directory.
cd Dragonfly
-
Build the Docker image.
TAG="1.0.0" make docker-build-supernode DF_VERSION=$TAG
-
Obtain the latest Docker image ID of the supernode.
docker image ls | grep 'supernode' | awk '{print $3}' | head -n1
NOTE: Replace ${supernodeDockerImageId} with the ID obtained at the previous step.
docker run -d --name supernode --restart=always -p 8001:8001 -p 8002:8002 -v /home/admin/supernode:/home/admin/supernode ${supernodeDockerImageId} --download-port=8001
-
Download a binary package of the supernode. You can download one of the latest builds for Dragonfly on the github releases page.
version=1.0.0 wget https://github.com/dragonflyoss/Dragonfly/releases/download/v$version/Dragonfly_$version_linux_amd64.tar.gz
-
Unzip the package.
# Replace `xxx` with the installation directory. tar -zxf Dragonfly_1.0.0_linux_amd64.tar.gz -C xxx
-
Move the
supernode
to yourPATH
environment variable to make sure you can directly usesupernode
command.
Or you can build your own supernode executable file.
-
Obtain the source code of Dragonfly.
git clone https://github.com/dragonflyoss/Dragonfly.git
-
Enter the project directory.
cd Dragonfly
-
Compile the source code.
make build-supernode && make install-supernode
supernodeHomeDir=/home/admin/supernode
supernodeDownloadPort=8001
supernode --home-dir=$supernodeHomeDir --port=8002 --download-port=$supernodeDownloadPort
You can start a file server in any way. However, the following conditions must be met:
- It must be rooted at
${supernodeHomeDir}/repo
which is defined in the previous step. - It must listen on the port
supernodeDownloadPort
which is defined in the previous step.
And let's take nginx as an example.
-
Add the following configuration items to the Nginx configuration file.
server { # Must be ${supernodeDownloadPort} listen 8001; location / { # Must be ${supernodeHomeDir}/repo root /home/admin/supernode/repo; } }
-
Start Nginx.
sudo nginx
-
After supernode is installed, run the following commands to verify if Nginx and supernode are started, and if Port
8001
and8002
are available.telnet 127.0.0.1 8001 telnet 127.0.0.1 8002
-
Install the Dragonfly client and test if the downloading works.
dfget --url "http://${resourceUrl}" --output ./resource.png --node "127.0.0.1:8002=1"