• Install Debian: Download the latest version of Debian from the official website and follow the installation guide to install it on your system.
  • Install the LAMP stack: LAMP stands for Linux, Apache, MySQL, and PHP. You need to install these packages on your Debian system to run Nextcloud. Use the following command to install the LAMP stack:
sudo apt-get install apache2 mariadb-server php php-mysql php-gd php-mbstring php-curl php-zip php-intl php-xml php-json
  • Configure MariaDB: Once MariaDB is installed, you need to configure it. Run the following command:
sudo mysql_secure_installation

This command will prompt you to set a root password and remove the anonymous user, test database, and remote root login.

  • Create a database and user for Nextcloud: Log in to MariaDB with the following command:
sudo mysql -u root -p

Create a new database and user for Nextcloud with the following commands:

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

Replace “password” with a strong password of your choice.

  • Install Nextcloud: Download the latest version of Nextcloud from the official website and extract it to the web server root directory (/var/www/html/nextcloud). Run the following command:
sudo tar -xjf nextcloud-<version>.tar.bz2 -C /var/www/html/
  • Configure Apache: Create a new Apache configuration file for Nextcloud with the following command:
sudo nano /etc/apache2/sites-available/nextcloud.conf

Paste the following configuration into the file:

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/nextcloud/
ServerName example.com
ServerAlias www.example.com

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

<Directory /var/www/html/nextcloud/>
Options +FollowSymlinks
AllowOverride All

<IfModule mod_dav.c>
Dav off
</IfModule>

SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud

</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Replace “example.com” with your domain name and save the file.

  • Enable the newly created configuration file with the following command:
sudo a2ensite nextcloud.conf

Reload Apache with the following command:

sudo systemctl reload apache2
  • Finish the installation: Open a web browser and navigate to your Nextcloud server’s domain name. You will be prompted to create an admin account and set up your Nextcloud instance.

That’s it! You’ve successfully set up your own Nextcloud server on Linux Debian.


Discover more from Blogs | Saied Taki

Subscribe to get the latest posts sent to your email.

By Taki

Leave a Reply

Your email address will not be published. Required fields are marked *