安装 ownCloud 准备工作:
ownCloud 是用 PHP 编程语言编写的,因此,我们需要一个 LAMP 或者 LEMP 服务器来部署此应用程序。
在这里,我们正在安装 LAMP 服务器。
所有 ownCloud 准备工作包都在标准 yum 存储库中可用。
因此,我们可以使用单个 dnf 命令安装所有这些软件包。
# dnf install -y httpd mariadb-server mariadb php php-curl php-gd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip php-opcache wget bzip2
启用并启动 LAMP 服务。
# systemctl enable --now httpd php-fpm mariadb
配置 MySQL 数据库服务器的初始设置和安全性。
# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
以 root 用户身份连接 MySQL 数据库服务器。
# mysql -u root -p Enter password: MariaDB [(none)]>
创建一个数据库,作为 ownCloud 服务器的后端存储库。
MariaDB [(none)]> CREATE DATABASE oc_db; Query OK, 1 row affected (0.001 sec)
创建用于访问 ownCloud 数据库的数据库用户。
MariaDB [(none)]> CREATE USER 'oc_user'@'localhost' IDENTIFIED BY 'P@ssw0rd'; Query OK, 0 rows affected (0.001 sec)
将 oc_db 数据库的完整权限授予 oc_user。
MariaDB [(none)]> GRANT ALL ON oc_db.* TO 'oc_user'@'localhost'; Query OK, 0 rows affected (0.001 sec)
重新加载权限表并退出 MySQL shell。
MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.001 sec) MariaDB [(none)]> EXIT Bye
在 CentOS/RHEL 8 上安装 ownCloud 服务器:
从官网获取最新版本的下载链接,并使用 wget 命令将其下载到 Linux 服务器
# wget https://download.owncloud.org/community/owncloud-complete-20210721.tar.bz2
执行以下 tar 命令将下载的文件解压到 /var/www 目录中。
# tar xjf owncloud-complete-20210721.tar.bz2 -C /var/www/
将提取文件的所有权授予 Apache 用户。
# chown -R apache: /var/www/owncloud
创建 Apache 配置文件以部署 ownCloud 应用程序。
为此,我们可以使用 vim 文本编辑器。
# vi /etc/httpd/conf.d/owncloud.conf
在此文件中添加以下 Apache 指令。
Alias /owncloud "/var/www/owncloud/" <Directory /var/www/owncloud/> Options +FollowSymlinks AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/owncloud SetEnv HTTP_HOME /var/www/owncloud </Directory>
保存并退出 vim 文本编辑器。
执行以下命令来测试 Apache 配置。
# httpd -t Syntax OK
重新启动 Apache 服务以加载更改。
# systemctl restart httpd
Apache 进程需要对 ownCloud 软件目录的显式读/写访问权限。
我们可以通过使用 semanage 命令定义 SELinux fcontext 来配置它。
或者通过启用 httpd_unified SELinux 布尔值。
在这里,我们使用 setebool 命令启用 SELinux 布尔值。
# setsebool -P httpd_unified 1
为了使存储云可以通过网络访问,我们需要在 Linux 防火墙中允许 Apache 默认服务端口。
# firewall-cmd --permanent --add-service=http success # firewall-cmd --reload success
在 Web 浏览器中打开 http://owncloud-01.onitroad.com/owncloud。
创建一个管理员用户并为 ownCloud 应用程序设置数据目录。
为 ownCloud 和 MySQL 服务器之间的连接提供数据库凭据。
单击“完成设置”。
以管理员用户身份登录。
OwnCloud介绍
ownCloud 是一个免费的开源软件,用于创建和使用文件托管服务。
OwnCloud 是一款开源文件同步、共享和内容协作软件,可让团队随时随地在任何设备上轻松处理数据。
ownCloud 的服务器版是免费和开源的,因此任何人都可以在自己的私有服务器上免费安装和操作它。
我们可以使用此软件构建自己的云存储。
ownCloud 在功能上与广泛使用的 Dropbox 有相似之处。
ownCloud 和 Dropbox 之间的主要功能区别在于 ownCloud 主要是服务器软件。
ownCloud 支持允许它像 Google Drive 一样工作的扩展程序,具有在线办公套件文档编辑、日历和联系人同步等功能。