This article has participated in the activity of “New person creation Ceremony”, and started the road of digging gold creation together.

preface

  • Nowadays, the updating speed of smart phones is more and more frequent, and the old ones are often left idle in the drawer. This article will take you hand in hand to build the old phones into a private server and private cloud disk!!
  • All the schemes in this paper have been tested by myself, and the trial and experience summary that took more than 10 days is now shared with you. If you think this article is good, please like it, collect it and reward it!! Everyone’s encouragement is my motivation to create high-quality articles, I hope you support!!
  • This article will introduce two solutions to build mobile phone servers according to the three requirements in the next section, each with its own focus on functions and limitations.
    • ① Solution 1: Install the complete Linux system (Centos7) using Linux Deploy, manage servers and websites with pagoda panel, and build a private cloud disk (Dao cloud) with one click.

    Note: This scheme requires the phone to have root! Solution two does not require root!

    • (2) Solution 2: Use Termux to manually Deploy private cloud disks (Traceable cloud). (You can also use Linux Deploy to build cloud disks, but Termux is more convenient.)
    • Note: Except for the deployment website and private cloud disk of the above scheme, other requirements can be developed by themselves. Theoretically, all functions can be realized by the Linux server based on Arm architecture. [For more requirements, it is recommended to adopt Scheme 1 to realize the simple deployment of private cloud disks. Scheme 2 is recommended and Scheme 1 can be adopted for xiaobai.]
  • Comparison: Scheme 1 requires compilation and takes a long time, while Scheme 2 directly uses PKG manager to install quickly and takes less time.
  • Note: private cloud disk using PHP + Nginx +mysql technical scheme, for the small white proposal to use the scheme one key deployment, I am also PHP and Nginx small white, scheme two is based on the reference of other blogs.

If this article is helpful to you, you might as well like, bookmark, follow yo! Your support and attention is the motivation for bloggers to create!

demand

  • ① Real-time monitoring of equipment status
  • ② Convenient deployment website (pagoda panel)
  • Create a private cloud disk

Software and Hardware Description

  • Hardware: mobile phone (Solution 1 requires root)

How to obtain the root permission, according to their own devices to find solutions, I am a Xiaomi mobile phone, directly install the developer version of the system can obtain root, some manufacturers root does not support warranty, please be careful operation, I will not be responsible for any problems.

  • Software:
    • Solution 1: Linux Deploy+ Pagoda panel → less command line operations, more web operations
    • Termux+ PHP +nginx→ command line operation

Linux Deploy creates private servers and cloud disks

1. Install Centos Deploy and install Linux

  • Linux Deploy download address: download.csdn.net/download/we…
  • Install the operating system (Centos is recommended)
  • My configuration diagram is as follows:
  • After the configuration is complete, click Install in the upper right corner. If “Deploy” is displayed, the installation is complete. Then click Start to start the OPERATING system.

Note: Remember to check SSH in the configuration. Otherwise, Centos cannot be connected for subsequent operations!

2. Log in to the SYSTEM using SSH and install the pagoda

  • SSH login: Use termux or juiceSSH to log in to Centos over SSH. SSH SSH SSH SSH SSH SSH SSH
  • Pagoda installation:
    • Bt official website: www.bt.cn/bbs/thread-…
    • Install command (run su command to enter root user) :Yum install wget - y && wget - O the sh http://download.bt.cn/install/install_6.0.sh && sh the sh
    • Installation successful:
    • Enter the Intranet address in a mobile browser or a browser on the same LAN and use the random account and password displayed on the cli to log in to the BT panel.
    • The following commands are used to start the pagoda:bt service
  • Bt interface:

3. Configure the pagoda environment

  • The installation environment will be prompted when you log in to the BT panel for the first time. Select the LAMP environment for one-click installation (PHP version 7.x can be selected, and other installation defaults are ok) [As the environment needs to be compiled locally, it takes about 1 hour, depending on the performance of the phone]
  • Modify user configuration and safety information of pagoda panel (set by yourself)

