CentOS7.6 搭建NextCloud云存储

操作系统:CentOS 7.6.1810 

环境软件:Apache 2.4.6 、MySQL 8.0.15 、PHP 7.2.14

应用软件:NextCloud 15.0.4


系统配置

yum install -y epel-release yum-utils unzip curl wget vim \
bash-completion policycoreutils-python mlocate bzip2
yum update -y


安装Apache

yum install -y httpd

vi /etc/httpd/conf.d/nextcloud.conf
添加
<VirtualHost *:80>
  DocumentRoot /var/www/html/
  ServerName  192.168.1.110

<Directory "/var/www/html/">
  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>

systemctl start httpd.service
systemctl enable httpd.service


安装PHP

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

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 php72w-pecl-imagick


安装MySQL

rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
yum repolist all | grep mysql | grep enabled
yum install -y mysql-community-server

systemctl start mysqld
systemctl enable mysqld

cat /var/log/mysqld.log | grep -i 'temporary password'
mysql_secure_installation
mysql -u root -p
CREATE DATABASE nextcloud;
CREATE USER 'nextclouduser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'NextCL@ud123';
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' WITH GRANT OPTION; 
FLUSH PRIVILEGES;
EXIT;

vim /etc/my.cnf  
增加
default-authentication-plugin=mysql_native_password

systemctl restart mysqld

#可避免系统提示“Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

#因为MySQL 8默认使用了新的密码验证插件caching_sha2_password,之前的PHP版本中所带的mysqlnd无法支持这种验证


安装Nextcloud

wget https://download.nextcloud.com/server/releases/nextcloud-15.0.4.zip
unzip nextcloud-*.zip
#wget下载速度非常慢,建议下载好后winscp上传
cp -R nextcloud/ /var/www/html/
mkdir /var/www/html/nextcloud/data
chown -R apache:apache /var/www/html/nextcloud

systemctl restart httpd.service

浏览器访问http://ip/nextcloud/进行安装


安装redis

yum install -y redis

systemctl start redis.service
systemctl enable redis.service

vim /var/www/html/nextcloud/config/config.php 
添加
'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'memcache.local' => '\OC\Memcache\APCu',
'redis' => array(
  'host' => 'localhost',
  'port' => 6379,
    ),

CentOS7.6 搭建NextCloud云存储


更新日期: 2019年02月13日
文章标签: Linux
文章链接: https://www.vos.cn/os/265.html  
版权说明:如非注明,本站文章均为vOS原创,转载请注明出处和附带本文链接。