How to install Nextcloud on CentOS 8

How to install Nextcloud on CentOS 8

Nextcloud is open source software to create a cloud storage service like Dropbox or Google Drive but can be installed on your own server.

Nextcloud server supports a variety of major Linux distributions, such as Ubuntu, Debian, Red Hat, CentOS, SUSE, and openSUSE. Meanwhile, the Nextcloud client is available for desktop versions (Windows, macOS, Linux) and mobile versions (Android, iOS, Windows Phone).

0. System Requirements

Nextcloud server requires a system with the following specifications:

Operating System

  • Ubuntu 18.04 LTS (recommended)
  • Red Hat Enterprise Linux 8 (recommended)
  • Debian 10
  • SUSE Linux Enterprise Server 15
  • openSUSE Leap 42.1+
  • CentOS 8

Database

  • MySQL 5.7+ atau MariaDB 10.2+ (recommended)
  • Oracle Database 11g
  • PostgreSQL 9/10/11
  • SQLite (only recommended for testing)

Web Server

  • Apache 2.4 dengan mod_php atau php-fpm (recommended)
  • nginx dengan php-fpm

PHP Runtime

  • 7.2
  • 7.3 (recommended)
  • 7.4 (recommended)

Memory
The memory required depends on the number of users, apps, files and server activity.

Nextcloud requires a minimum of 128MB of RAM, a minimum of 512MB of RAM is recommended.

1. Setting up CentOS 8 Server

This tutorial uses the CentOS 8 VPS at UpCloud with 1 core CPU specs, 1GB RAM, and 25GB storage.

UpCloud Virtual Private Server
UpCloud Virtual Private Server

SSH login to server, update system.

Install langpack to resolve the error message Failed to set locale, defaulting to C.UTF-8.

Install EPEL repository.

Install the support package.

2. Connect Domain with Server

This tutorial uses the subdomain cloud.defnex.com. In the DNS manager, create a A record with hostname cloud.defnex.com and server IP address.

Defnex.com DNS Records
Defnex.com DNS Records

ping the domain to test if it is connected to the server.

3. Install Apache Web Server

Install Apache web server.

Activate and run the httpd service.

Allow http protocol in firewall

Apache virtual host

Create an Apache virtual host configuration file for the domain/subdomain.

The contents of the virtual host configuration file.

Create a document root directory.

Create a index.html file for testing virtual hosts.

Testing Apache configuration, the result is Syntax OK.

Restart httpd service.

Browse http://cloud.defnex.com.

Browse http://cloud.defnex.com
Browse http://cloud.defnex.com

4. Install SSL

Install Certbot Let’s Encrypt.

Disable virtual host default SSL configuration.

Request an SSL certificate for the subdomain cloud.defnex.com.

Enter the requested information.

SSL installed successfully.

SSL Let's Encrypt
SSL Let’s Encrypt

Allow https protocol in firewall

Browse https://cloud.defnex.com.

Browse https://cloud.defnex.com
Browse https://cloud.defnex.com

5. Install PHP

The PHP version available in the default CentOS 8 repository is PHP 7.2. To be able to run PHP 7.4 install the REMI repository.

Enable PHP 7.4 stream module.

Install PHP 7.4 along with the extensions needed by the Nextcloud server.

Activate and run the PHP-FPM service.

Restart httpd service.

Create a info.php file for PHP tests.

Browse https://cloud.defnex.com/info.php.

PHP Information
PHP Information

If PHP is running properly, delete the info.php and index.html files.

6. Install MariaDB Database

Install MariaDB database.

Activate and run the MariaDB service.

Secure MariaDB installation.

Answer the question.

Login to MariaDB.

Create a database and user for Nextcloud.

7. Install Nextcloud Server

Download Nextcloud server, extract it, and copy it to the document root directory.

Change document root ownership and permissions.

Check if SELinux is active.

If SELinux is enabled (Enforcing), restore the context document root as a web file.

Browse https://cloud.defnex.com to install Nextcloud.

Create an admin account.

Admin account
Admin account

Database configuration, click Storage & database, click MySQL/MariaDB. Enter the username, password and database.

Storage & database
Storage & database

Check Install recommended apps if you want to install Calendar, Contacts, Talk, Mail, & Collaborative editing applications.

Finally, click Finish setup.

Finish setup
Finish setup
Installing apps
Installing apps

Nextcloud has finished installing.

Nextcloud dashboard
Nextcloud dashboard

Good luck 🙂

Default image
Musa Amin
I am a Linux System Administrator and also write many tutorials about Linux, Cloud, and Open Source. Hire me via email hai[at]musaamin.web.id.

Leave a Reply