How to Install Nextcloud On Ubuntu 18.04 Bionic Beaver Linux


Install Nextcloud on Ubuntu 18.04


Ubuntu 18.04


A working install of Ubuntu 18.04 with root privileges




  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user


When it comes to self hosted cloud storage Nextcloud is definitely the best option. It’s fully open source, and allows you full control over your server. You can, of course, create your own user accounts and manage access too.

There are a couple of options when it comes to setting up Nextcloud on Ubuntu. You can use Docker or you can follow the traditional install method. Either one will work. The Docker method will probably work better if you don’t want to configure and manage the entire server yourself.


If you don’t already have Docker installed, follow our Docker guide to get up and running.

Once you have Docker, it’s really easy to get set up. Just run the command below to pull and spin up your Nextcloud server.

$ sudo docker run -d nextcloud:fpm

If you need to specify different HTTP ports, you can certainly do so.


The traditional install is much longer than the Docker one, but it gives you more control over your server and paces it directly on top of Ubuntu. Nextcloud is a PHP application, so you’re going to have to integrate it into a LAMP or LEMP setup.

Install The PHP Packages

Before you get started, install the required packages. There are a lot more PHP packages than you’d need for a regular LAMP or LEMP, so install these separately first.

$ sudo apt install php-xml php-cgi php-cli php-mysql php-mbstring php-gd php-curl php-zip


Next, you’re going to need to set up a LAMP or LEMP server. The difference between the two being Apache(LAMP) and Nginx(LEMP). The choice is entirely yours, but Nginx does tend to perform better.

For LAMP, check out either our MySQL or MariaDB guide to get set up.

For LEMP, you can check out our guide for that too.

Get Nextcloud

Nextcloud is an open source project, and you can pick it up directly from the project’s website. You can head over to the download page to get the latest version, or if you’re lazy, use wget.

$ cd Downloads
$ wget

Unzip Nextcloud, and copy/move the resulting file into your web root or whichever directory you configured your web server to serve it out of.

$ unzip
$ sudo cp -r ~/Downloads/nextcloud /var/www/

Change the ownership of the directory to match your web server. The default is www-data.

$ sudo chown -R www-data:www-data /var/www/nextcloud

Install Nextcloud

Nextcloud has its own installer setup process. This process helps configure Nextcloud and place everything that you need where it should go within your web root directory.

Ubuntu Bionic Nextcloud Create Admin

Open up your browser and navigate to the address that you chose to host it at. You’ll see a screen asking you to create an admin user account.

Ubuntu Bionic Nextcloud Database Setup

Click on “Storage & database”, you’ll see options for connecting to your database. Nextcloud can connect to multiple types of databases, but you set up MySQL/MariaDB, so select that one. Enter the database username and password that you set up. Leave localhost as it is.

Submit the form, and Nextcloud will set itself up. When it’s finished, it’ll display the dummy files that it created in its default directories.

You can now create your own users and directories. Of course, you can use the web interface to upload your files now too.

Closing Thoughts

There’s a whole lot that you can do with Nextcloud, including using some of the native apps and frontends to manage your files.

If you’re hosting on the actual Internet, you should consider using a SSL certificate to encrypt traffic to and from your server. We have a LetsEncrypt guide for Debian that should apply equally for Ubuntu.