Jack Wallen walks you through the process of installing the latest ownCloud server release onto the latest iteration of Ubuntu Server.

Of late, nextCloud has been given the majority of the spotlight for on-premises cloud servers. However, I want to take a moment to walk you through the installation of the server that started it all. ownCloud is an equally capable cloud server that can meet and exceed your company needs. But installing this platform on the latest release of Ubuntu is a bit different than previous incarnations. So, let's see what happens when we undertake the process of installing the latest version of ownCloud onto the latest version of Ubuntu Server. The process isn't terribly challenging, at least not when you know what dependencies to install.
Let's get busy.
What you'll need
Obviously, you'll need a working instance of Ubuntu Server 18.04. I will assume you have that up and running. I will also assume you installed Ubuntu Server with the standard LAMP package offering--so Apache, MySQL, and PHP will already be up and running. One of the biggest differences between installing ownCloud on Ubuntu 16.04 and 18.04 will be the PHP packages. I'll show you how to get around that hurdle.
You will also need to download the latest version of ownCloud. This can be done with the command wget URL (where URL for the latest downloadable package can be found here). So for version 10.0.8, you'd issue the command:
wget https://download.owncloud.org/community/owncloud-10.0.8.zip
Installing dependencies
The first thing you must do is install the necessary PHP dependencies. As I said before, this can be tricky. You first need to find out what version of PHP is installed on your machine. To do this, issue the command php -v. On my installation of Ubuntu 18.04, the PHP release is PHP 7.2-7-1. The important part is the 7.2. So we need to make sure all of our PHP modules are of the 7.2 flavor. For this, we'll issue the command:
sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-apcu php7.2-smbclient php7.2-ldap php7.2-redis php7.2-gd php7.2-xml php7.2-intl php7.2-json php7.2-imagick php7.2-mysql php7.2-cli php7.2-mcrypt php7.2-ldap php7.2-zip php7.2-curl
You may find that some of the above modules cannot be installed. To get around that, simply delete those modules from the above command. For my installation, I had to remove:
- php7.2-redis
- php7.2-imagick
- php7.2-mcrypt
- php7.2-smbclient
Once those were out of the command line mix, the installation went fine. Just make sure to pay attention to the output of your command and then adjust accordingly.
SEE: Google Cloud Platform: An insider's guide (free PDF) (TechRepublic)
Configure PHP
Now we need to configure PHP. There are only two options you need to deal with. Issue the command sudo nano /etc/php/7.2/apache2/php.ini and then adjust the following parameters:
- memory_limit =
- date.timezone =
The memory_limit option should be no less than 256M and the date.timezone should be set to your location. To find out what timezone you should use (and the format of said timezone), take a look at this site.
Save and close that file. Restart Apache with the command:
sudo systemctl restart apache2
Create the database
Now we need to create the database. To do this, issue the command:
sudo mysql -u root -p
You'll be prompted first for your sudo password and then the MySQL root user password. I add sudo to this command on the off-chance you are using MariaDB (instead of MySQL). Once in the database command prompt, create the database with the command:
CREATE DATABASE owncloud;
Next create a new database user with the command:
CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'PASSWORD';
Where PASSWORD is a strong password for the user.
Give the new user permissions for the new database with the command:
GRANT ALL ON owncloud.* TO 'ownclouduser'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;
Where PASSWORD is a strong password for the user.
Flush the privileges and exit the database shell with the commands:
FLUSH PRIVILEGES; EXIT;
Unpack and move the ownCloud file
Now we need to unpack and move the ownCloud file and then give it the proper permissions. I'm going to assume you downloaded the file to your home directory. With that in mind, everything can be done with the following commands:
cd ~/ unzip unzip owncloud-*.zip sudo mv owncloud /var/www/html/ sudo chown -R www-data:www-data /var/www/html/owncloud/ sudo chmod -R 755 /var/www/html/owncloud/
Configure Apache
We now must configure Apache so that it is aware of our new ownCloud site. Create a new conf file with the command:
sudo nano /etc/apache2/sites-available/owncloud.conf
The contents of that file should be:
<VirtualHost *:80> ServerAdmin admin@example.com DocumentRoot /var/www/html/owncloud/ ServerName example.com ServerAlias www.example.com Alias /owncloud "/var/www/html/owncloud/" <Directory /var/www/html/owncloud/> Options +FollowSymlinks AllowOverride All Require all granted <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/html/owncloud SetEnv HTTP_HOME /var/www/html/owncloud </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Where you see example.com and www.example.com, if you don't need domains (and will be using ownCloud by IP address only), you can comment out these lines.
Save and close that file.
Now we need to enable the site and the necessary modules. These steps are handled with the following commands:
sudo a2ensite owncloud.conf sudo a2enmod rewrite sudo a2enmod headers sudo a2enmod env sudo a2enmod dir sudo a2enmod mime
NOTE: Some of the above modules may already be enabled.
Restart Apache with the command:
sudo systemctl restart apache2
The final step
At this point, open up a browser and point it to http://SERVER_IP/owncloud. You should be greeted by the ownCloud installer (Figure A), where you only need to create an admin user and enter the information for the database.
Figure A
The browser installer is the last step.
Click Finish setup and ownCloud will take care of everything. You will eventually be prompted to log in with the admin user you just created. Congratulations, you now have a working ownCloud, on-premises cloud server. You can now configure it to meet (and exceed) your company needs.
Also see
- How to install nextCloud 13 on Ubuntu 18.04 (TechRepublic)
- Nextcloud 13 adds end-to-end encryption and Slack competitor Nextcloud Talk (TechRepublic)
- How to install Nextcloud Talk for private communication on your cloud server (TechRepublic)
- How to install Ubuntu Server 18.04 (TechRepublic)
- Open source's big German win: 300,000 users shift to Nextcloud for file sharing (ZDNet)