ObjectiveInstall Nextcloud on Ubuntu 18.04
RequirementsA 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
- $ - requires given linux commands to be executed as a regular non-privileged user
IntroductionWhen 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.
DockerIf 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:fpmIf you need to specify different HTTP ports, you can certainly do so.
TraditionalThe 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 PackagesBefore 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
Set Up LAMP or LEMPNext, 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 NextcloudNextcloud 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
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.
$ cd Downloads $ wget https://download.nextcloud.com/server/releases/nextcloud-13.0.2.zip
Change the ownership of the directory to match your web server. The default is
$ unzip nextcloud-13.0.2.zip $ sudo cp -r ~/Downloads/nextcloud /var/www/
$ sudo chown -R www-data:www-data /var/www/nextcloud
Install NextcloudNextcloud 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.
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.
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
localhostas 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.