如何在 Ubuntu 上使用 Pydio 设置自己的文件服务器


在本文中,我们将学习如何使用 Pydio 托管文件共享服务器,它可以在没有强大硬件的情况下运行良好。我们将安装社区版,但如果我们使用企业许可证,则对于少于 10 人的团队是免费的。

Pydio 是一款类似 Dropbox 的实用程序,允许文件共享。Pydio 与其他文件同步服务一样,拥有良好的功能,包括 Web 界面、Mac、Windows 和 Linux 的原生客户端、IOS 和 Android 的移动客户端。它能够与公众中的其他 Pydio 用户共享文件。

先决条件

  • 无 root 权限的用户
  • 已安装 Apache 以及 LAMP,并为访问设置了 https
  • 如果公开暴露,则需要一个 FQDN。
  • 已安装 Postfix。

安装 Pydio

我们将使用以下命令安装所有依赖项和 Pydio,在此之前,我们需要更新机器。下载 Pydio 并解压缩它,然后将代码移动到 Apache 中的默认文件夹。

$ sudo apt-get update
$ sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install php5 libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
libapache2-mod-php5 is already the newest version.
php5 is already the newest version.
The following packages were automatically installed and are no longer required:
libntdb1 python-ntdb
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
root@ubuntu:~# sudo apt-get remove php5 libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libntdb1 python-ntdb
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libapache2-mod-php5filter
Suggested packages:
php-pear
The following packages will be REMOVED:
libapache2-mod-php5 php5
The following NEW packages will be installed:
libapache2-mod-php5filter
0 upgraded, 1 newly installed, 2 to remove and 3 not upgraded.
Need to get 2,205 kB of archives.
After this operation, 33.8 kB disk space will be freed.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty-updates/universe libapache2-mod-php5filter amd64 5.5.9+dfsg-1ubuntu4.17 [2,205 kB]
Fetched 2,205 kB in 5s (370 kB/s)
(Reading database ... 201552 files and directories currently installed.)
Removing php5 (5.5.9+dfsg-1ubuntu4.17) ...
dpkg: libapache2-mod-php5: dependency problems, but removing anyway as you requested:
phpmyadmin depends on libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5; however:
Package libapache2-mod-php5 is to be removed.
Package libapache2-mod-php5filter is not installed.
Package php5-cgi is not installed.
Package php5-fpm is not installed.
Package php5 is not installed.
apache2_invoke prerm: Disable module php5
* Restarting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[ OK ]
Selecting previously unselected package libapache2-mod-php5filter.
(Reading database ... 201540 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-php5filter_5.5.9+dfsg-1ubuntu4.17_amd64.deb ...
Unpacking libapache2-mod-php5filter (5.5.9+dfsg-1ubuntu4.17) ...
Setting up libapache2-mod-php5filter (5.5.9+dfsg-1ubuntu4.17) ...
..
..
Creating config file /etc/php5/apache2filter/php.ini with new version
..
..
* Restarting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[ OK ]
root@ubuntu:~# sudo apt-get install php5 libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libntdb1 python-ntdb
Use 'apt-get autoremove' to remove them.
Suggested packages:
php-pear
The following packages will be REMOVED:
libapache2-mod-php5filter
The following NEW packages will be installed:
libapache2-mod-php5 php5
0 upgraded, 2 newly installed, 1 to remove and 3 not upgraded.
Need to get 0 B/2,213 kB of archives.
After this operation, 33.8 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package php5.
(Reading database ... 201551 files and directories currently installed.)
Preparing to unpack .../php5_5.5.9+dfsg-1ubuntu4.17_all.deb ...
Unpacking php5 (5.5.9+dfsg-1ubuntu4.17) ...
dpkg: libapache2-mod-php5filter: dependency problems, but removing anyway as you requested:
phpmyadmin depends on libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5; however:
Package libapache2-mod-php5 is not installed.
Package libapache2-mod-php5filter is to be removed.
Package php5-cgi is not installed.
Package php5-fpm is not installed.
Package php5 is not configured yet.
apache2_invoke prerm: Disable module php5filter
* Restarting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[ OK ]
Selecting previously unselected package libapache2-mod-php5.
(Reading database ... 201548 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-php5_5.5.9+dfsg-1ubuntu4.17_amd64.deb ...
Unpacking libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4.17) ...
Setting up libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4.17) ...
* Restarting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
[ OK ]
Setting up php5 (5.5.9+dfsg-1ubuntu4.17) ...
$ wget https://download.pydio.com/641qt8npdernapoevdm/pydio-enterprise-6.4.1.tar.gz
wget -P ~/ http://vorboss.dl.sourceforge.net/project/ajaxplorer/pydio/stable-channel/6.2.2/pydio-core-6.2.2.tar.gz
--2016-06-02 09:17:35-- http://vorboss.dl.sourceforge.net/project/ajaxplorer/pydio/stable-channel/6.2.2/pydio-core-6.2.2.tar.gz
Resolving vorboss.dl.sourceforge.net (vorboss.dl.sourceforge.net)... 5.10.152.194
Connecting to vorboss.dl.sourceforge.net (vorboss.dl.sourceforge.net)|5.10.152.194|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 15735734 (15M) [application/x-gzip]
Saving to: ‘/root/pydio-core-6.2.2.tar.gz.1’
100%[======================================>] 1,57,35,734 917KB/s in 28s
2016-06-02 09:18:03 (549 KB/s) - ‘/root/pydio-core-6.2.2.tar.gz.1’ saved [15735734/15735734]
$ tar -xvzf ~/pydio-enterprise-6.4.1.tar.gz
$ sudo mv ~/pydio-core-6.4.1 /var/www/pydio

