What is Nextcloud and Why is it Useful?

Nextcloud is an open-source, self-hosted cloud storage platform that allows users to securely store, share, and manage files, documents, and media across devices. It provides functionalities similar to commercial cloud services like Google Drive, Dropbox, and Microsoft OneDrive but with complete control over your data and privacy.

Key Benefits of Nextcloud:

  • Data Privacy: You own and control your data, with no reliance on third-party storage providers.
  • Collaboration Tools: Built-in features like file syncing, calendar management, contacts, and document editing facilitate team collaboration.
  • Secure File Sharing: You can easily share files internally and externally with access control and password protection.
  • Extensibility: Nextcloud supports a variety of apps and plugins to add more features such as video calls, office document editing, and more.

Nextcloud is especially useful for businesses and individuals looking to maintain data sovereignty while enjoying the convenience of cloud storage and collaboration tools. It can be hosted on-premises or in the cloud, offering flexibility and scalability.


Creating an Instance on Cloud.shape.host

Step 1: Access the Dashboard and Create

Log in to your Cloud.shape.host account, click Create, and select Instances.

Shape.host Resources dashboard with Create > Instance highlighted.

Step 2: Choose a Datacenter Location

Pick a datacenter location that fits your needs, such as New York, London, or Frankfurt.

Shape.host instance form with the data center location selector highlighted.

Step 3: Select a Plan

Choose the plan that fits your resource needs (Standard, CPU-Optimized, or Memory-Optimized).

Step 4: Choose an Operating System

Select Ubuntu 24.04 as the operating system.

Shape.host instance form with the operating system image selector highlighted.

Step 5: Configure and Launch

Set the Network Type and Authentication Method (SSH key or password). Name the instance and click Create Instance.

Shape.host instance form with the Create Instance button highlighted.

Locate Your Instance’s IP Address

Shape.host Resources dashboard with the server IP address highlighted.

Accessing Your Instance

Once your instance is launched, you can access it using:

  • SSH (for Linux/macOS):
    Open a terminal and connect using:
   ssh root@<your-instance-ip>

Replace <your-instance-ip> with the public IP of your instance.

  • PuTTY (for Windows):
    Download PuTTY, enter the instance’s public IP, and click Open.

Installing and Configuring Nextcloud

Step 1: Update and Upgrade the System

Run the following commands to update your system:

apt update -y
apt upgrade -y
Terminal showing APT package management commands and output.

Step 2: Install Apache, MariaDB, PHP, and Other Dependencies

Install the necessary packages for Nextcloud:

apt install apache2 mariadb-server php php-curl php-cli php-mysql php-gd php-common php-xml php-json php-intl php-pear php-imagick php-dev php-common php-mbstring php-zip php-soap php-bz2 php-bcmath php-gmp php-apcu libmagickcore-dev php-redis php-memcached curl unzip imagemagick certbot python3-certbot-apache
Terminal showing APT package management commands and output.

Step 3: Check Apache and MariaDB Status

Ensure that Apache and MariaDB are enabled and running:

systemctl is-enabled apache2
systemctl status apache2
systemctl is-enabled mariadb
systemctl status mariadb
Terminal showing systemd service management commands or output.
Terminal showing systemd service management commands or output.

Step 4: Verify PHP Version

Make sure PHP is installed correctly:

php -v
Terminal showing php commands or output during Verify PHP Version.

Step 5: Configure PHP Settings

Edit the PHP configuration file:

nano /etc/php/8.3/apache2/php.ini
Terminal showing php commands or output during Configure PHP Settings.

Make the following changes:

date.timezone = Europe/Amsterdam
memory_limit = 512M
upload_max_filesize = 500M
post_max_size = 600M
max_execution_time = 300
file_uploads = On
allow_url_fopen = On
display_errors = Off
output_buffering = Off

Type Ctrl + X to save and exit, confirm with Y and press Enter.

Step 6: Restart Apache

Apply the changes by restarting Apache:

systemctl restart apache2
Terminal showing systemd service management commands or output.

Step 7: Secure MariaDB and Create Nextcloud Database

Run the secure installation for MariaDB:

mariadb-secure-installation
Terminal showing MariaDB/MySQL database security configuration prompts.
Terminal showing mariadb commands or output during Secure MariaDB and Create Nextcloud Database.

Log into MariaDB and set up the Nextcloud database:

mariadb -u root -p

Execute the following SQL commands:

CREATE DATABASE nextclouddb;
CREATE USER nextcloud@localhost IDENTIFIED BY 'passw0rd';
GRANT ALL PRIVILEGES ON nextclouddb.* to nextcloud@localhost;
FLUSH PRIVILEGES;
SHOW GRANTS FOR nextcloud@localhost;
Terminal showing SQL database and user configuration commands.

Type quit to exit from the MariaDB server.

Step 8: Configure Firewall

Allow Apache and SSH traffic:

ufw allow 'Apache Full'
ufw reload
ufw allow ssh
ufw enable
ufw status
Terminal showing firewall configuration commands and rules.

Step 9: Download and Install Nextcloud

Navigate to the /var/www/ directory:

cd /var/www/

Download and unzip the latest version of Nextcloud:

curl -o nextcloud.zip https://download.nextcloud.com/server/releases/latest.zip
unzip nextcloud.zip
Terminal showing cd commands or output during Download and Install Nextcloud.
Terminal showing unzip commands or output during Download and Install Nextcloud.

Set the proper permissions for the Nextcloud directory:

chown -R www-data:www-data /var/www/nextcloud
Terminal showing file ownership or permission commands.

Step 10: Configure Apache for Nextcloud

Create a new Apache configuration file for Nextcloud:

nano /etc/apache2/sites-available/nextcloud.conf
Terminal showing file ownership or permission commands.

Insert the following configuration:

<VirtualHost *:80>
 ServerName tutorials.shape.host
 DocumentRoot /var/www/nextcloud/

 # log files
 ErrorLog /var/log/apache2/tutorials.shape.host-error.log
 CustomLog /var/log/apache2/tutorials.shape.host-access.log combined

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

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

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud
 </Directory>
</VirtualHost>
Terminal showing web server configuration text.

Step 11: Enable Apache Configuration and Restart Apache

Enable the Nextcloud site and restart Apache:

a2ensite nextcloud.conf
apachectl configtest
systemctl restart apache2
Terminal showing an Apache configuration test.
Terminal showing systemd service management commands or output.

Step 12: Enable SSL with Certbot

Secure your Nextcloud installation with an SSL certificate using Certbot:

certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email contact@shape.host -d tutorials.shape.host
Terminal showing Certbot certificate commands and messages.

Open your web browser and go to https://your.domain.com/. If everything is set up correctly, the Nextcloud installation page will be displayed.

On the Nextcloud installation screen, configure the following settings:

  • Enter the administrator username and password for Nextcloud.
  • Set the storage location as the default directory.
  • Provide the Nextcloud database details that you created earlier.
  • Click on Install to begin the installation process.
Nextcloud account creation form.

You can now install some Nextcloud applications or click Skip.

Nextcloud setup interface.

After the process is complete, you’ll see the following page:

Nextcloud dashboard with file and activity widgets.

After completing these steps, you will have a fully functional Nextcloud instance running on your Ubuntu 24.04 server. Use Shape.host’s reliable Cloud SSD VPS services for hosting your Nextcloud and managing your cloud storage needs.