sudo apt-get updatesudo apt-get install nginxsudo service nginx start

安装 PHP

# owncloud 须要的根本库,必须要安装sudo apt-get install php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-mcrypt php7.0-cgisudo apt-get install php7.0-intl php7.0-mysql php7.0-zip php7.0-dom php7.0-mbstringsudo service php7.0-fpm restart

安装 MySql

sudo apt-get install mysql-serversudo apt-get install mysql-client

安装完成往后进入数据库,无需输入密码:

servicephp70fpmPython进修教程玩转树莓派搭建属于本身的云盘办事 Java

sudo mysql -u root -p

修正密码:

sudo systemctl restart mysqlsudo systemctl status mysql云盘安装

下载最新资源,国外网站,可能略慢,请耐心等待:

wget https://download.owncloud.org/community/owncloud-10.1.1.tar.bz2

下载完成,解压文件:

sudo tar -xvf owncloud-10.1.1.tar.bz2

云盘 owncloud 配置文件:

server {  # 80端口被占用,这里利用8081 listen 8081 default_server; listen [::]:8081 default_server;  # 安装目录 root /home/pi/owncloud; index index.php index.htm; client_max_body_size 10G; fastcgi_buffers 64 4K; gzip off; rewrite ^/caldav(.)$ /remote.php/caldav$1 redirect; rewrite ^/carddav(.)$ /remote.php/carddav$1 redirect; rewrite ^/webdav(.)$ /remote.php/webdav$1 redirect; index index.php; error_page 403 /core/templates/403.php; error_page 404 /core/templates/404.php; location = /robots.txt { allow all; log_not_found off; access_log off; } location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README){ deny all; } location / { # The following 2 rules are only needed with webfinger rewrite ^/.well-known/host-meta /public.php?service=host-meta last; rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last; rewrite ^/.well-known/carddav /remote.php/carddav/ redirect; rewrite ^/.well-known/caldav /remote.php/caldav/ redirect; rewrite ^(/core/doc/[^\/]+/)$ $1/index.html; try_files $uri $uri/ /index.php; } location ~ \.php(?:$|/) { fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.+)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; #ifastcgi_pass php-handler; } location ~ \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { expires 30d; # Optional: Don't log access to assets access_log off; } }

配置完成后,进入安装界面,输入管理员账号密码以及数据库干系信息,点击进入下一步即可安装成功:

初始页面:

内网穿透

如果你想要在非局域网中访问,就须要加一个穿透,来访问我们内网的做事。

首先,我们要把之前天生的 ngrok 客户端(linux_arm)上传到树莓派:

然后,创建一个 ngrok.yml 配置文件:

server_addr: \公众ngrok.52itstyle.vip:4443\公众trust_host_root_certs: falsetunnels: owncloud: proto: http: \公众8081\"大众

启动做事:

./ngrok -config=ngrok.yml start owncloud

SSH是要关闭的,以是要使 ngrok 后台运行:

# 首先安装screensudo apt-get install screen

之后运行:

screen -S 任意名字(例如:keepngork)

然后运行ngrok启动命令:

./ngrok -config=ngrok.yml start owncloud

末了按快捷键:

ctrl+A+D

如果涌现以下,既可以保持ngrok后台运行。

[detached from 14930.keepngork]

末了,配置信赖域名,否则穿透域名无法访问:

sudo vim config/config.php

加入代理域名:

array ( 0 => '192.168.1.157:8081', 1 => 'owncloud.ngrok.52itstyle.vip', ),

前台:

后台:

音频播放:

小结

云盘在内网体验还是蛮好的,搜索、收藏、分享,功能很完好。
只是加了代理穿透往后,上传大文件有点慢。
当然了如果想正儿八经的利用,最好挂载一个 T 级别的硬盘。

更多的Python学习教程也会连续为大家更新!