How to create your own virtual private cloud like Google Drive?

Pavithran
4 min readJul 6, 2020

Creating an own private cloud for storing the data and accessing from anywhere has become easy by using owncloud client-server software which enables the user to upload and download the data from that server. owncloud can only be hosted in Linux distributions which is the server and can be accessed from Windows, Mac, Linux, Android and iOS.

We host owncloud either in your localhost or in server. Hosting in localhost is useless. So the better way is to rent a server or buy a server. So, Here we can rent a server from popular cloud providers like Microsoft Azure or Amazon AWS. In this case, I’m going to rent a server from Azure and setting-up a ubuntu machine which is remotely accessed by SSH. First of all, we are going to install the apache2 server in our machine. Update the machine and enter the command for installing apache2 is

sudo apt-get update

sudo apt-get install apache2

After installing apache you should install MySQL and MariaDB server. the command to install is

sudo apt install mariadb-server python-pymysql

which installs MySQL and MariaDB with python support with MySQL. Change the bind-address to 0.0.0.0 in the configuration file. Then use mysql_secure_installation command to allow the remote access of the database and restart the server.

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

mysql_secure_installation

service mysql restart

We’ll move on to the owncloud installation. Follow the below commands latter comes the explanation.

cd /var/www/

sudo wget https://download.owncloud.org/community/owncloud-10.4.0.tar.bz2

sudo tar xjf /tmp/owncloud-10.4.0.tar.bz2

sudo tar xjf owncloud-10.4.0.tar.bz2

sudo apt-get install -y php php-gd php-curl php-zip php-dom php-xml php-simplexml php-mbstring php7.2-intl

chown -R www-data:www-data owncloud

chmod -R 755 owncloud

At first, we navigate to www folder located in var which is the file-hosting directory. The second command is used to download the owncloud ZIP file using wget command and we’ll unzip the zip file in the www directory. The 5th command is used to install essential PHP packages. 6th command is used to provide privileges to directory. 7th command is used to provide read and execute permission to anyone and write permission to the owner. Then we should edit the apache2 configuration file to add owncloud and the command for that is

nano /etc/apache2/sites-enabled/000-default.conf

and change the DocumentRoot from /var/www/html/ to /var/www/

Third Part is to create owncloud database. The commands are as follows

create database owncloud

GRANT ALL ON owncloud.* to ‘’@’’ IDENTIFIED BY ‘YOUR_PASSWORD’;

FLUSH PRIVILEGES;

Here we create a database named owncloud and we’re granting permission to the database to root with a password. In the field of YOUR_PASSWORD replace it with a password. Flush privileges command used to reload the grants table. Last part is to restart the apache

service apache2 restart

Then enter your server IP address in browser in this format

IP_ADDRESS/owncloud/

Taaadaaaan!!! Your own private cloud storage is created. The rest part is an easy thing is setting up username and password for owncloud.

This is what you see after entering the above address in the browser. Use your desired username and password and in place of database user use root and the password which you used above while granting permission and database name is owncloud and use your server’s IP address in place of localhost and then click on finish up and which will redirect to the login page then log in. That’s all the owncloud private cloud setup is. you can use this service anywhere and from any computer which has internet access. just IP address is enough to access. The Home page will look like

Home page of the Owncloud

If you forgot your login password you can use this command to reset

sudo -u www-data php /var/www/owncloud/occ user:resetpassword YOUR_USERNAME

In place of YOUR_USERNAME use your owncloud username. That’s it a simple easy task.

Enjoy, your own virtual private cloud service storage !!!

--

--

Pavithran

Machine learning enthusiast, App developer, web app developer.