Blog: bugstack.cn

Precipitation, share, grow, let yourself and others can gain something! 😄

One, foreword

Why should use self-built network disk, the cloud disk on the market is not fragrant?

There are scenarios behind every user demand, and these differentiated scenarios are generated by different user types.

Just like I want to share some of my own summarized information as a technical number of the main, after some cloud disk will sometimes be other friends do not know where to come out to report, report link cancelled, cancelled link will affect my data sharing. I might also want my content to be recorded in terms of how many downloads I have, how many downloads I have allowed, whether OR not I have to do some drainage while downloading, etc.

So similar to this special scenario will need to build their own network disk to maintain personal data needs, and similar to some companies or organizations will build relatively private domain network disk function service function, for internal users to use.

Therefore, it is not certain that the market is not fragrant, just because I need to build their own network disk. Along the way, I have tried self-built, Kodexplorer, Owncloud, and recently found that Cloudreve is more enjoyable and supports more features. Therefore, I am ready to share the installation, configuration and use of Cloudreve with friends, and let those who need it have a try.

Introduction to Cloudreve

Cloudreve helps you quickly build a public and private web disk system at the lowest cost.

🔉 function

✨ features

  • ☁️ supports local machine, slave machine, qiniu, Ali Cloud OSS, Tencent cloud COS, Youpai cloud, OneDrive (including century Interconnection version) as storage end
  • 📤 Upload/download Support client direct transmission, support download speed limit
  • 💾 Can be connected to Aria2 for offline download
  • 📚 Online compression/decompression, multi-file package download
  • 💻 overrides WebDAV protocol support for all storage policies
  • ⚡ Drag upload, directory upload, streaming upload processing
  • 🗃️ File drag and drop management
  • 👩👧👦 Multiple users and user groups
  • 🔗 Create links to share files and directories and set them to expire automatically
  • 👁️🗨️ Preview videos, images, audio, texts, and Office documents online
  • 🎨 Custom color matching, Dark mode, PWA application, site-wide single page application
  • 🚀 all-in-one packaging, out of the box

📌 data

  1. Website: cloudreve.org
  2. Documents: docs.cloudreve.org/getting-sta…
  3. Community: forum.cloudreve.org
  4. Source: github.com/cloudreve/C…
  5. Presentation: demo.cloudreve.org

Three, environmental preparation

  1. Cloud server resources or the local server, recommend tencent lightweight servers of cloud, containing pagoda component, may be a few cloud services in the most simple: console.cloud.tencent.com/lighthouse/…
  2. If you do not need to access a registered domain name, you can directly use the public IP address provided by the cloud service
  3. Cloudreve Installation package: github.com/cloudreve/C…

The case in this chapter is based on Tencent cloud. If you use other cloud servers, find the corresponding location configuration. These cloud services are basically the same, encounter problems can contact the corresponding cloud service customer service, do not contact me hahaha 😄

Four, pagoda configuration

Pagoda is a simple Linux/Windows server operation and maintenance management panel, in the pagoda background page can be very convenient security software and configuration environment. It is generally possible to install pagodas on cloud servers, and some vendors have integrated pagodas into their own cloud servers.

1. Obtain the user name and password

  • Address: console.cloud.tencent.com/lighthouse/…
  • Enter the application management of the serviceIn-app software information: pagodaClick hereThe loginClick the button to get the pagoda’s login address, user name and password information.This information can be modified later in the pagoda background“.
     * Socket connection established *
     Last login: Sat Apr 10 09:33:50 2021 from 119.2996.147.
     [lighthouse@VM-8-9-centos ~]$ sudo /etc/init.d/bt default
     ==================================================================
     BT-Panel defaultinfo! = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = the network panel address: HTTP:/ / 80.71.255.122:8888 / cloudtencentIntranet panel address: HTTP:/ / 10.0.8.9:8888 / cloudtencent* The following is only the initial default account password. If you cannot log in, run the bt command to reset the account/password. 3f7d2743018b If you cannot access the panel, release the following panel port [8888] In the security group If you cannot access the panel, check whether the firewall/security group has the permit panel [8888] port = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =Copy the code

2. Authorize port 8888

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

3. Log in to the pagoda background

Address: http://80.71.255.122:8888/cloudtencent – you need to change to your address Explanation: the first time into the pagoda there are some hints and software installation, installation can choose their own needs. Page:

Five, service installation

There is a terminal menu in the left menu bar of the pagoda panel. Click into it is a black window, and then we will install the whole service here.

1. View the service kernel on the pagoda terminal

Cloudreve_version _ OS _CPU architecture.tar. gz. Therefore, 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.16516.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. 01.
[root@VM-8-9-centos ~]# arch
x86_64
Copy the code
  • X86_64: indicates AMD64
  • Aarch64: indicates arm64

