Ratodo

夜半观星

我的花园到处是星星的碎片
telegram
github
email
nintendo switch

NextCloud Setup & Aria2 Offline

Introduction#

There are already many tutorials on building NextCloud online. This tutorial is based on my experience in setting up NextCloud and is provided for reference.

NextCloud is introduced here using the snap installation method due to its excellent cross-platform collaboration capabilities and simple and easy-to-use interface.

P.S. The server used in this article is LightSail in Japan, and the operating system is Ubuntu 18.04.

Installation Process#

Log in to the server and obtain root privileges

sudo -i

Enter the following commands

sudo apt-get update
sudo apt-get install
snap sudo apt-get install snapd
sudo snap install nextcloud

After waiting for a moment, the following message will appear to indicate a successful installation

Pic1

Enter the server IP address in the browser to enter the configuration interface

Pic2

At this point, the installation process is complete

Enable HTTPS#

After completing the installation of the NextCloud server, proceed to set up the domain name.

First, make sure to resolve the domain name to the IP address of your server in advance. It is best to wait until the resolution is successful before proceeding to the next step.

Enter the following code to apply for a Let's Encrypt certificate:

sudo nextcloud.enable-https lets-encrypt

Pic3

There was a problem at this step. After deploying the certificate, I couldn't access my domain name and IP address. This problem was resolved after uninstalling and reinstalling.

P.S. Uninstall command: snap remove nextcloud
After reinstalling, you need to reapply for the certificate command

At this time, accessing through the domain name will display an untrusted domain, as shown in the figure below:

Pic4

At this time, you only need to enter the following command

Replace domain.com with your own domain name. If you need to add a domain name, change 1 to 2, and so on

sudo nextcloud.occ config:system:set trusted_domains 1 --value=domain.com

This way, you can access it normally, and NextCloud is now ready to use.

Using Aria2 for Offline Downloads#

If you can use the server to download videos and other resources offline, you can achieve adventure downloads, which means you can watch them instantly. However, please do not violate the laws and regulations of the country where the server is located, otherwise, the server may be shut down for violating TOS rules.

First, click on the avatar in the upper right corner, select "Apps", and then click on the disabled app to enable "External storage support".

Go back to the server and install Aria2:

wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/aria2.sh && chmod +x aria2.sh && bash aria2.sh

Pic5

Next, modify the download storage path of Aria2. Open: vi /root/.aria2/aria2.conf and find: dir=XXX. It is recommended to modify it to /var/snap/nextcloud/common/nextcloud/data/xxx/files/Downloads (where xxx is the username used during installation)

Pic6

It is also recommended to change the RPC token to a memorable string.

Pic7

After modifying, run service aria2 restart to restart the aria2 service.

Now return to the NextCloud settings page, click on "External storage" under "Administration", and add the local external storage you just created.

Pic8

Next, download an Aria2 visualization program
(The following content is quoted from 挖站否)

Quotation begins

AriaNg project:

Project: https://github.com/mayswind/AriaNg
Download: https://github.com/mayswind/AriaNg/releases/latest

AriaNg is a frontend (HTML+JS static) control panel. It does not need to be placed on the same server or device as Aria2 (backend/server). You can directly download it to your local computer, unzip it, and open index.html, or put it on a server for access. The server only needs Nginx or Apache.

Click to open AriaNg settings and fill in the RPC alias, address, protocol, request method, and key. Fill in the RPC address with the IP or domain name, the default port is 6800, and the key is the one you just modified in the configuration file. (Click to enlarge)

Pic9

After completing the settings, click on "Aria2 Status" and you will see that Aria2 has connected successfully. If it fails to connect, check if the firewall of the VPS has opened two ports, one is the RPC listening port 6800 (default), and the other is the BT listening port 51413 (default). Of course, after modifying the configuration file, remember to restart the VPS.

Pic9

Open the AriaNg panel, and you can add HTTP BT magnet links to start downloading.

Pic9

Since we are using a VPS host to download resources, the speed can be very fast.

Pic9

Quotation ends

!! Remember to confirm if the download location is set correctly !!

The downloaded files may not be displayed immediately in NextCloud. You need to use the built-in occ function of NextCloud to refresh the files in the folder.

First, create an executable file in the root directory

vi /root/nextcloud.sh

Enter the following content

#!/bin/bash
sudo nextcloud.occ files:scan --all

Save and exit

Give it permission, chmod 777 nextcloud.sh

Run crontab -e and press Enter

Add the following code below:

*/1 * * * * /root/nextcloud.sh

Press Ctrl+X to exit, press Y to confirm, and press Enter. The above command means that nextcloud.sh will be executed every minute. You can also change it to 2 minutes or 30 minutes according to your actual needs.

Summary#

It is not recommended to use a server in Japan for BT downloads, as it is easy to crash~

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.