Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build an offline download server for VPS

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to build VPS offline download server, I hope you have something to gain after reading this article, let's discuss it together!

motivation

Due to the need of learning, a foreign server manufacturer purchased vps service (so which manufacturer did not say). However, even if it is used as a ladder, the flow of 1 T a month will never be used up. Most feel nutritious, want to find some movies to see.

But now the speed of Baidu online disk is really touching, a year's Baidu online disk super members are too expensive, and Baidu's offline download is not really offline, he just pulls some files on his server to you. If you want to find some scarce resources, Baidu online disk is a chicken rib ah, drop!

Well, can you use vps to build your own offline download server? This can not only make use of excess bandwidth resources, but also improve the download speed, isn't it beautiful! With this doubt, I began to build on a lonely night.

Building process

Machine configuration

Release: CentOS 6.9

RAM: 512M

CPU: single core

Bandwidth: 1000Mbps

The configuration of this machine is not high, and it is more than enough to be a download server.

Tool selection

After some search, transmission + vsftpd + nginx + aria2c is selected as the deployment tool.

Transmission, transmission-daemon: as a seed, magnetic client, as the core tool for offline download.

Vsftpd: used to build ftp to manage file downloads (poor vps has only 10G of disk space)

Nginx: high-performance nginx is used as a static file server.

Aria2c: a multithreaded downloader that downloads our offline files at high speed from the list of files displayed in nginx.

Deployment practice

1. Install transmission, modify the configuration and start the service

Install transmission and transmission-daemon

$wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

$rpm-ivh epel-release-6-8.noarch.rpm

$yum-y upgrade

$yum-y install transmission transmission-daemon

Modify the configuration and start the transmission service

The settings.json file under the path / var/lib/transmission/.config/transmission is the configuration file for transmission.

There are a lot of configurations in it. We need to modify the following configuration so that we can use remote software to manipulate our tranmission

"rpc-authentication-required": true

"rpc-enabled": true

"rpc-password": "password for remote calls"

"rpc-whitelist-enabled": false

"rpc-username": "user name for remote invocation"

Start the transmission service

$sudo service transmission-daemon start

So we can access the transmission service through http://host_ip:9091. After a test, the speed is still OK, and the peak speed has 30MB/s.

In addition, we can also install Transmission-Remote-GUI to control transmission without visiting the page, which can be downloaded from the app store under Linux (Mint). The operation mode and uTorrent are similar to the UI interface:

2. Build ftp server with vsftpd

Build ftp server is not used to download files, download files through ftp found that the speed is very slow. Therefore, the role of the ftp server is to manage files, generally speaking, delete operations.

Install vsftpd

$yum install-y vsftpd

We use Linux users to log in instead of virtual users (because it is troublesome to install the database)

Because vsftpd does not allow login using root by default, we need to add users

Add user

$useradd ftpuser

$passwd ftpuser

Modify home directory of ftpuser to download directory of transmission

$usermod-d / var/lib/transmission/Downloads ftpuser

$rm-rf / home/ftpuser

Modify vsftpd configuration file (/ etc/vsftpd/vsftpd.conf)

The configuration file is as follows:

# generate using cat vsftpd.conf | grep-v "#"

Anonymous_enable=NO

Local_enable=YES

Write_enable=YES

Local_umask=022

Dirmessage_enable=YES

Xferlog_enable=YES

Connect_from_port_20=YES

Xferlog_std_format=YES

Ftpd_banner=Welcome to Private FTP service.

Chroot_list_enable=NO

Listen_ipv6=YES

Pam_service_name=vsftpd

Userlist_enable=YES

Tcp_wrappers=YES

Local_root=/var/lib/transmission/Downloads

The configuration chroot_list_enable=NO indicates that usefulness is not allowed to switch out of the home directory.

Start vsftpd

Sudo service vsftpd start

In this way, we can use ftp to manage the files downloaded by transmission.

3. Build a static file server with nginx

Use nginx as a server for static resources to provide a display of downloaded resources

There are a lot of tutorials on how to install nginx. As a follow-up filling.

Mainly talk about configuration.

Modify this under the configuration file of nginx (/ etc/nginx/conf.d/default.conf)

Autoindex on;autoindex_exact_size on;autoindex_localtime on;server {listen 8090; listen [:]: 8090; server_name localhost; charset utf-8; location / {root / var/lib/transmission/Downloads; index index.html index.htm;}

Start the nginx service and you can get the file list through port 8090.

4. Aria2c download file

Aria2c is used to download files from the server and install them on your own machine.

Mainly talk about how to speed up downloading through aria2c multithreading.

There are several parameters in aria2c related to multithreaded downloads

Parameter x:-- maximum number of connections per server for max-connection-per-server=,. Default is 1.

Parameter s:-- split=, refers to the number of download connections per file. By default, 5 is limited to-x. If s is greater than 5 by default, x will also be limited to s.

Therefore, for large files, properly increasing the x and s parameters can improve the download speed.

After reading this article, I believe you have a certain understanding of "how to build an offline download server for VPS". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report