环境

    Nextcloud安装包 https://download.nextcloud.com/server/releases/nextcloud-20.0.2.zip

    1,关闭防火墙

    1. //临时关闭防火墙
    2. #systemctl stop firewalld
    3. #systemctl disable firewalld
    4. //
    5. #setenforce 0
    6. //sed -i '/^SELINUX=/cSELINUX=disabled' /etc/selinux/config

    2.解决一些依赖问题

    1. //安装依赖
    2. # yum install -y epel-release yum-utils unzip curl wget bash-completion policycoreutils-python mlocate bzip2
    3. # yum update -y
    4. # yum install -y httpd

    3,安装Apache Web服务并配置

    1. //安装Apache Web服务
    2. # yum install -y httpd
    3. 编写Nextcloud的配置文件
    4. #vim /etc/httpd/conf.d/nextcloud.conf
    5. 将下面内容写入文件:
    6. <VirtualHost *:80>
    7. DocumentRoot /var/www/html/
    8. ServerName 127.0.0.1
    9. <Directory "/var/www/html/">
    10. Require all granted
    11. AllowOverride All
    12. Options FollowSymLinks MultiViews
    13. </Directory>
    14. </VirtualHost>
    15. //设置web服务器开机自启并手动运行
    16. #systemctl enable httpd.service
    17. #systemctl start httpd.service

    4,安装PHP

    1. //安装PHP模块
    2. 1、# yum install -y centos-release-scl
    3. 2、# yum install -y rh-php72 rh-php72-php rh-php72-php-gd rh-php72-php-mbstring rh-php72-php-intl rh-php72-php-pecl-apcu rh-php72-php-mysqlnd rh-php72-php-pecl-redis rh-php72-php-opcache rh-php72-php-imagick
    4. //创建一些必要的链接
    5. 3、# ln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php72-php.conf /etc/httpd/conf.d/
    6. 4、# ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php72-php.conf /etc/httpd/conf.modules.d/
    7. 5、# ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php72-php7.so /etc/httpd/modules/
    8. 6、# ln -s /opt/rh/rh-php72/root/bin/php /usr/bin/php

    5,安装数据库并创库

    1. //安装数据库
    2. 1、# yum install -y mariadb mariadb-server
    3. 设置数据库开机自启并手动运行
    4. 2、# systemctl enable mariadb.service
    5. 3、# systemctl start mariadb.service
    6. mysql_secure_installation
    7. //进入MySQL
    8. 4、# mysql -u root -p
    9. //创库
    10. CREATE DATABASE nextcloud;
    11. //授权
    12. create user nextcloud@localhost identified by '改成自己的密码';
    13. grant all on *.* to 'nextcloud'@'localhost' identified by '上面设置的密码' with grant option;
    14. FLUSH PRIVILEGES;
    15. //退出
    16. EXIT
    17. //重启MySQL服务
    18. 5systemctl restart mariadb.service

    6.下载NextCloud并配置

    1. 1、# wget https://download.nextcloud.com/server/releases/nextcloud-20.0.2.zip
    2. // 如果上面的失效了就下载源码包https://download.nextcloud.com/server/releases/nextcloud-20.0.2.zip
    3. 2、# unzip /root/nextcloud-20.0.1.zip -d /var/www/html
    4. 7、# mkdir /var/www/html/data
    5. 8、# chown -R apache:apache /var/www/html/
    6. 9、# systemctl restart httpd.service

    7.在物理机上打开搭建好的NextCloud云盘。
    1、打开web页面.http://安装这台电脑的IP地址/nextcloud
    2、设置自己的用户名,密码;设置数据库需要点开,选择MySQL/MariaDB.
    3、数据库:nextcloud
    4、用户名:nextcloud
    5、密码:上面设置的密码
    6、安装推荐的应用的勾去掉,国内的网可能安装不上.
    7、点击安装