Ubuntu 16 下安装 NextCloud 及配置

我在上周购买的 NanoPi Neo2 金甲套装上安装 NextCloud操作如下

1.更新软件列表

apt update
apt-get upgrade

2.安装Apache

apt install -y apache2

3.安装MariaDB

apt install -y mariadb-server

4.安装PHP7

apt install -y libapache2-mod-php7.0

4.1.安装php7报错

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php-7.0
E: Couldn't find any package by regex 'php-7.0'

执行

sudo apt-add-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0
sudo apt-get install php7.0-fpm php7.0-mysql;

5.安装PHP各种扩展

apt install -y php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip

6.启用Apache模块

a2enmod rewrite
a2enmod headers
a2enmod dir
a2enmod env
a2enmod mime
service apache2 restart

7.安装NextCloud

cd /tmp/
wget https://download.nextcloud.com/server/releases/latest-13.tar.bz2
tar -jxvf latest-*.bz2
mv nextcloud /var/www/html/
mkdir /var/www/html/nextcloud/data
chown -R www-data:www-data /var/www/html/nextcloud

8.创建数据库

sudo mysql -u root -p
create database nextclouddb;
grant all on nextclouddb.* to 'nextclouduser'@'localhost' identified by 'nextclouduser';
quit

9.安装NextCloud

浏览器访问http://服务器IP,进行安装

[优化]10.启用PHP OPcache

在php.ini中进行如下修改

opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

[优化]11.使用Cron执行后台任务

crontab -u www-data -e
*/15  *  *  *  * php -f /var/www/html/nextcloud/cron.php
分享 评论