Horje
How to Install Nextcloud on Ubuntu?

You are determined to take over your data and set up your cloud storage. Great! Nextcloud effortlessly saves files, contacts, and calendars because it is open-source software.

The following information will help you set up Nextcloud step-by-step on Ubuntu. This manual should be easy to understand whether you are an old hand or have never attempted installations before.

What is Nextcloud?

Nextcloud is a collection of client-server software that can create file-hosting services for clients. It is more powerful and safe than Dropbox, Google Drive, or iCloud services; however, it does not offer total control over its use of it. One can keep their files on their server, an assuring approach when it comes to issues related to security and privacy.

Why Use Nextcloud?

Nextcloud offers numerous advantages:

  • Privacy: Your data stays with you.
  • Security: Advanced security features like two-factor authentication.
  • Customization: Tons of apps and integrations.
  • Cost: Free and open-source.

Prerequisites

Before you start installing, you will need to know a few things.

System Requirements:

To run Nextcloud smoothly, your server should meet the following requirements:

  1. Operating System: Ubuntu 20.04 LTS or newer.
  2. Memory: Minimum 512MB RAM (2GB recommended).
  3. Storage: At least 2GB of free space.
  4. Processor: 1 GHz CPU or faster.
  5. Preparing Your Server
  6. Ensure your server is up to date:

Step-by-Step Installation Guide

Ready to get your hands dirty? Let’s dive in!

1. Update and Upgrade Your System

First, make sure your system is updated:

sudo apt update && sudo apt upgrade -y

2. Install Apache and Dependencies

Nextcloud requires a web server. We’ll use Apache:

sudo apt install apache2 -y

3. Install PHP and Required Extensions

Nextcloud is built on PHP, so we’ll need to install PHP and some extensions:

sudo apt install php libapache2-mod-php php-mysql php-gd php-json php-curl php-mbstring php-intl php-imagick php-xml php-zip -y

4. Install MariaDB and Set Up Database

For database management, we’ll use MariaDB:

sudo apt install mariadb-server -y
sudo mysql_secure_installation

5. Create a database and user for Nextcloud:

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

Download and Configure Nextcloud

6. Download Nextcloud from its official site:

cd /var/www/
sudo wget https://download.nextcloud.com/server/releases/nextcloud-22.2.0.zip
sudo unzip nextcloud-22.2.0.zip
sudo chown -R www-data:www-data /var/www/nextcloud/
sudo chmod -R 755 /var/www/nextcloud/

7. Set Up Apache Virtual Host for Nextcloud

Create an Apache configuration file for Nextcloud:

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

Add the following configuration:

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot /var/www/nextcloud/

ServerName example.com

<Directory /var/www/nextcloud/>

Options +FollowSymlinks

AllowOverride All

<IfModule mod_dav.c>

Dav off

</IfModule>

</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Enable the site and the required Apache modules:

sudo a2ensite nextcloud.conf
sudo a2enmod rewrite headers env dir mime
sudo systemctl restart apache2

8. Enable Necessary Apache Modules and Restart

Ensure that the necessary Apache modules are enabled:

sudo a2enmod rewrite headers env dir mime
sudo systemctl restart apache2

9. Run Nextcloud Web Installer

To complete the installation through the Nextcloud web interface, open your browser and then visit your server’s IP address or domain name. End with following the on-screen instructions to complete setup.

Post-Installation Steps

You’ve got Nextcloud up and running, but there are a few more steps to ensure everything is secure and running smoothly.

1. Secure Your Nextcloud Installation

Security is paramount. Make sure to set strong passwords and enable two-factor authentication.

2. Configure SSL with Let’s Encrypt

Encrypt traffic to and from your Nextcloud server using Let’s Encrypt:

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache

Follow the prompts to configure your SSL certificates.

3. Set Up a Cron Job for Nextcloud

Cron jobs help keep your Nextcloud running smoothly by handling background tasks:

sudo crontab -u www-data -e

Add the following line:

*/15 * * * * php -f /var/www/nextcloud/cron.php

Common Issues and Troubleshooting

Even the best-laid plans can go awry. Here’s how to troubleshoot common issues.

1. Installation Errors

If you encounter errors during installation, check the logs:

sudo tail -f /var/log/apache2/error.log

2. Performance Issues

Ensure your server meets the recommended specifications. You can also optimize PHP settings in the php.ini file to enhance performance.

Conclusion

Congratulations! You’ve successfully installed Nextcloud on your Ubuntu server. Now, you can enjoy a secure, private cloud storage solution you control. Regular updates and maintenance are key to keeping your Nextcloud running smoothly.

How to Install Nextcloud on Ubuntu – FAQs

What is Nextcloud and why should I install it on Ubuntu?

Nextcloud is an open-source platform for creating and managing your own cloud storage service. Installing Nextcloud on Ubuntu allows you to securely store, share, and access files from any device, providing a self-hosted alternative to proprietary cloud services.

How do I prepare my Ubuntu system for Nextcloud installation?

To prepare your Ubuntu system for Nextcloud installation, update your package list and install necessary dependencies like Apache, PHP, and MariaDB:

sudo apt update
sudo apt install apache2 libapache2-mod-php mariadb-server php php-mysql php-xml php-gd php-curl php-zip php-mbstring php-intl php-bcmath php-imagick

How do I complete the Nextcloud installation through the web interface on Ubuntu?

Open a web browser and navigate to http://your_domain.com. You will see the Nextcloud setup page. Enter the admin account details, the database details created earlier, and complete the setup. Follow the on-screen instructions to finish the installation.

How do I update Nextcloud on Ubuntu?

To update Nextcloud on Ubuntu, follow the official Nextcloud update guide. Backup your data and database, download the latest Nextcloud version, and replace the old files with the new ones, ensuring you maintain the config and data directories.




Reffered: https://www.geeksforgeeks.org


TechTips

Related
Remote Server Management from the Ubuntu Terminal Remote Server Management from the Ubuntu Terminal
How to Make UPI Payment Without Internet? How to Make UPI Payment Without Internet?
How to Enable Gmail Dark Mode? How to Enable Gmail Dark Mode?
How to Verify Checksum of a File in Windows? How to Verify Checksum of a File in Windows?
How to Find All Failed SSH Login Attempts in Linux System? How to Find All Failed SSH Login Attempts in Linux System?

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
27