• 利用Nextcloud搭建个人私有网盘


    简介:
    Nextcloud是一款开源免费的私有云存储网盘项目,可以让你快速便捷地搭建一套属于自己或团队的云同步网盘,从而实现跨平台跨设备文件同步、共享、版本控制、团队协作等功能。它的客户端覆盖了Windows、Mac、Android、iOS、Linux 等各种平台,也提供了网页端以及 WebDAV接口,所以你几乎可以在各种设备上方便地访问你的云盘。

    1、安装依赖:

    [root@iZbp143t3oxhfc3ar7jey0Z ~]# yum install -y epel-release yum-utils unzip curl wget 
    > bash-completion policycoreutils-python mlocate bzip2
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Package curl-7.29.0-54.el7_7.2.x86_64 already installed and latest version
    Package wget-1.14-18.el7_6.1.x86_64 already installed and latest version
    Package policycoreutils-python-2.5-33.el7.x86_64 already installed and latest version
    Resolving Dependencies
    --> Running transaction check
    ---> Package bash-completion.noarch 1:2.1-6.el7 will be installed
    ---> Package bzip2.x86_64 0:1.0.6-13.el7 will be installed
    ---> Package epel-release.noarch 0:7-12 will be installed
    ---> Package mlocate.x86_64 0:0.26-8.el7 will be installed
    ---> Package unzip.x86_64 0:6.0-20.el7 will be installed
    ---> Package yum-utils.noarch 0:1.1.31-52.el7 will be installed
    --> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-52.el7.noarch
    --> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-52.el7.noarch
    --> Running transaction check
    ---> Package libxml2-python.x86_64 0:2.9.1-6.el7_2.3 will be installed
    ---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
    --> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
    --> Running transaction check
    ---> Package python-chardet.noarch 0:2.2.1-3.el7 will be installed
    --> Finished Dependency Resolution
    [root@iZbp143t3oxhfc3ar7jey0Z ~]# yum update -y
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ---> Package docker.x86_64 2:1.13.1-108.git4ef4b30.el7.centos will be updated
    ---> Package docker.x86_64 2:1.13.1-109.gitcccb291.el7.centos will be an update
    ---> Package docker-client.x86_64 2:1.13.1-108.git4ef4b30.el7.centos will be updated
    ---> Package docker-client.x86_64 2:1.13.1-109.gitcccb291.el7.centos will be an update
    ---> Package docker-common.x86_64 2:1.13.1-108.git4ef4b30.el7.centos will be updated
    ---> Package docker-common.x86_64 2:1.13.1-109.gitcccb291.el7.centos will be an update
    ---> Package sudo.x86_64 0:1.8.23-4.el7_7.1 will be updated
    ---> Package sudo.x86_64 0:1.8.23-4.el7_7.2 will be an update
    --> Finished Dependency Resolution

    2、安装Apache

    [root@iZbp143t3oxhfc3ar7jey0Z ~]#  yum install -y httpd
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ---> Package httpd.x86_64 0:2.4.6-90.el7.centos will be installed
    --> Processing Dependency: httpd-tools = 2.4.6-90.el7.centos for package: httpd-2.4.6-90.el7.centos.x86_64
    --> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-90.el7.centos.x86_64
    --> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-90.el7.centos.x86_64
    --> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-90.el7.centos.x86_64
    --> Running transaction check
    ---> Package apr.x86_64 0:1.4.8-5.el7 will be installed
    ---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
    ---> Package httpd-tools.x86_64 0:2.4.6-90.el7.centos will be installed
    ---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    [root@iZbp143t3oxhfc3ar7jey0Z ~]# systemctl enable httpd.service
    Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
    [root@iZbp143t3oxhfc3ar7jey0Z ~]# systemctl start httpd.service

    3. 安装 MariaDB

    [root@iZbp143t3oxhfc3ar7jey0Z ~]# yum install mariadb-server -y
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ---> Package mariadb-server.x86_64 1:5.5.64-1.el7 will be installed
    --> Processing Dependency: mariadb(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-server-5.5.64-1.el7.x86_64
    --> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.64-1.el7.x86_64
    --> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.64-1.el7.x86_64
    --> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.64-1.el7.x86_64
    --> Running transaction check
    ---> Package mariadb.x86_64 1:5.5.64-1.el7 will be installed
    ---> Package perl-DBD-MySQL.x86_64 0:4.023-6.el7 will be installed
    ---> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
    --> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
    --> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
    --> Running transaction check
    [root@iZbp143t3oxhfc3ar7jey0Z ~]# systemctl start mariadb
    [root@iZbp143t3oxhfc3ar7jey0Z ~]# systemctl enable mariadb
    Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
    [root@iZbp143t3oxhfc3ar7jey0Z ~]# mysqladmin -u root password 'pwd123'

    4. 安装php

    如果php使用的是php7.2以前的老版本,需要卸载老版本而装新版本。

    [root@iZbp143t3oxhfc3ar7jey0Z ~]# yum remove php* php-common
    Loaded plugins: fastestmirror
    No Match for argument: php*
    No Match for argument: php-common
    No Packages marked for removal
    [root@iZbp143t3oxhfc3ar7jey0Z ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    warning: /var/tmp/rpm-tmp.19ciWF: Header V4 RSA/SHA1 Signature, key ID 62e74ca5: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:webtatic-release-7-3             ################################# [100%]
    [root@iZbp143t3oxhfc3ar7jey0Z ~]#  yum install -y php72w php72w-cli php72w-common php72w-curl php72w-gd 
    > php72w-mbstring php72w-mysqlnd php72w-process php72w-xml php72w-zip 
    > php72w-opcache php72w-pecl-apcu php72w-intl php72w-pecl-redis
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * webtatic: us-east.repo.webtatic.com
    webtatic                                                                                                                                         | 3.6 kB  00:00:00
    (1/2): webtatic/x86_64/group_gz                                                                                                                  |  448 B  00:00:01
    (2/2): webtatic/x86_64/primary_db                                                                                                                | 248 kB  00:00:15
    Resolving Dependencies
    --> Running transaction check
    ---> Package mod_php72w.x86_64 0:7.2.27-1.w7 will be installed
    --> Processing Dependency: libargon2.so.0()(64bit) for package: mod_php72w-7.2.27-1.w7.x86_64
    Complete!
    [root@iZbp143t3oxhfc3ar7jey0Z ~]# systemctl restart httpd

    如果php7解析php文件失败,可以执行yum -y install php* --skip-broken后再执行以上php7安装命令

    5. 安装nextcloud

    [root@iZbp143t3oxhfc3ar7jey0Z ~]# cd /var/www/html/
    [root@iZbp143t3oxhfc3ar7jey0Z html]# wget https://download.nextcloud.com/server/releases/nextcloud-15.0.0.zip
    --2020-03-11 22:43:23--  https://download.nextcloud.com/server/releases/nextcloud-15.0.0.zip
    Resolving download.nextcloud.com (download.nextcloud.com)... 95.217.64.181, 2a01:4f9:2a:3119::181
    Connecting to download.nextcloud.com (download.nextcloud.com)|95.217.64.181|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 52639697 (50M) [application/zip]
    Saving to: ‘nextcloud-15.0.0.zip’
    
    100%[==============================================================================================================================>] 52,639,697  7.82KB/s   in 1h 41m
    
    2020-03-12 00:24:39 (8.47 KB/s) - ‘nextcloud-15.0.0.zip’ saved [52639697/52639697]
    
    [root@iZbp143t3oxhfc3ar7jey0Z html]# unzip nextcloud-15.0.0.zip
    Archive:  nextcloud-15.0.0.zip
       creating: nextcloud/
       creating: nextcloud/ocs/
      inflating: nextcloud/ocs/v2.php
      inflating: nextcloud/ocs/v1.php
    [root@iZbp143t3oxhfc3ar7jey0Z html]# chown -R apache:apache /var/www/html/nextcloud
    [root@iZbp143t3oxhfc3ar7jey0Z html]# chmod -R 775 /var/www/html/nextcloud

    6. 配置apache虚拟目录

    [root@iZbp143t3oxhfc3ar7jey0Z html]# vim /etc/httpd/conf.d/vhost.conf
    [root@iZbp143t3oxhfc3ar7jey0Z html]#  systemctl restart httpd
    [root@iZbp143t3oxhfc3ar7jey0Z html]# lsof -i:80
    COMMAND    PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    AliYunDun 1114   root   21u  IPv4  16911      0t0  TCP iZbp143t3oxhfc3ar7jey0Z:35966->100.100.30.26:http (ESTABLISHED)
    httpd     5423   root    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5424 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5425 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5426 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5427 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5437 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5438 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5443 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5444 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5445 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    httpd     5446 apache    3u  IPv4  56934      0t0  TCP *:http (LISTEN)
    [root@iZbp143t3oxhfc3ar7jey0Z html]#
    [root@iZbp143t3oxhfc3ar7jey0Z html]# cat  /etc/httpd/conf.d/vhost.conf
    <VirtualHost *:80>
        DocumentRoot "/var/www/html"
        ServerName cloud.magedu.com
        ServerAlias cloud.magedu.com
        <Directory "/var/www/html/">
             Options FollowSymLinks
             AllowOverride All
             Require all granted
        </Directory>
    </VirtualHost>
    [root@iZbp143t3oxhfc3ar7jey0Z html]#

    7. 配置nextcloud

    地址就是:ip+/nextcloud

     测试上传文件

     

  • 相关阅读:
    Spring注解开发系列Ⅵ --- AOP&事务
    Spring注解开发系列Ⅴ --- 自动装配&Profile
    Spring注解开发系列Ⅲ --- 生命周期
    Spring注解开发系列Ⅱ --- 组件注册(下)
    .net Core在过滤器中获取 系统接口方法(以IMemoryCache 为例) 及HttpContext 获取系统接口
    【旧文章搬运】炉子给的SYSTEM_HANDLE_TYPE有点错误
    【旧文章搬运】超级无敌大炉子的LzOpenProcess
    【旧文章搬运】PE重定位表学习手记
    【旧文章搬运】ZwQuerySystemInformation枚举内核模块及简单应用
    【旧文章搬运】ZwQuerySystemInformation枚举进线程信息
  • 原文地址:https://www.cnblogs.com/dalianpai/p/12466730.html
Copyright © 2020-2023  润新知