4. One-click deployment of Kedao Cloud private cloud disk

  • Locate the available cloud in one-click Deployment in the App Store and click Install

    • Fill in the relevant website information to complete the construction
      • Domain name: Enter the MOBILE phone IP address
      • Database and other information can be filled in freely
    • Open kedao Cloud web page, set the administrator account password and log in:

    • Enjoy your private cloud disk! The free version supports the creation of 10 users, which can meet the daily use of the family!
      • Open documents online, preview online, upload, download, share and other functions, more mysterious functions for you to explore…

Plan 2 Termux creates a cloud disk

1. Install Termux

  • Download address: download.csdn.net/download/we…
  • 2. Installation environment

    • PKG install update
    • PHP: PKG install php-fpm
    • Nginx: PKG install nginx
    • vim: pkg install vim

3. Configure PHP and nginx

  • Reference: blog.csdn.net/stlinax/art…

  • (1) Nginx setup PHP parsing:

    • Execute command:vim $PREFIX/etc/php-fpm.d/www.confSearch /, insert I, save :wq
    • Find listen = / data/data/com termux/files/usr/var/run/PHP – FPM. The sock, is amended as: listen = 127.0.0.1:9000
  • (2) configure Nginx proxy for PHP:

    • ① Run the following command:vim $PREFIX/etc/nginx/nginx.conf
    • (2) find theindex index.html index.htm;Is amended as:index index.html index.htm index.php;
    • (3) to find:location ~ \.php$Insert the following in front:
location ~ \.php$ {
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /data/data/com.termux/files/usr/share/nginx/html$fastcgi_script_name;
    include        fastcgi_params;
}
Copy the code

Start PHP and nginx

  • Start the PHP:php-fpm
  • Nginx start:nginx
  • To check whether the configuration is correct and the system is successfully started, visit http:// mobile PHONE IP address :8080/info.php. If the PHP version information page is displayed, the system is successfully started

5, download the cloud source code and install

  • Official download address: kodcloud.com/download/
  • Download and install:
cd $PREFIXThe mkdir/share/nginx/HTML a kod wget https://static.kodcloud.com/update/download/kodbox.1.22.zip unzip kodbox. 1.22. Zip && chmod -Rf 777 ./*Copy the code

If the wGE tool t is not available, run PKG install wget

6. Access kedao cloud and configure it after installation

  • Visit address:
    • The machine: http://127.0.0.1:8080/kod
    • LAN: http://mobile phone IP address :8080/kod
  • The configuration procedure is the same as that of Solution 1. [Note: mysql is not installed in this solution. You can select file storage for the database.]

Scheme comparison

  • 1. Access to external memory
    • In scheme 1, the default account WWW of pagoda is used to build the website of Kedao Cloud, which is not authorized enough to access the external mounted memory (such as android’s own storage directory, etc.). The space of private web disk is limited by the capacity configured by Centos itself. Solution 2 Termux Common users can mount the local storage of mobile phones and have access permission to external storage devices. Even if external storage devices are not mounted, they can directly share the storage space of the host.
  • 2. Security
    • Due to the limitation of Problem 1 (The security mechanism of Pagoda itself), scheme 1 has higher security, while Scheme 2 May misoperate and maliciously tamper android files after mounting the local space, so the security is relatively weak.
    • To obtain the permission to access mobile phone storage, runtermux-setup-storage→ Run storage access → Create soft connection (see below)
    • Termux mount directory (create soft connection) :Ln -s/data/data/com termux/files/home/storage/Shared folder/native termux internal directory[such as: to map all installation directory to termux home directory: ln -s/data/data/com termux/files/home/storage/Shared ~ /]
  • 3, power saving and maintenance
    • In my opinion, Termux is relatively power-efficient (after all, there is no need to run pagodas for real-time monitoring). To start up Kodao Cloud, you only need to start PHP and Nginx, and plan 2 is pretty easy to maintain
erDiagram CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains CUSTOMER }|.. |{ DELIVERY-ADDRESS : uses