How to install NextCloud 20 on Ubuntu 18.04/19.04/19.10/20.04
NextCloud is a Dropbox-like solution for self-hosted file sharing and syncing. Installing NextCloud 20 on Ubuntu is trivial. 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 20 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 19 on Ubuntu 18.04/19.04/19.10/20.04
- How to install NextCloud 18 on Ubuntu 16.04/18.04/19.04/19.10
- How to install NextCloud 17 on Ubuntu 16.04/18.04/18.10/19.04
- How to install NextCloud 16 on Ubuntu 16.04/18.04/18.10/19.04
- How to install NextCloud 15 on Ubuntu 16.04/17.04/17.10/18.04
- How to install NextCloud 14 on Ubuntu 16.04/17.04/17.10/18.04
- How to install NextCloud 13 on Ubuntu 16.04/17.04/17.10/18.04
- How to install NextCloud 12 on Ubuntu 16.04/16.10/17.04/17.10
- How to install NextCloud 11 on Ubuntu 16.04/16.10/17.04/17.10
Step 1: Install software
The first step in order to install NextCloud 20 is to install a web server and PHP. Although you can adapt this guide for many Ubuntu versions, the actual scenario of PHP versions and NextCloud versions has changed quite a bit. This guide will use PHP version 7.4, the latest version of PHP supported until November 2022. For older versions of Ubuntu a PPA will be added to install PHP 7.4.
You will need root access during this procedure. The following procedure will install apache as webserver. Input the commands one by one to avoid errors!
Step 2: Database selection
Now that you have set up the environment, all that is left is 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
The last step is to actually get the software, configure it and run it.
Step 4: 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 20 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 20 follow these steps:
Step 5: Install
Once you’re done with selecting the database, 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 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 click on “Storage & Database” to 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 6: 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 7: 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 8: 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.
Latest posts by mark (see all)
- 2020 A year in review for Marksei.com - 30 December 2020
- Red Hat pulls the kill switch on CentOS - 16 December 2020
- OpenZFS 2.0 released: unified ZFS for Linux and BSD - 9 December 2020