6
头图

Author: little brother Fu
Blog: https://bugstack.cn

Precipitate, share, and grow, so that you and others can gain something! 😄

I. Introduction

Why use a self-built cloud disk, the cloud disk on the market is not good?

Behind every user's demand is the existence of scenes, and these differentiated scenes are also produced because of different user types.

For example, as a technical account owner, I want to share some of the information I summarized. After I put it on some cloud disks, I will sometimes be reported by other friends who don’t know where it came from. The report link is cancelled, and the link is cancelled. Affected my data sharing. At the same time, I may also hope that my shared content can be recorded in the number of downloads, how many downloads are allowed, whether to do some drainage actions when downloading, and so on.

Therefore, in special scenarios like this, you need to build your own network disk to maintain the information you need. Similarly, some companies or organizations will build relatively private domain network disk function service functions for internal users.

So , it is not necessarily that the online disk on the market is not popular, it is just because I need to build my own online disk. I have tried self-built, kodexplorer, Owncloud, etc. on this road, and it happens that I recently discovered Cloudreve after trying to experience it, and it feels more delicious and supports more functions. Therefore, I am going to share with my friends about the installation, configuration and use of Cloudreve, so that those in need can try it out.

2. Introduction to Cloudreve

Cloudreve , to help you quickly build a public and private network disk system at the lowest cost.

🔉 Features

✨ Features

  • ☁️ Support local, slave, Qiniu, Alibaba Cloud OSS, Tencent Cloud COS, Youpaiyun, OneDrive (including 21Vianet version) as the storage terminal
  • 📤 Upload/download support client-side direct upload, support download speed limit
  • 💾 Can be docked with Aria2 offline download
  • 📚 Online compression/decompression, multi-file download
  • 💻 WebDAV protocol support covering all storage strategies
  • ⚡ Drag and drop upload, directory upload, streaming upload processing
  • 🗃️ File drag and drop management
  • 👩‍👧‍👦 Multi-user, user group
  • 🔗 Create sharing links for files and directories, and set automatic expiration
  • 👁️‍🗨️ Video, image, audio, text, Office document online preview
  • 🎨 Custom color matching, dark mode, PWA application, site-wide single page application
  • 🚀 All-In-One packaged, ready to use out of the box

📌 Information

  1. Official website: https://cloudreve.org
  2. Document: https://docs.cloudreve.org/getting-started/install
  3. Community: https://forum.cloudreve.org
  4. Source code: https://github.com/cloudreve/Cloudreve
  5. Demo: https://demo.cloudreve.org

Three, environmental preparation

  1. Cloud server resource or local server, recommend Tencent Cloud lightweight server, which contains pagoda components, which is the simplest among several cloud services: https://console.cloud.tencent.com/lighthouse/instance/index
  2. For the registered domain name, if you do not need domain name access, you can directly use the public IP provided by the cloud service
  3. Cloudreve installation package: https://github.com/cloudreve/Cloudreve/releases

The case in this chapter is based on Tencent Cloud. If you are using other cloud servers, just find the corresponding location configuration. The usage of these cloud services is basically the same, you can contact the corresponding cloud service customer service if you encounter problems, don’t contact me hahaha 😄

Fourth, the pagoda configuration

Pagoda is a simple and easy-to-use Linux/Windows server operation and maintenance management panel. The security software and configuration environment can be very convenient on the Pagoda background page. Generally, pagodas can be installed on cloud servers, and some manufacturers have integrated pagodas into their own cloud servers.

1. Get username and password

  • Address: https://console.cloud.tencent.com/lighthouse/instance/detail?rid=8&id=lhins-90pixwzq&tab=application
  • Entering the application management of the service, you will see the app software information: Pagoda, click here log in to button, you will get the pagoda login address, user name and password information " These information can be later modified in the pagoda background."

     * Socket connection established *
     Last login: Sat Apr 10 09:33:50 2021 from 119.29.96.147
     [lighthouse@VM-8-9-centos ~]$ sudo /etc/init.d/bt default
     ==================================================================
     BT-Panel default info!
     ==================================================================
     外网面板地址: http://80.71.255.122:8888/cloudtencent
     内网面板地址: http://10.0.8.9:8888/cloudtencent
     *以下仅为初始默认账户密码,若无法登录请执行bt命令重置账户/密码登录
     username: 3kkjecc3
     password: 3f7d2743018b
     If you cannot access the panel,
     release the following panel port [8888] in the security group
     若无法访问面板,请检查防火墙/安全组是否有放行面板[8888]端口
     ==================================================================

2. 8888 port authorization

  • After obtaining the user name and password of the panel, you cannot directly access it because your port has not been authorized to open.
  • At this time, you can click on the firewall configuration on the cloud service platform to add port 8888.

3. Log in to the pagoda backstage

Address: http://80.71.255.122:8888/cloudtencent - you need to replace your own address
Note: There will be some prompts and software installation when entering the pagoda for the first time, just choose the installation you need.
page:

Five, service installation

There is a terminal menu on the left menu bar of the pagoda panel. Clicking to enter is a black window, and then we will install the entire service here.

1. View the service kernel in the pagoda terminal

Because different cloud services may be adm or arm architecture, the corresponding downloaded Cloudreve will also be different cloudreve_version number_operating system_CPU architecture.tar.gz, so here we need to use the arch command to view the service information.

