Introduction
Nextcloud is a self-hosted file sharing and collaboration platform. It allows you to store, share, and synchronize files across devices. This tutorial will guide you through the process of installing Nextcloud on Debian 12.
Prerequisites
Before you begin, ensure you have:
- A Debian 12 server or desktop system
- SSH access to the server (optional)
- Root or sudo privileges
Step 1: Install LAMP Stack
Nextcloud requires a LAMP (Linux, Apache, MySQL/MariaDB, PHP) stack. Install the LAMP stack on Debian 12 by following this guide: How To Install Linux, Apache, MySQL, PHP (LAMP) Stack on Debian 12.
Step 2: Install Required PHP Modules
Install the required PHP modules for Nextcloud:
sudo apt update
sudo apt install -y php-gd php-curl php-zip php-mbstring php-xml php-intl php-bz2 php-common php-apcu
Step 3: Download Nextcloud
Download the latest version of Nextcloud:
cd /tmp
wget https://download.nextcloud.com/server/releases/latest.tar.bz2
Extract the Nextcloud archive:
sudo tar -xvf latest.tar.bz2 -C /var/www/
Set the correct permissions:
sudo chown -R www-data:www-data /var/www/nextcloud
Step 4: Configure Apache
Create a new Apache configuration file for Nextcloud:
sudo nano /etc/apache2/sites-available/nextcloud.conf
Add the following configuration:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/nextcloud/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
</VirtualHost>
Enable the Nextcloud site and rewrite module:
sudo a2ensite nextcloud.conf
sudo a2enmod rewrite
Restart Apache:
sudo systemctl restart apache2
Step 5: Complete the Installation
Open a web browser and navigate to:
http://your_server_ip_or_domain/nextcloud
Follow the on-screen instructions to complete the installation using the database credentials and admin account.
Conclusion
Congratulations! You have successfully installed Nextcloud on Debian 12. You can now use Nextcloud to store, share, and synchronize files across devices.