How to Install Own Cloud On an an Ubuntu 18.04 Dedicated Server or VPS
You can create your own self-hosted cloud storage services by installing the open source software – OwnCloud on your Ubuntu 18.04 server. OwnCloud provides similar functionalities like DropBox, OneDrive and Google Drive.
Having a cloud storage service is inevitable in today’s world where information is very vital in every business. You can use the cloud to create backups for your most important pieces of information. You can then restore information from your backup in case a disaster (e.g. flooding, fires, earthquakes) strikes.
Special Note: as your company and brand grow your hosting needs may change and require better scaling and redundancy. if this is your case, you should consider upgrading to cloud hosting service. Consult with HostAdvice’s Cloud hosting services reviews to find the best provider.
Offsite backups hosted on the cloud are the most effective. A regular backup performed on a nearby external hard disc or memory card is not enough because it can be damaged together with your main storage.
OwnCloud offers a great solution for protecting your data on the cloud while making collaboration easier. In this guide, we will show you how to integrate a self-hosted OwnCloud storage service on your Ubuntu 18.04 server.
- An Ubuntu 18.04 VPS
- A non-root user with sudo privileges
Step 1: Install Apache
You need to install Apache on your Ubuntu Server for OwnCloud to work, if you haven’t done so, type the command below;
$ sudo apt install apache2
Next, disable directory listing on your Apache:
$ a2dismod autoindex
Enable the following Apache modules for OwnCloud to work correctly:
$ sudo a2enmod rewrite $ sudo a2enmod headers $ sudo a2enmod env $ sudo a2enmod dir $ sudo a2enmod mime
Restart Apache for the changes to take place:
$ sudo systemctl restart apache2
Step 2: Install MariaDB Server
Then install MariaDB server by running the command below:
$ sudo apt-get install mariadb-server mariadb-client
By default, MariaDB installation is not secure; we need to run the command below to make it safe:
$ sudo mysql_secure_installation
This will allow us to;
- Set a strong password for the root user of our MariaDB,
- remove anonymous users
- disallow root login and
- remove test databases
Then login to your MariaDB server using the command below to create a database:
$ sudo mysql -u root -p
Enter your password when prompted.
Create OwnCloud database user and password by typing the commands below. Replace ‘PASSWORD’ with a strong value.
CREATE DATABASE owncloud; CREATE USER 'oc_user'@'localhost' IDENTIFIED BY 'PASSWORD'; GRANT ALL ON owncloud.* TO 'oc_user'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT;
Step 3: Install PHP
OwnCloud supports PHP 7.1 so we need to install it using the commands below:
$ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:ondrej/php $ sudo apt update $ sudo apt install php7.1
Then we need to install all the related PHP modules using the command below:
$ sudo apt-get install php7.1-cli php7.1-common php7.1-mbstring php7.1-gd php7.1-intl php7.1-xml php7.1-mysql php7.1-zip php7.1-curl php7.1-xmlrpc
The default PHP settings may limit the way OwnCloud works, so we need to adjust some default values.
Open the default ‘php.ini’ file by typing the command below:
$ sudo nano /etc/php/7.1/apache2/php.ini
Find the settings below and change their values to correspond the ones we have at the bottom:
file_uploads = On allow_url_fopen = On memory_limit = 256M upload_max_file_size = 100M
Then press CTRL+X, Y and Enter to save the changes.
$ sudo systemctl restart apache2
Step 4: Download the latest OwnCloud release
CD to the ‘tmp’ directory and download the latest release of Owncloud using the commands below:
$ cd /tmp $ wget https://download.owncloud.org/community/owncloud-10.0.3.zip
Then, unzip ‘owncloud-10.0.3.zip’ file to the current directory:
$ unzip owncloud-10.0.3.zip
Move the files to a new owncloud directory under the root folder of your website:
$ sudo mv owncloud /var/www/html/owncloud/
Step 5: Set directory and file permissions
In order for Owncloud to function correctly, we need to set the following directory permissions/ownership:
$ sudo chown -R www-data:www-data /var/www/html/owncloud/ $ sudo chmod -R 755 /var/www/html/owncloud/
Step 6: Finalize the Installation
Visit your server URL and to finalize the installation. In our case, we will visit http://ipadress/owncloud
Enter your preferred admin username and password as shown below:
Then configure the database by entering the database name, username, and password values that you created above as shown below:
Finally, click on ‘Finish Setup’ at the bottom of the screen.
You Owncloud instance is now setup and you can log in to the admin panel and start uploading files
That’s it when it comes to installing OwnCloud self-hosted service. Remember, you can create different directories/folders to organize your files better. Owncloud allows you to share files with your team especially if you are working on a project. I hope you enjoyed reading the guide.
Check out the top 3 Cloud hosting services:
- Learn more about cloud hosting and the best providers you can have
- If you want to get the best cloud hosting, click here and get the suitable one.