ownCloud是一个免费的开源文件托管和共享平台,允许用户从任何地方存储和访问他们的文件。它为存储,访问和共享文件提供了用户友好的界面,并与各种流行的文件共享和协作工具(如Microsoft Office和Google Drive)集成。通过使用ownCloud,您可以从任何地方轻松存储,访问和共享您的文件,并在各种项目上与他人协作。
在 Rocky Linux 9 上安装 OwnCloud
第 1 步。第一步是将系统更新到最新版本的软件包列表。为此,请运行以下命令:
<span class="pln">sudo dnf check</span><span class="pun">-</span><span class="pln">update sudo dnf install dnf</span><span class="pun">-</span><span class="pln">utils</span>
第 2 步。安装阿帕奇。
默认情况下,Apache 在 Rocky Linux 9 基础存储库中可用。现在我们使用以下命令安装最新版本的 Apache:dnf
<span class="pln">sudo dnf install httpd httpd</span><span class="pun">-</span><span class="pln">tools</span>
您可以通过输入以下命令来启动服务并将其配置为在启动时运行:httpd
<span class="pln">sudo systemctl start httpd sudo systemctl enable httpd sudo systemctl status httpd</span>
若要使页面向公众开放,必须使用以下命令编辑防火墙规则以允许 Web 服务器上的 HTTP 和 HTTPS 请求:
<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">permanent </span><span class="pun">--</span><span class="pln">zone</span><span class="pun">=</span><span class="kwd">public</span> <span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">service</span><span class="pun">=</span><span class="pln">http sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">permanent </span><span class="pun">--</span><span class="pln">zone</span><span class="pun">=</span><span class="kwd">public</span> <span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">service</span><span class="pun">=</span><span class="pln">https sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>
有关安装 Apache 的其他资源,请阅读下面的帖子:
- 如何在 Rocky Linux √ 上安装 Apache。
第 3 步。安装 MariaDB。
默认情况下,MariaDB 在 Rocky Linux 9 基础存储库中可用。只需使用以下命令安装 MariaDB 软件包:dnf
<span class="pln">sudo dnf install mariadb</span><span class="pun">-</span><span class="pln">server mariadb</span>
安装完成后,启动数据库服务器的服务,然后启用相同的服务,以便它可以在系统重新启动时自动启动:
<span class="pln">sudo systemctl restart mariadb sudo systemctl status mariadb sudo systemctl enable mariadb</span>
默认情况下,MariaDB 未强化。您可以使用脚本保护 MariaDB。您应该仔细阅读并在每个步骤下方仔细阅读,这将设置root密码,删除匿名用户,禁止远程root登录,并删除测试数据库和对安全MariaDB的访问权限:mysql_secure_installation
<span class="pln">mysql_secure_installation</span>
首先,使用以下命令登录到 MariaDB shell:
<span class="pln">mysql</span>
现在我们使用以下命令为 OwnCloud 创建一个数据库和用户:
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> create database ownclouddb</span><span class="pun">;</span> <span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> grant all on ownclouddb</span><span class="pun">.*</span><span class="pln"> to owncloud@localhost identified </span><span class="kwd">by</span> <span class="str">"your-strong-password"</span><span class="pun">;</span> <span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> flush privileges</span><span class="pun">;</span> <span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span> <span class="kwd">exit</span><span class="pun">;</span>
有关安装 MariaDB 数据库的其他资源,请阅读以下帖子:
- 如何在 Rocky Linux √ 上安装 MariaDB
第 4 步。安装 PHP。
PHP 是一种流行的脚本语言,可为数百万个网站和应用程序的动态内容提供支持。现在我们运行以下命令来安装 PHP:
<span class="pln">sudo dnf epel</span><span class="pun">-</span><span class="pln">release sudo dnf </span><span class="kwd">module</span><span class="pln"> enable php</span><span class="pun">:</span><span class="pln">remi</span><span class="pun">-</span><span class="lit">8.1</span>
启用 Remi PHP 8.1 模块后,您现在可以安装 PHP 8.1 和常用的 PHP 扩展,如下所示:
<span class="pln">sudo dnf install php php</span><span class="pun">-</span><span class="pln">cli php</span><span class="pun">-</span><span class="pln">fpm php</span><span class="pun">-</span><span class="pln">gd php</span><span class="pun">-</span><span class="pln">curl php</span><span class="pun">-</span><span class="pln">zip php</span><span class="pun">-</span><span class="pln">mbstring php</span><span class="pun">-</span><span class="pln">opcache php</span><span class="pun">-</span><span class="pln">intl php</span><span class="pun">-</span><span class="pln">mysqlnd</span>
检查并验证已安装的版本:
<span class="pln">php </span><span class="pun">-</span><span class="pln">v</span>
有关安装 PHP 的其他资源,请阅读下面的帖子:
- 如何在 Rocky Linux √ 上安装 PHP
第5步。在 Rocky Linux 9 上安装 Drupal。
现在运行以下命令,从官方页面下载最新版本的OwnCloud软件包:
<span class="pln">wget https</span><span class="pun">:</span><span class="com">//download.owncloud.org/community/owncloud-complete-latest.tar.bz2</span>
接下来,使用以下命令解压缩到目录中:/var/www/html
<span class="pln">tar </span><span class="pun">-</span><span class="pln">jxf owncloud</span><span class="pun">-</span><span class="pln">complete</span><span class="pun">-</span><span class="pln">latest</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">bz2 </span><span class="pun">-</span><span class="pln">C </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span>
现在将 OwnCloud 目录的所有权更改为 Apache 用户:
<span class="pln">chown </span><span class="pun">-</span><span class="pln">R apache</span><span class="pun">:</span> <span class="str">/var/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">owncloud</span>
第 6 步。配置阿帕奇。
现在我们为ownCloud创建一个配置文件,用于Apache网络服务器,为ownCloud服务:
<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">httpd</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">drupal</span><span class="pun">.</span><span class="pln">conf</span>
添加以下文件:
<span class="tag"><VirtualHost</span><span class="pln"> *:80</span><span class="tag">></span><span class="pln"> ServerName your-domain.com ServerAlias www.your-domain.com ServerAdmin admin@your-domain.com DocumentRoot /var/www/html/owncloud/ </span><span class="tag"><Directory</span> <span class="pun">/</span><span class="atn">var</span><span class="pun">/</span><span class="atn">www</span><span class="pun">/</span><span class="atn">html</span><span class="pun">/</span><span class="atn">owncloud</span><span class="tag">></span><span class="pln"> Options Indexes FollowSymLinks AllowOverride All Require all granted RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] </span><span class="tag"></Directory></span> <span class="tag"></VirtualHost></span>
保存并关闭文件,然后重新启动 Apache 服务以应用更改:
<span class="pln">sudo systemctl restart httpd</span>
如果启用了 SELinux,请执行以下命令以允许 Apache Web 服务器写入 Owncloud 的目录:
<span class="pln">sudo setsebool </span><span class="pun">-</span><span class="pln">P httpd_unified </span><span class="lit">1</span>
步骤 7.访问自己的云网络界面。
成功安装后,打开您的网络浏览器并使用 URL 访问 OwnCloud .您将被重定向到以下页面:http://your-domain.com
感谢您使用本教程在您的 Rocky Linux 9 系统上安装 OwnCloud。有关其他帮助或有用信息,我们建议您查看官方 OwnCloud 网站。