2. Download and install

After determining our cloud service architecture, select the corresponding Cloudreve version and copy the address. Mine is: github.com/cloudreve/C…

Install command

Mkdir/WWW /wwwroot/cloudreve/WWW /wwwroot/cloudreve/ / github.com/cloudreve/Cloudreve/releases/download/3.3.1/cloudreve_3.3.1_linux_amd64.tar.gz # link to download your copy
tar -zxvf cloudreve_33.Chmod +x./cloudreve +x./cloudreve +x./cloudreve #2021-04-10 10:39:59Initializing a database connection [Info]2021-04-10 10:39:59Start database initialization... [Info]2021-04-10 10:39:59The initial administrator account is admin@cloudreve.org
[Info]    2021-04-10 10:39:59Initial administrator password: U4BfStlm [Info]2021-04-10 10:40:00Database initialization is complete. [Info]2021-04-10 10:40:00Initialize the task queue, WorkerNum =10
[Info]    2021-04-10 10:40:00Initialize a scheduled task... [Info]2021-04-10 10:40:00Current operating mode: Master [Info]2021-04-10 10:40:00Start listening:5212
Copy the code
  • Wget, instead of your Cloudreve address
  • Tar is replaced with the corresponding name
  • Finally, copy these commands to your terminal’s black window and it will start the installation. Once the installation is complete you will get an initial username and password, copy and paste it and save it

3. Open port 5212

  • After Cloudreve is installed, the access address will be your service IP:5212, but at this point 5212 is not directly accessible and requires authorization.
  • Authorization is not enough only in the background of pagoda, but also in the firewall of cloud service platform, as follows:

4. Log in to the service

  • Address: http://80.71.255.122:5212

  • If everything goes well now you can use your own network disk, but there is a point to know that if you also need to set up the domain name, so this time do not use, first to set up the domain name, otherwise some pictures under THE IP upload and under the domain name upload, sharing is a problem.

6. Process daemon

In fact, after the service installation is completed, it can be used normally, but we are difficult to ensure that the pagoda panel is not restarted or abnormal will inevitably require us to restart the cloud disk service. Then you need a daemon to automatically restart the service.

In the Software store of the Pagoda panel, locate the Supervisor installation. Supervisor is a universal process manager program developed in Python. It changes a common command line process into a background daemon, monitors the process status, and automatically restarts when an abnormal exit occurs.

1. The Supervisor configuration

  • Name: Cloudreve
  • Boot user: rootThe default
  • Run directory: / WWW /wwwroot/cloudreve/
  • Start the command: / WWW/below/cloudreve/cloudreve

2. The Supervisor

  • After the daemons are configured, click restart in the upper right corner of the pagoda panel to enterRestart the service
  • After you restart, enter the pagoda panel and see that the daemon is already started. It is now up to the Supervisor to start the daemon

7. Configure the domain name

1. Resolve the domain name

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

2. Reverse proxy

  • Click on the menu to the left of the pagoda panelWeb siteButton to add a site. The domain name in the site is the information configured to resolve the domain name, mine ispan.itedus.cn
  • After configuring the site, you need to set up a reverse proxy for the site, click on its Settings to enter. Add and set the destination 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, as well as upload and share files. For example, the file I shared: pan.itedus.cn/s/qofO

8. Database switching

The default database is SQLite, you can change it to Mysql, as follows:

  1. Sqlite | mysql database type, the current support

Type = mysql 2. Username = Cloudreve 3. Password = Cloudreve 4. Database address Host = 127.0.0.1 5. Database Name Name = Cloudreve 6. TablePrefix TablePrefix = cd_

  • After the switch, use the command to restart the system, because it needs to re-create the account and password
  • If you don’t see the account and password, delete the database and start again

Nine,

  • About the installation and use of Cloudreve cloud disk demo here, if you are interested in also can build a. In addition, Cloudreve has access to its source code, which can be used to add some desired features, such as setting the download to focus on something being downloaded and so on.
  • In addition to Cloudreve cloud disk can also try youdao cloud, the cloud disk directly on a simple server can be directly installed, can also be automatically upgraded, use will be simple.
  • Whether it’s a cloud service or a variety of tools, try something like this to increase your understanding of other areas of knowledge. Along the way, you may become more than just a CRUD developer. You may become operations, product, business!

X. Series recommendation

  • Another kind of cloud network disk construction, is also very good
  • Build 4 a day, little Fuge teach you to build blog!
  • To save money, I learned PHP in 1 day!
  • Github was attacked. My GitPage blog is also down, emergency repair road, also teach you to build Jekyll blog!
  • Netty+JavaFx combat: imitation desktop version of wechat chat