基于Centos7环境搭建Nextcloud私有云服务

Nextcloud是一套开源的文件共享和同步解决方案,其前身是ownCloud。众所周知的原因,依赖国内云盘服务商存储文件并不可靠(文件莫名被删除、泄漏、存取速度受限……)。把Nextcloud部署到自己的服务器上,既可掌控文件自身安全,又可免于受云盘服务商故意限速之苦。下面就介绍如何在Centos7系统上部署Nextcloud:
安装MariaDB数据库:
yum -y install mariadb-server mariadb
启动MariaDB数据库:

systemctl start mariadb.service
systemctl enable mariadb.service

设置数据库管理员密码:
mysql_secure_installation
安装Apache:
yum install -y httpd
启动Apache:
systemctl start httpd.service
设置开机自动启动httpd服务:
systemctl enable httpd.service
安装php7.0:

  1. 首先安装SCL存储库:
  2. yum install centos-release-scl

  3. 然后安装php7.0和依赖模块
  4. yum install rh-php70 rh-php70-php rh-php70-php-gd rh-php70-php-mbstring

  5. 为MySQL/MariaDB安装新的PHP7.0模块:
  6. yum install rh-php70-php-mysqlnd

  7. 安装LDAP模块
  8. yum install rh-php70-php-ldap

  9. 通过更改名称禁止加载旧的PHP Apache模块
  10. mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php54.off
    mv /etc/httpd/conf.modules.d/10-php.conf /etc/httpd/conf.modules.d/10-php54.off
  11. 将PHP7.0 Apache模块符号链接到位:
  12. ln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php70-php.conf /etc/httpd/conf.d/
    ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php70-php.conf /etc/httpd/conf.modules.d/
    ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php70-php7.so /etc/httpd/modules/
  13. 重启Apache
  14. service httpd restart

配置EPEL存储库:
yum install epel-release
安装phpMyAdmin:
yum install phpmyadmin
更改phpMyAdmin配置文件:
vi /etc/httpd/conf.d/phpMyAdmin.conf
修改后的内容如下:


   AddDefaultCharset UTF-8
   
     # Apache 2.4
     
      # Require ip 127.0.0.1  #注释掉
      # Require ip ::1   #注释掉
      Require all granted   #新添加
     
 
 
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   


   
     # Apache 2.4
     
      #Require ip 127.0.0.1  #注释掉
      #Require ip ::1   #注释掉
      Require all granted   #新添加
     
   
   
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from 127.0.0.1
     Allow from ::1
   

重启Aapache:
systemctl restart httpd
通过phpMyAdmin创建nextcloud数据库和用户,并为用户授权。
定位到网站根目录并下载nextcloud服务端压缩包:

cd var/www/html
wget https://download.nextcloud.com/server/releases/xxx(xxx为对应的版本号)

安装unzip解压程序:
yum -y install unzip
解压服务端压缩包
unzip xxx
赋予目录权限:
chmod -R 777 nextcloud
浏览器打开服务器ip/nextcloud进行相关配置。

发表评论

电子邮件地址不会被公开。 必填项已用*标注