微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在CentOS8.2上搭建Nextcloud私人网盘

前言

Nextcloudd是一个开源的、基于本地的文件共享和协作平台,它允许您保存文件并通过多个设备(如PC、智能手机和平板电脑)访问它们。
同样的我们可以自己购买一个云服务器,部署一个属于自己的私人网盘,用来存储一些图片文件等东西,以后需要可以从私人网盘上下载,就会比其他的例如百度网盘快很多

首先是关闭防火墙和selinux

[root@localhost ~]# systemctl enable --Now firewalld
[root@localhost ~]# cat /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled         //改成disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

改完后重启机器

[root@localhost ~]# reboot

一条命令部署LAMP架构

[root@localhost ~]# yum install -y httpd mariadb-server PHP

NextCloud需要一些必需的PHP模块才能正常工作,接着安装PHP拓展包

[root@localhost ~]# yum install -y PHP-MysqLnd PHP-xml PHP-zip  PHP-curl PHP-gd PHP-intl PHP-json PHP-ldap PHP-mbstring PHP-opcache

这里不需要启动PHP-fpm

启动httpd、mariadb服务,并设置开机自启

[root@localhost ~]# systemctl enable --Now httpd
[root@localhost ~]# systemctl enable --Now mariadb

设置数据库管理员密码

[root@localhost ~]# MysqLadmin -u root password 'your_password'
your_password是需要自己设置的密码

进入数据库,给Nextcloud创建数据库,并授权

[root@localhost ~]# MysqL -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 246
Server version: 10.3.17-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)]> create database nextcloud;
MariaDB [(none)]> creant all privileges on nextcloud.* to 'root'@'localhost';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| @R_983_4045@ion_schema |
| MysqL              |
| nextcloud          |
| performance_schema |
+--------------------+
4 rows in set (0.003 sec)
MariaDB [(none)]> exit
Bye

上传nextcloud压缩包

访问Nextcloud官网:https://nextcloud.com/install/#instructions-server

点击下载到本地

也可以使用: wget https://download.nextcloud.com/server/releases/nextcloud-19.0.3.zip 但是这种方式很慢,推荐先下载到本地,再上传到机器上

上传完成后,将文件解压缩到/var/www/html/目录下

[root@localhost ~]# unzip nextcloud-16.0.3.zip -d /var/www/html/

接着,创建一个目录来存储管理用户数据

[root@localhost ~]# mkdir -p /var/www/html/nextcloud/data

修改NextCloud的目录权限,以便Apache用户可以向其中添加数据

[root@localhost ~]# chown -R apache:apache /var/www/html/nextcloud/

到这个人网盘就搭建完成,接着访问:ip/nextcloud完成安装即可

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