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.
Step 2: Choose a Datacenter Location
Pick a datacenter location that fits your needs, such as New York, London, or Frankfurt.
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.
Step 5: Configure and Launch
Set the Network Type and Authentication Method (SSH key or password). Name the instance and click Create Instance.
Locate Your Instance’s IP Address
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
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
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
Step 4: Verify PHP Version
Make sure PHP is installed correctly:
php -v
Step 5: Configure PHP Settings
Edit the PHP configuration file:
nano /etc/php/8.3/apache2/php.ini
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
Step 7: Secure MariaDB and Create Nextcloud Database
Run the secure installation for MariaDB:
mariadb-secure-installation
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;
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
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
Set the proper permissions for the Nextcloud directory:
chown -R www-data:www-data /var/www/nextcloud
Step 10: Configure Apache for Nextcloud
Create a new Apache configuration file for Nextcloud:
nano /etc/apache2/sites-available/nextcloud.conf
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>
Step 11: Enable Apache Configuration and Restart Apache
Enable the Nextcloud site and restart Apache:
a2ensite nextcloud.conf
apachectl configtest
systemctl restart apache2
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
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.
You can now install some Nextcloud applications or click Skip.
After the process is complete, you’ll see the following page:
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.