ownCloud is an open-source, self-hosted file sync and file share platform similar to Dropbox, OneDrive, and other proprietary online storage services. ownCloud enables private cloud services on users’ servers. It is extensible via its app and can be installed on mobile and desktops to access & sync your files, contacts, and data across all devices and platforms. If you’re looking for a self-hosted file share and sync platform, then ownCloud should be a good place to start. We’ll show you how to install and configure ownCloud on your own Ubuntu server with a link to the Let’s Encrypt SSL post. Also, for students and new users learning Linux, the easiest place to start learning is Ubuntu Linux. Ubuntu is the modern, open-source Linux operating system for desktops, servers and other devices. To get started with installing and configuring ownCloud on Ubuntu Linux, follow the steps below.

How to install Nginx on Ubuntu Linux

As mentioned above, we’re going to be using the Nginx web server to run ownCloud. ownCloud requires a web server to function, and Nginx is the most popular open-source web server available today. To install Nginx on Ubuntu, run the commands below: After installing Nginx, the commands below can be used to stop, start and enable Nginx services always to start up every time your server starts up. To test whether Nginx is installed and functioning, open your web browser and browse to the server’s IP address or hostname. http://localhost If you see the above page in your browser, then Nginx is working as expected.

How to install MariaDB on Ubuntu Linux

A database server is required for ownCloud to function. ownCloud stores its content in a database, and MariaDB is probably the best database server available to run ownCloud. MariaDB is fast, secure and the default server for almost all Linux servers. To install MariaDB, run the commands below: After installing MariaDB, the commands below can be used to stop, start and enable MariaDB services always to start up when the server boots. Next, run the commands below to secure the database server with a root password if you were not prompted to do so during the installation. When prompted, use the guide below to answer: To verify and validate that MariaDB is installed and working, log in to the database console using the commands below: You should automatically be logged in to the database server since we initiated the login request as root. Only the root can log in without password, and only from the server console. If you see a similar screen as shown above, then the server was successfully installed.

How to install PHP on Ubuntu Linux

Also, PHP is required to run ownCloud. PHP packages are added to Ubuntu repositories. The versions of the repositories might not be the latest. If you need to install the latest versions, you’ll need to add a third-party PPA repository. To a third-party repository with the latest versions of PHP, run the commands below. At the time of this writing, the latest PHP version is 8.0. Next, run the commands below to install PHP 8.0 and related modules. Next, you’ll want to change some PHP configuration settings that work great with ownCloud. Run the commands below to open the PHP default configuration file. Then change the line settings to be something like the lines below. Save your changes and exit.

How to create ownCloud database on Ubuntu

At this point, we’re ready to create our ownCloud database. As mentioned above, ownCloud uses databases to store its content. To create a database for ownCloud, run the commands below: Then create a database called owncloud Next, create a database user called ownclouduser and set a password Then grant the user full access to the database. Finally, save your changes and exit.

How to download ownCloud on Ubuntu

We’re ready to download ownCloud and begin configuring it. First, run the commands below to download the latest version of ownCloud from its repository. Next, extract the downloaded content into the Nginx root directory. This will create a folder called owncloud. Then run the command below to allow the www-data user to own the new owncloud directory.

How to configure Nginx for ownCloud

We have downloaded ownCloud content into a new folder we called ownCloud. Now, let’s configure Nginx to create a new server block to use with our ownCloud website. You can create as many server blocks with Nginx. To do that, run the commands below to create a new configuration file called owncloud.conf in the /etc/nginx/sites-available/ directory to host our ownCloud server block. In the file, copy and paste the content below into the file and save. Save the file and exit. After saving the file above, run the commands below to enable the new file that contains our ownCloud server block, as well as other important Nginx modules. Restart Nginx after that. Reload Nginx when done the configuration above. Now that ownCloud is downloaded, and the necessary services are configured open your browser and start the ownCloud installation by visiting your server’s domain name or IP address followed by /owncloud : However, we want to make sure our server is protected with Let’s Encrypt free SSL certificates. So, continue below to learn how to generate a Let’s Encrypt SSL certificate for websites.

How to setup Let’s Encrypt for ownCloud

We have written a great post on how to generate and manage Let’s Encrypt SSL certificates for the Nginx web server. You can use that post, to apply it here for your ownCloud website. To read the post on how to generate Let’s Encrypt SSL certificates for a website, click on the link below: How to Setup Let’s Encrypt on Ubuntu Linux with Nginx If you were successful in generating a Let’s Encrypt SSL certificate, you should then reopen the server block for our ownCloud website by running the commands below. The new ownCloud server block configurations should look similar to the line below. Take notes of the highlighted lines.

The first server block listens on port 80.  It contains a 301 redirect to redirect HTTP to HTTPS. The second server block listens on port 443. It contains a 301 redirect to redirect www to the non-www domain.

Save the file above, then restart Nginx and PHP using the commands below. Finally, if everything went as planned, you should be able to start the ownCloud setup wizard by browsing to the server hostname or IP address over HTTPS. An ownCloud setup wizard should appear. Follow the wizard to complete the setup.

Create an admin account and password leave Data folder default Select MySQL/MariaDB Enter the database username Enter the database user password Enter the database name Leave database host as local host if ownCloud and database server are on the same host.

Click Finish setup Wait for the setup to complete. Then log in and begin configuring your environment. That should do it! Conclusion: This post showed you how to set up ownCloud on Ubuntu Linux with Nginx and Let’s Encrypt. If you find any error above or have something to add, please use the comment form below.