461 views
asked in Technology by

Step-by-Step Guide to Install and Configure Nextcloud on Ubuntu 24.04 LTS

1 Answer

answered by

To set up a file management server on Ubuntu with multi-user support (allowing file access and sharing based on individual usernames and passwords), we can use Nextcloud. It’s an open-source platform that provides file sharing, syncing, and collaboration with fine-grained access control. Below is a step-by-step guide to install and set up Nextcloud on Ubuntu:

Step 1: Update your system

Before installing any software, ensure your system packages are up to date:

sudo apt update && sudo apt upgrade

Step 2: Install Apache, MySQL, and PHP (LAMP Stack)

Nextcloud requires a LAMP (Linux, Apache, MySQL/MariaDB, PHP) server.

Install Apache

sudo apt install apache2

Install MySQL

    sudo apt install mysql-server
    sudo mysql_secure_installation

Install PHP and required modules Install PHP and the necessary modules required by Nextcloud:

   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 bzip2

Step 3: Download and Configure Nextcloud

Download Nextcloud Visit the Nextcloud download page to get the latest version of Nextcloud or use the following command to download the stable version:

   wget https://download.nextcloud.com/server/releases/latest.tar.bz2

Extract the file Unpack the downloaded archive:

    tar -xjf latest.tar.bz2

Move it to the web root directory Move the extracted Nextcloud files to the /var/www/html/ directory:

    sudo mv nextcloud /var/www/html/

Set the proper permissions Change ownership of the Nextcloud directory so that Apache can read and write to it:

    sudo chown -R www-data:www-data /var/www/html/nextcloud
    sudo chmod -R 755 /var/www/html/nextcloud

Step 4: Configure Apache for Nextcloud

Create a new Apache configuration file for Nextcloud

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

Add the following content:

<VirtualHost *:80>
    DocumentRoot /var/www/html/nextcloud
    ServerName Your-IP-Address
    <Directory /var/www/html/nextcloud/>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Enable the new configuration Enable the newly created configuration and Apache modules:

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

If getting error for 404 internal pages then issue due to htaccess.

run

    sudo a2enmod rewrite

Also change this in apache2.conf file located at /etc/apache2

    nano /etc/apache2/apache2.conf

    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

Finally Restart Apache

   sudo service apache2 restart

Step 5: Configure MySQL for Nextcloud

Log into MySQL

    sudo mysql -u root -p

Create a Nextcloud database and user Replace admin@123 with a secure password:

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

Step 6: Finish Installation through the Web Interface

Open a web browser and navigate to http://your-domain.com or your server's IP address.

Complete the installation:

Enter your desired admin username and password.

For the database:

    Database user: nextclouduser
    Password: the password you set in Step 5. ie admin@123
    Database name: nextcloud
    Host: localhost

    Click Finish Setup.

Step 7: Configure HTTPS (Optional but Recommended)

To secure your Nextcloud server, it’s strongly recommended to enable HTTPS with Let’s Encrypt.

Install Certbot

    sudo apt install certbot python3-certbot-apache

Generate SSL certificate

    sudo certbot --apache -d your-domain.com

    Follow the prompts to configure HTTPS.

Step 8: Enable File Sharing and Multi-user Access

After completing the setup, Nextcloud allows users to:

Create individual user accounts.

Upload and share files either publicly or with specific users/groups.

Create shared folders.

Step 9: Optional: Install Nextcloud Apps

Nextcloud comes with many additional features and apps, such as:

    External storage support (Google Drive, Dropbox, etc.).

    Collaboration tools (document editing, calendars, etc.).

You can install these apps directly from the Nextcloud web interface.

Step 10: Enable Indexing of Files (Optional)

Nextcloud automatically indexes files uploaded by users, and you can easily navigate through your files in a hierarchical structure. You can configure the full-text search and enable file previews by installing relevant apps via the Nextcloud app store.

Most popular tags

postgresql laravel replication laravel-10 ha postgresql mongodb ubuntu 24.04 lts mongodb database mongodb tutorial streaming-replication laravel-11 mysql database laravel postgresql backup laravel login register logout database mysql php technlogy asp.net asp.net c# mysql master slave replication centos linux laravel sql server schedule backup autobackup postgresql django python haproxy load balancer install self sign ssl laravel 11 - login with otp valid for 10 minutes. laravel 11 gaurds user and admin registration user and admin login multiauth postgresql 16 to postgresql 17 postgresql migration zabbix 7 how to install graylog on ubuntu 24.04 lts | step-by-step asp.net core mvc .net mvc network upload c# ssl integration sql server on ubuntu 22.04 lts mssql server ms sql server sql server user access in postgres mysql password change cent os linux configure replica kubernetes (k8s) install nginx load balancer install install and configure .net 8.0 in ubuntu 24.04 lts php in iis php with iis php tutorial chirags php tutorials chirags php tutorial chirags tutorial laravel 11 guards mongodb sharding metabase business analytics metabase ubuntu 24.04 koha 24.05 letsencrypt mongodb crud rocky linux laravel custom captcha laravel 11 captcha laravel captcha mongo dll php.ini debian 12 nginx apache nextcloud gitea in ubuntu git gitea npm error node js mysql ndb cluster mysql cluster ssl oracle login register logout in python debian windows shell batch file bat file time stamp date time shopping cart in laravel centos rhel swap memeory rhel 5.5
...