之路 on it Road.com

在 CentOS/RHEL 8 上安装 ownCloud 服务器

ownCloud 文件托管服务器可在其官方网站上免费下载。
我们可以从那里获取最新版本的下载链接,并使用 wget 命令将其下载到 Linux 服务器计算机上。

# wget https://download.owncloud.org/community/owncloud-complete-20210721.tar.bz2

我们已经下载了 BZIP 压缩的 Tar 文件。
或者,我们可以选择下载其他格式。

执行以下 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 浏览器中打开 URL http://owncloud-01.onitroad.com/owncloud。

创建一个管理员用户并为 ownCloud 应用程序设置数据目录。

为 ownCloud 和 MySQL 服务器之间的连接提供数据库凭据。

单击“完成设置”。

以管理员用户身份登录。

将看到 ownCloud 应用程序的仪表板。

在 CentOS/RHEL 8 上安装 ownCloud Storage Server

ownCloud 是一个免费的开源软件,用于创建和使用文件托管服务。
在本文中,我们将学习在 CentOS/RHEL 8 上安装 ownCloud 存储服务器。

安装 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
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

配置 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:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.28-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
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
日期:2020-09-17 00:16:41 来源:oir作者:oir