How to install NextCloud 18 server on CentOS 8.x and 7.x
NextCloud is a Dropbox-like solution for self-hosted file sharing and syncing. Installing NextCloud 18 on CentOS is quite simple. Whether you want to backup, have file-syncing or just have a Google Calendar alternative, this guide is for you.
What is NextCloud? Is it like a “cloud”?
If you stumbled here by chance and don’t know what NextCloud is, here is an article explaining its principal features and advantages/disadvantages. In this other article you can find NextCloud 18 new features. To tell you the truth, NextCloud is a SaaS cloud, if you want to know more about cloud types you can read this article.
In this article we will cover the installation of the server (not the client).
What’s the newest version?
The newest version of this tutorial is the following:
Looking for an earlier version of this tutorial?
- How to install NextCloud 17 server on CentOS 8.x
- How to install NextCloud 17 server on CentOS 7.x
- How to install NextCloud 16 server on CentOS 7.x
- How to install NextCloud 15 server on CentOS 7.x
- How to install NextCloud 14 server on CentOS 7.x
- How to install NextCloud 13 server on CentOS 7.x
- How to install NextCloud 12 server on CentOS 7.x
- How to install NextCloud 11 server on CentOS 7.x
Step1: Install software
The first step in order to install NextCloud 18 is to install a web server and PHP.
Step 2: Database selection
Now that you got the software, you need to choose a database that will support the installation. You have three choices:
- SQLite: is a single-file database. It is suggested only for small installations since it will slow NextCloud down sensibly.
- MariaDB/MySQL: are popular open source databases especially amongst web developers. It is the suggested choice.
- PostgreSQL: a popular enterprise-class database. More complicated than MySQL/MariaDB.
Now, this choice won’t really alter the functionality of NextCloud (except if you use SQLite), so pick whatever you know best. If you’re unsure pick MariaDB/MySQL.
Step 3: Install NextCloud
This step involves getting the software and configure Apache to run it.
Step 4: Setting Apache and SELinux
In this step we’ll start (and enable) the webserver and we’ll set SELinux up. Now, many tutorials will tell you to disable SELinux (because it is a difficult component to manage). Instead, I suggest you to keep it on and add the rules for NextCloud:
Step 5: Configuring firewall
This step is essential when your firewall is enabled. If your firewall is enabled you won’t be able to access your NextCloud 18 instance; on the other hand if it isn’t enabled you shouldn’t have any problems and you can simply skip this step.
In order for the firewall to work, it must be enabled. This guide will not include this part. When you enable a firewall many things can go wrong, e.g. you’re using SSH, you enable the firewall and your connection is cut and can’t connect otherwise, hence you should carefully review the documentation from your distribution.
To open the ports needed by NextCloud 18 follow these steps:
Step 6: Install
Once you’re done, it’s time to install everything. Head to http://YOUR_IP_ADDRESS/nextcloud/ and you will be facing the following screen:
Select an administrator username and password. Then click on “Storage & Database“, here you can select the data folder, but if you don’t know what you’re doing it’s best if you leave it with the default value. Then select the database you chose during step 2. Fill everything and if you’ve followed all the steps correctly you should be seeing the following screen, after a short while you will be redirected to the second screen:
Step 7: Enable Caching (suggested)
NextCloud is good but it can be very slow if you don’t configure a caching solution. There are two caching solutions covered in this guide:
- PHP OPcache: a PHP inbuilt cache solution that speeds up scripts execution.
- Redis server: a fast in-memory key-value store that speeds up everything in NextCloud.
Installing and configuring Redis
Step 8: Expose NextCloud to Internet (optional)
Most people will want to access their files from whatever location they are. To do so, your newly created NextCloud instance needs to be connected to the Internet.
Given that you need to take care of port-forwarding (if you’re a home user) and domain configuration (which varies according to your provider), here you can find the instructions to create a virtual host with Apache.
Step 9: Get a free SSL certificate with Let’s Encrypt! (SUGGESTED!
Now that you have your NextCloud instance up and running you’re good to go, but beware: you’re not safe. Internet is a dangerous place for your data and you will most likely need an SSL certificate to ensure your communications are encrypted. Provided you own a domain name you can get one for free using Let’s Encrypt! No catches, free forever.