Skip to content

Debian install

Installing Nextcloud on DebianΒΆ

After Debian Minimal InstallΒΆ

  1. Install Necessary Packages:

    sudo apt install -y exa micro neofetch zram-tools wget unzip curl
    
  2. Change zram Configuration:

    sudo micro /etc/default/zramswap
    
  3. Replace .bashrc:

    rm .bashrc
    wget https://raw.githubusercontent.com/drewgrif/dotfiles/main/.bashrc
    bash
    

Downloading and Installing NextcloudΒΆ

  1. Download Nextcloud:

    wget https://download.nextcloud.com/server/releases/latest.zip
    
  2. Install MariaDB:

    sudo apt install -y mariadb-server
    sudo mysql_secure_installation
    
  3. Create Nextcloud Database:

    sudo mariadb
    

    Inside the MariaDB shell:

    CREATE DATABASE nextcloud;
    GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'mypassword';
    FLUSH PRIVILEGES;
    

    Exit the MariaDB shell with CTRL+D.

  4. Set Up Apache Webserver:

    • Install Required Packages:

      sudo apt install php php-apcu php-bcmath php-cli php-common php-curl php-gd php-gmp php-imagick php-intl php-mbstring php-mysql php-zip php-xml
      
    • Enable Apache Modules:

      sudo a2enmod dir env headers mime rewrite ssl
      sudo phpenmod bcmath gmp imagick intl
      
    • Unzip and Move Nextcloud:

      unzip latest.zip
      sudo chown -R www-data:www-data nextcloud
      sudo mv nextcloud /var/www
      sudo a2dissite 000-default.conf
      
    • Configure Apache for Nextcloud:

      sudo micro /etc/apache2/sites-available/nextcloud.conf
      

      Add the following contents to nextcloud.conf:

      <VirtualHost *:80>
          DocumentRoot "/var/www/nextcloud"
          ServerName nextcloud
      
          <Directory "/var/www/nextcloud/">
              Options MultiViews FollowSymlinks
              AllowOverride All
              Order allow,deny
              Allow from all
          </Directory>
      
          TransferLog /var/log/apache2/nextcloud_access.log
          ErrorLog /var/log/apache2/nextcloud_error.log
      </VirtualHost>
      
    • Enable Nextcloud Site and Restart Apache:

      sudo a2ensite nextcloud.conf
      sudo systemctl restart apache2
      
  5. Adjust PHP Settings (for Debian 12):

    sudo micro /etc/php/8.2/apache2/php.ini
    

    Update the following parameters:

    memory_limit = 512M
    upload_max_filesize = 16G
    max_execution_time = 360
    post_max_size = 16G
    date.timezone = America/New_York
    opcache.enable=1
    opcache.interned_strings_buffer=32
    opcache.max_accelerated_files=10000
    opcache.memory_consumption=128
    opcache.save_comments=1
    opcache.revalidate_freq=1
    
  6. Restart Apache:

    sudo systemctl restart apache2
    

For additional configuration related to using an external USB drive, see 02 Using an external USB drive. sudo mysql_secure_installation

#### Create Nextcloud Database

```shell
sudo mariadb

CREATE DATABASE nextcloud;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'mypassword';
FLUSH PRIVILEGES;
CTRL+D to exit

Apache Webserver SetupΒΆ

Installing the required packages to support Apache:

sudo apt install php php-apcu php-bcmath php-cli php-common php-curl php-gd php-gmp php-imagick php-intl php-mbstring php-mysql php-zip php-xml
sudo a2enmod dir env headers mime rewrite ssl
sudo phpenmod bcmath gmp imagick intl

Unzip and move nextcloudΒΆ

unzip latest.zip
sudo chown -R www-data:www-data nextcloud
sudo mv nextcloud.learnlinux.cloud /var/www
sudo a2dissite 000-default.conf
sudo micro /etc/apache2/sites-available/nextcloud.conf
Contents of nextcloud.conf file.
<VirtualHost *:80>
    DocumentRoot "/var/www/nextcloud"
    ServerName nextcloud

    <Directory "/var/www/nextcloud/">
        Options MultiViews FollowSymlinks
        AllowOverride All
        Order allow,deny
        Allow from all
   </Directory>

   TransferLog /var/log/apache2/nextcloud_access.log
   ErrorLog /var/log/apache2/nextcloud_error.log

</VirtualHost>
sudo a2ensite nextcloud.conf

As of Debian 12

sudo micro /etc/php/8.2/apache2/php.ini

Adjust the following parameters:

  • memory_limit = 512M
  • upload_max_filesize = 16G
  • max_execution_time = 360
  • post_max_size = 16G
  • date.timezone = America/New_York
  • opcache.enable=1
  • opcache.interned_strings_buffer=32
  • opcache.max_accelerated_files=10000
  • opcache.memory_consumption=128
  • opcache.save_comments=1
  • opcache.revalidate_freq=1
sudo systemctl restart apache2