FedoraRHEL Based

How To Install Nextcloud on Fedora 40

Install Nextcloud on Fedora 40

In an era where data privacy and control are paramount, self-hosted cloud solutions have gained significant traction. Nextcloud stands out as a powerful, open-source platform that allows you to create your own cloud storage and collaboration system. This comprehensive guide will walk you through the process of installing Nextcloud on Fedora 40, providing you with a secure and customizable alternative to commercial cloud services.

What is Nextcloud?

Nextcloud is a suite of client-server software for creating and using file hosting services. It offers functionality similar to Dropbox, Office 365, or Google Drive, but with the added advantage of putting you in control of your data. Some key features include:

  • File synchronization and sharing
  • Collaborative document editing
  • Calendar and contact management
  • Video conferencing
  • Task management

By hosting Nextcloud on your own server, you gain complete control over your data, enhanced privacy, and the ability to customize the platform to your specific needs. This makes it an excellent choice for individuals, businesses, and organizations looking to maintain data sovereignty while enjoying the benefits of cloud technology.

Prerequisites

Before we begin the installation process, ensure that you have the following:

  • A Fedora 40 server with root or sudo access
  • At least 512MB of RAM (1GB or more recommended)
  • A minimum of 10GB free disk space
  • A domain name pointed to your server’s IP address (for remote access)

It’s also recommended to have a basic understanding of Linux command-line operations and web server administration.

Preparing Fedora 40

Start by updating your Fedora 40 system to ensure you have the latest packages and security updates:

sudo dnf update -y

Next, install some essential dependencies:

sudo dnf install wget unzip tar -y

Configure the firewall to allow HTTP and HTTPS traffic:

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

Installing a Web Server

Nextcloud requires a web server to function. While both Apache and Nginx are suitable options, we’ll use Apache in this guide due to its widespread use and ease of configuration.

Install Apache with the following command:

sudo dnf install httpd -y

Start Apache and enable it to run at boot:

sudo systemctl start httpd
sudo systemctl enable httpd

Verify that Apache is running:

sudo systemctl status httpd

Setting Up PHP

Nextcloud requires PHP and several PHP modules. Install them using the following command:

sudo dnf install php php-cli php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-pdo php-pecl-apcu php-intl -y

After installation, configure PHP for better performance and security. Open the PHP configuration file:

sudo nano /etc/php.ini

Make the following changes:

memory_limit = 512M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 300
date.timezone = Your/Timezone

Replace “Your/Timezone” with your actual timezone. Save the file and exit the editor.

Configuring Database

Nextcloud supports various database systems, but MariaDB (a fork of MySQL) is a popular choice. Install MariaDB with this command:

sudo dnf install mariadb mariadb-server -y

Start MariaDB and enable it to run at boot:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure your MariaDB installation:

sudo mysql_secure_installation

Follow the prompts to set a root password and remove insecure default settings.

Now, create a database and user for Nextcloud:

sudo mysql -u root -p

Enter your MariaDB root password, then run these SQL commands:

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

Replace ‘your_password’ with a strong, unique password.

Downloading and Installing Nextcloud

Download the latest version of Nextcloud:

wget https://download.nextcloud.com/server/releases/latest.zip

Unzip the downloaded file:

unzip latest.zip

Move the Nextcloud folder to your web server’s document root:

sudo mv nextcloud /var/www/html/

Set the correct permissions:

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

Configuring Web Server for Nextcloud

Create a new Apache configuration file for Nextcloud:

sudo nano /etc/httpd/conf.d/nextcloud.conf

Add the following content:

<VirtualHost *:80>
    ServerName your_domain.com
    DocumentRoot /var/www/html/nextcloud/
    
    <Directory /var/www/html/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
        <IfModule mod_dav.c>
            Dav off
        </IfModule>
        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud
    </Directory>
    
    ErrorLog /var/log/httpd/nextcloud_error.log
    CustomLog /var/log/httpd/nextcloud_access.log combined
</VirtualHost>

Replace ‘your_domain.com’ with your actual domain name. Save the file and exit the editor.

Restart Apache to apply the changes:

sudo systemctl restart httpd

Running the Nextcloud Installation Wizard

Open your web browser and navigate to http://your_domain.com. You should see the Nextcloud setup wizard. Follow these steps:

  1. Create an admin account by entering a username and password.
  2. Click on “Storage & database” to expand the options.
  3. Choose “MySQL/MariaDB” as the database.
  4. Enter the database details:
    • Database user: nextclouduser
    • Database password: the password you set earlier
    • Database name: nextcloud
    • Host: localhost
  5. Click “Finish setup” to complete the installation.

Install Nextcloud on Fedora 40

Post-Installation Configuration

After installation, it’s crucial to secure your Nextcloud instance:

  1. Enable HTTPS by obtaining an SSL certificate (Let’s Encrypt is a free option).
  2. Configure Nextcloud to use HTTPS by editing the config.php file.
  3. Set up a cron job for background tasks:
    sudo crontab -u apache -e

    Add this line:

    */5 * * * * php -f /var/www/html/nextcloud/cron.php

Troubleshooting Common Issues

If you encounter issues during or after installation, consider these common problems and solutions:

  • Permission errors: Ensure the web server has the correct permissions on the Nextcloud directory.
  • Database connection issues: Double-check your database credentials in config.php.
  • PHP module missing: Install any missing PHP modules reported in the Nextcloud admin panel.

Updating Nextcloud

Keeping Nextcloud updated is crucial for security and performance. To update:

  1. Back up your Nextcloud installation and database.
  2. Download the latest Nextcloud version.
  3. Replace the current files with the new ones.
  4. Run the update process through the web interface or command line.

Backup and Recovery

Regular backups are essential. To back up Nextcloud:

  1. Stop the web server.
  2. Back up the Nextcloud directory (/var/www/html/nextcloud).
  3. Export the Nextcloud database.
  4. Store backups in a secure, off-site location.

To restore, reverse the process: restore the files, import the database, and update the configuration if necessary.

Congratulations! You have successfully installed Nextcloud. Thanks for using this tutorial for installing the Nextcloud open-source file hosting on your Fedora 40 system. For additional or useful information, we recommend you check the official Nextcloud website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button