更改文件夹权限为 Apache,以便我们可以存储数据并更新配置文件

$ sudo chown -R www-data:www-data /var/www/pydio

设置 PHP 模块以运行 Pydio

安装一些 PHP 模块以工作

$ sudo apt-get install php5-mcrypt php5-gd php5-sqlite

默认情况下,mcrypt 未启用,可以使用 phpenmod 启用它

$ sudo php5enmod mcrypt

为了使同步客户端工作,我们需要启用并安装 a2enmod

$ sudo a2enmod rewrite

我们需要修改 php.ini 文件,并且需要更新这些行

$ sudo vi /etc/php5/apache2/php.ini

找到 output_buffering = 4096 的行,并将其更改为 off

; Default Value: Off
; Development Value: 4096
; Production Value: 4096
; https://php.net/output-buffering
output_buffering = Off

我们还需要修改 upload_max_filesize = 2M,并将 2M 更改为任何较大的数字,例如 1G

; Maximum allowed size for uploaded files.
; https://php.net/upload-max-filesize
upload_max_filesize = 1G

此外,我们还需要更改 post_max_size

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; https://php.net/post-max-size
post_max_size = 1G

保存文件并重新启动。

为 Pydio 配置 Apache

在 /etc/apache2/sites-available 中创建一个新文件 pydio.conf

$ sudo nano /etc/apache2/sites-available/pydio.conf
<VirtualHost *:80>
   ServerAdmin [email protected]
   ServerName 192.168.100.111
   DocumentRoot /var/www/pydio
   ErrorLog ${APACHE_LOG_DIR}/pydio-error.log
   CustomLog ${APACHE_LOG_DIR}/pydio-access.log combined
   <Directory /var/www/pydio/>
      AllowOverride All
   </Directory>
</VirtualHost>

我们将禁用默认的 Apache 配置。

$ sudo a2dissite 000-default

我们需要启用两个配置文件

$ sudo a2ensite pydio

重新启动 apache 服务

$ sudo service apache2 restart

自定义 PHP 邮件发送器以支持 Pydio。

我们需要编辑 Postfix 配置文件 /etc/postfix/main.cf

$ sudo nano /etc/postfix/main.cf

搜索 inet_interfaces,并使用你的本地主机更新所有内容

mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

重新启动 Postifx 服务

$ sudo service postfix restart

完成 Pydio 设置

在我们完成 Pydio 设置后,我们将通过浏览器使用 https://服务器系统的 IP 地址访问它。第一个页面将使用诊断工具对机器进行诊断,然后点击“点击此处继续到 Pydio”


它将启动 Pydio 欢迎屏幕


点击“开始向导”按钮,并在字段中提供信息


应用程序标题,它将显示在浏览器的标题栏中

欢迎消息,显示在登录屏幕上。

管理员登录,管理员的登录用户名。

管理员显示名称,这将是管理员的显示名称。

管理员密码,提供管理员密码。

点击屏幕底部的“>>”按钮继续。

在进入数据库连接之前,我们需要在 MySql 中为 Pydio 创建一个数据库和用户

$ sudo mysql -uroot -p
mysql> create database pydio;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE user 'pydio'@'localhost' IDENTIFIED BY 'pydio1234';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL privileges ON pydio.* TO 'pydio'@'localhost';
Query OK, 0 rows affected (0.01 sec)
mysql> \q

下一页将找到数据库连接设置,从数据库下拉菜单中选择 Sqlite 3。点击“测试连接”按钮以测试一切是否正常。


然后点击“>”按钮继续。

在页面上的高级选项中,我们需要启用电子邮件支持。

要启用电子邮件,我们从菜单中选择“是”。

要使用 PHP 邮件发送器,请选择“邮件”。

提供管理员电子邮件的电子邮件地址。

我们可以使用“尝试使用配置的数据发送电子邮件”按钮检查发送配置数据的电子邮件,以确保配置正常工作。


最后,点击“安装 Pydio”按钮。

访问 Pydio

我们可以使用 http://IP 地址从浏览器访问 Pydio。


我们可以使用以下链接下载客户端。

桌面:https://pydio.com

IOS 客户端:https://itunes.apple.com

Android 客户端:https://play.google.com

当我们安装 Pydio 客户端时,它允许你分别选择和同步每个工作区。当我们第一次运行客户端设置时,可以选择与本地文件夹同步的内容。设置同步后,我们以后可以添加工作区。

通过此设置和配置,我们可以拥有自己的文件服务器,例如 Dropbox 或任何其他在线存储等,使用 Pydio 通过原生客户端和主要桌面控制你的数据,数据可以在我们任何需要的时候访问。

更新于: 2020 年 1 月 20 日

95 次浏览

开启你的 职业生涯

通过完成课程获得认证

开始
广告