Last failed login: Sat Apr 10 11:38:41 CST 2021 from 194.165.16.68 on ssh:notty
There were 8 failed login attempts since the last successful login.
Last login: Sat Apr 10 09:57:33 2021 from 127.0.0.1
[root@VM-8-9-centos ~]# arch
x86_64
  • x86_64: stands for amd64
  • aarch64: stands for arm64

2. Download and install

After determining our cloud service architecture, select the corresponding Cloudreve version and copy the address. Mine is: https://github.com/cloudreve/Cloudreve/releases/download/3.3.1/cloudreve_3.3.1_linux_amd64.tar.gz

installation command

mkdir /www/wwwroot/cloudreve    # 创建一个新文件夹存放程序
cd /www/wwwroot/cloudreve           # 进入这个文件夹
wget https://github.com/cloudreve/Cloudreve/releases/download/3.3.1/cloudreve_3.3.1_linux_amd64.tar.gz # 下载你复制的链接
tar -zxvf cloudreve_3.3.1_linux_amd64.tar.gz   # 解压获取到的主程序
chmod +x ./cloudreve                                           # 赋予执行权限
./cloudreve                                                          # 启动 Cloudreve

# 运行信息截取
[Info]    2021-04-10 10:39:59 初始化数据库连接
[Info]    2021-04-10 10:39:59 开始进行数据库初始化...
[Info]    2021-04-10 10:39:59 初始管理员账号:admin@cloudreve.org
[Info]    2021-04-10 10:39:59 初始管理员密码:U4BfStlm
[Info]    2021-04-10 10:40:00 数据库初始化结束
[Info]    2021-04-10 10:40:00 初始化任务队列,WorkerNum = 10
[Info]    2021-04-10 10:40:00 初始化定时任务...
[Info]    2021-04-10 10:40:00 当前运行模式:Master
[Info]    2021-04-10 10:40:00 开始监听 :5212
  • wget, replace with your Cloudreve address
  • tar is to replace the corresponding names together
  • Finally, copy these commands to your black terminal window, and it will start to run and install. installation of 160792ef223d44 is complete, you will get an initial user name and password, copy and paste to save it

3. Open port 5212

  • After Cloudreve installation is complete, the access address is your service IP: 5212, but at this time 5212 cannot be accessed directly and requires authorization.
  • It is not enough to authorize only in the background of the pagoda. You also need to authorize in the firewall of the cloud service platform, as follows:

4. Log in to the service

  • If everything goes well, you can now use your own network disk, but one thing to know if you still need to set the domain name, then do not use it at this time, first set the domain name, otherwise some pictures will be uploaded under the IP and uploaded under the domain name , Sharing is problematic.

Six, process daemon

In fact, it can be used normally after the service is installed, but it is difficult for us to guarantee that the pagoda panel will not be restarted or if an abnormality occurs, we will inevitably have to restart the cloud disk service by ourselves. Then, a daemon is needed to automatically restart the service.

In the software store of the pagoda panel, find Supervisor installation. Supervisor is a set of general process management programs developed in Python, which can turn a common command line process into a background daemon, monitor the process status, and automatically restart when it exits abnormally.

1. Supervisor configuration

  • Name: Cloudreve
  • Start user: root default
  • Operating directory: /www/wwwroot/cloudreve/
  • Start command: /www/wwwroot/cloudreve/cloudreve

2. Supervisor startup

  • After configuring the daemon, click Restart in the upper right corner of the pagoda panel, and restart the service
  • After restarting and then entering the pagoda panel, you will see that the daemon has been started, and now the startup is handed over to Supervisor management

Seven, configure the domain name

1. Resolve domain names

  • Before configuring the domain name, you need to configure an A record resolution under the domain name you have prepared, so that you can configure the reverse proxy later.

2. Reverse proxy

  • website button in the menu on the left side of the pagoda panel to add a site. The domain name in the site is the information when configuring the domain name resolution, mine is pan.itedus.cn
  • After configuring the site, you need to set up a reverse proxy for this site, click its settings to enter. Add and set the target URL in the reverse proxy: 127.0.0.1:5212
  • Finally, if your domain name has been resolved, you can now access your cloud disk service through the domain name, and you can upload and share files. For example, the file I shared: http://pan.itedus.cn/s/qofO

Eight, database switching

The default database of the system is the built-in SQLite, you can change it to Mysql, as follows:

  1. Database type, currently supports sqlite | mysql

Type = mysql

  1. username

User = Cloudreve

  1. password

Password = Cloudreve

  1. Database address

Host = 127.0.0.1

  1. Name database

Name = Cloudreve

  1. Data table prefix

TablePrefix = cd_

  • After switching, remember to use the command to restart, because at this time it needs to re-create the account and password
  • If you don’t see the account and password, you can delete the created database and try again

Nine, summary

  • The installation and use of Cloudreve cloud disk is demonstrated here. If you are interested, you can also build one yourself. In addition, Cloudreve can obtain its source code, and add some desired functions to the source code, such as setting it to pay attention to certain things during downloading and so on.
  • In addition to the Cloudreve cloud disk, you can also try to download Daoyun. This cloud disk can be installed directly on a simple server, or it can be automatically upgraded. It will be easier to use.
  • Whether it is cloud services or various tools, try more of these things, and you can increase your understanding of many other aspects of knowledge. Maybe you do it, you are not just a simple CRUD development engineer, it may be operation and maintenance, products, and business!

10. Series recommendation


小傅哥
4.7k 声望28.4k 粉丝

CodeGuide | 程序员编码指南 - 原创文章、案例源码、资料书籍、简历模版等下载。