Ubuntu 18.4 安装Nextcloud 21

运行环境
ubuntu18 4.15.0
nextcloud-21.0.0
mysql Ver 15.1 Distrib 10.1.47-MariaDB

1. 添加php7.4源并安装

add-apt-repository ppa:ondrej/php && sudo apt-get update
apt-get update
apt-get install -y php7.4

2. 安装依赖

apt-get install -y php7.4-dev
apt-get install -y php-pear
apt-get install -y php7.4-fpm php7.4-mysql php7.4-curl php7.4-json php7.4-mbstring php7.4-xml php7.4-intl php7.4-gd php7.4-gmp php7.4-bcmath php-imagick php7.4-xml php7.4-zip

3. 下载nextcloud-21.0.0.zip并解压

打开nextcloud下载页面 https://nextcloud.com/install/#instructions-server

apt-get install -y zip
unzip ./nextcloud-21.0.0.zip
mv ./nextcloud /var/www/

4. 创建nextcloud数据库

mysql -uroot -p
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'username'@'localhost';
FLUSH PRIVILEGES;

5. 创建nextcloud配置文件

cd /etc/apache2/sites-available/
vim nextcloud.conf

/etc/apache2/sites-available/nextcloud.conf中输入下面的内容

Alias /nextcloud "/var/www/nextcloud/"


  Require all granted
  AllowOverride All
  Options FollowSymLinks MultiViews

  
    Dav off
  



  DocumentRoot /var/www/nextcloud/
  ServerName  your.server.com

  
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

    
      Dav off
    
  

启用nextcloud.conf配置

a2ensite nextcloud.conf
a2enmod rewrite

重启apache2服务

systemctl restart apache2

6. 修改nextcloud目录权限

sudo chown -R www-data:www-data /var/www/nextcloud

7. 测试

在浏览器中输入http://{server_ip}/nextcloud

你可能感兴趣的:(Ubuntu 18.4 安装Nextcloud 21)