目 录CONTENT

文章目录

debian安装nextcloud

ashin
2021-08-18 / 0 评论 / 0 点赞 / 1598 阅读 / 0 字

nextcloud21版本起,已经不支持PHP7.X,需要安装PHP8

1、安装PHP8

添加PHP8安装源

apt update
apt upgrade
apt -y install lsb-release apt-transport-https ca-certificates wget
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
apt update

安装PHP和必要的扩展。

apt install php8.0 php8.0-fpm php8.0-gd php8.0-mbstring php8.0-dom php8.0-curl php8.0-zip php8.0-simplexml php8.0-xml php8.0-mysql php8.0-bz2 php8.0-intl php8.0-ldap php8.0-smbclient php8.0-imap php8.0-bcmath php8.0-gmp php8.0-redis php8.0-imagick -y

2、安装Apache

安装Apache和PHP模块。

apt install apache2 libapache2-mod-php8.0 -y

启动Apache并启用它在引导时运行

systemctl start apache2
systemctl enable apache2

3、安装NextCloud

下载最新版本的NextCloud,这里以22.1.0版为例。

wget https://download.nextcloud.com/server/releases/nextcloud-22.1.0.tar.bz2

将发行版解压缩到/var/www/html目录中。

tar -xjf nextcloud-22.1.0.tar.bz2 -C /var/www

让Apache成为NextCloud文件的所有者。

chown -R www-data:www-data /var/www/nextcloud
chmod -R 755 /var/www/nextcloud

4、优化PHP(注意PHP路径,大小按需填写)

sed -i "s/memory_limit = .*/memory_limit = -1/" /etc/php/8.0/apache2/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.0/apache2/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=1/" /etc/php/8.0/apache2/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 10240M/" /etc/php/8.0/apache2/php.ini
sed -i "s/post_max_size = .*/post_max_size = 10240M/" /etc/php/8.0/apache2/php.ini
sed -i "s/output_buffering = .*/;output_buffering = 4096/" /etc/php/8.0/apache2/php.ini

sed -i "s/memory_limit = .*/memory_limit = -1/" /etc/php/8.0/cli/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.0/cli/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=1/" /etc/php/8.0/cli/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 10240M/" /etc/php/8.0/cli/php.ini
sed -i "s/post_max_size = .*/post_max_size = 10240M/" /etc/php/8.0/cli/php.ini
sed -i "s/output_buffering = .*/;output_buffering = 4096/" /etc/php/8.0/cli/php.ini

sed -i "s/memory_limit = .*/memory_limit = -1/" /etc/php/8.0/fpm/php.ini
sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/8.0/fpm/php.ini
sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=1/" /etc/php/8.0/fpm/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 10240M/" /etc/php/8.0/fpm/php.ini
sed -i "s/post_max_size = .*/post_max_size = 10240M/" /etc/php/8.0/fpm/php.ini
sed -i "s/output_buffering = .*/;output_buffering = 4096/" /etc/php/8.0/fpm/php.ini

4、配置NextCloud

打开浏览器,访问你服务器IP地址,根据提示操作即可。

http://192.0.2.123/nextcloud/

5、安装mysql数据库(可选,非必须)

如果基于性能考虑,需要使用mysql数据库,可以参考以下教程安装数据库。

debian安装mariadb

0

评论区