This is the 15th day of my participation in the August More Text Challenge. For details, see:August is more challenging
One, foreword
In the previous chapter, we installed a Linux system on a mobile phone and successfully connected using SSH. Next, I’ll show you how to quickly build a personal web disk and use FRP for remote access.
Install NextCloud
NextCloud is an open source NAS system written in PHP. You can quickly set up a web disk by running the NextCloud bootpage, and it also offers Windows and mobile clients.
My initial idea is to use Docker for the installation, which is fast and stable. But Docker doesn’t run on Linux Deploy, and later looking through the issue of Linux Deploy, it turns out that Linux Deploy is actually a container, too, based on the Chroot container invented in the 1970s.
In addition to docker not running due to a container defect, the following issues will occur:
-
The systemctl command cannot be used.
-
The service command is unavailable in the Centos system.
Systemctl is not available, we still have the service command. However, under Centos, you can’t use either of these. Services such as mysql and Apache will not start. If you swipe Centos, you will still use Debian or Ubuntu (personal verification is possible).
(In fact, Linux Deploy has Docker system installation, but I dead or live can not run up, Docker can directly pull the image, if someone Docker system run successfully, also please guide)
The installation process mainly refers to this article:
Blog.51cto.com/u_14345315/…
However, due to system problems, I still stepped on a lot of holes, here is my installation process:
- Administrator rights & update source
sudo su
apt-get update
apt-get upgrade
Copy the code
- Apt Installation database
apt-get install mariadb-server php-mysql -y
Copy the code
- Set permissions or the database service cannot be started (this step is what the Linux Deploy system needs to do, from its issue)
usermod -a -G aid_inet,aid_net_raw mysql
Copy the code
- Restart the database (sysyemctl cannot execute this command)
service mysql restart
Copy the code
- Initialize the database and follow the instructions (all Y is ok except for password Settings).
mysql_secure_installation
Copy the code
- Create database, database name, user and password can play freely, if you need remote access to the database, you can
localhost
Make sure to flush privileges after creating the account.
mysql -u root -p
MariaDB> create database nextclouddb;
MariaDB> grant all on nextclouddb.* to 'nextcloud_user'@'localhost' identified by 'Your password';
MariaDB> flush privileges;
MariaDB> exit
Copy the code
- Install Apache and PHP, apache can be replaced with nginx, they are the same.
apt-get install php php-gd php-mbstring php-dom php-curl php-zip php-simplexml php-xml -y
apt-get install apache2 libapache2-mod-php -y
Copy the code
- Start Apache, set up Apache before it starts (which seems to be what Linux Deploy does), and add a service to the configuration file.
This is done using the echo command (note that >> appends a line, and writing > becomes overwritten). Then run it with service.
echo ServerName localhost:80 >> /etc/apache2/apache2.conf
service apache2 start
Copy the code
- Install NextCloud, download the decompressed installation package, and give it permission to run.
Wget https://download.nextcloud.com/server/releases/nextcloud-18.0.4.tar.bz2 tar - XJF nextcloud - 18.0.4. Tar..bz2 - C /var/www/html chown -R www-data:www-data /var/www/html/nextcloud chmod -R 755 /var/www/html/nextcloudCopy the code
- Configuration NextCloud
Open http://< IP address of the mobile phone >/ nextCloud (the IP address of the mobile phone can be viewed above Linux Deploy or queried by typing ifconfig in SSH) in the browser of the computer (which must be in the same network segment as the mobile phone) to enter the Settings page:
In the first row, enter the user who logged in to the database, in the second row, enter the corresponding database password, in the third row, enter the database name we created for nextCloud, and in the fourth row, keep the default localhost.
Click Create, wait for a while, jump to NextCloud, complete the installation.
Three, external network penetration
I use the free FRP service, conditional bosses can choose to apply for public IP or use the server with public IP for forwarding.
Service address: freefrp.net/docs.html
First, download the FRP tool, download the compression package and decompress it, and go to its directory:
#Download the PackageWget HTTP: / / https://github.com/fatedier/frp/releases/download/v0.37.1/frp_0.37.1_linux_arm.tar.gz#Unpack theThe tar - ZXVF frp_0. 37.1 _linux_arm. Tar. Gz#renameThe mv frp_0. 37.1 _linux_arm FRP#Enter the
cd frp
Copy the code
(There is a pit here, I use uname -A to check that the system is arm64 architecture, but the FRP installation arm64 is incorrect, can only use the arm architecture software)
Write the frpc.ini file on Linux (in the same directory as FRPC) by following the tutorial provided at the website:
[common]
server_addr = frp.freefrp.net
server_port = 7000
token = freefrp.net
[*************_com_http]
type = http
local_ip = 127.0.0.1
local_port = 80
subdomain= * * * * * * * * * * *Copy the code
(the code part for personal information: as long as the above is not repeated on the line, the following is the site to provide a free tertiary domain name), as long as the code part of the line, want to know more can visit the above website.
Background startup service:
./frpc -c frpc.ini &
Copy the code
After the completion of the operation, although can be accessed through the free domain name, but was intercepted down.
Config /config.php:
vim /var/www/html/nextcloud/config/config.php
Copy the code
Add a line under Array, trusted_Domains, and add the free domain you wrote in frpc.ini:
Refresh to remotely access the network disk.