How to host your own private cloud storage like Google Drive

Hosting your own cloud storage sounds like something so hard that only hard-core tech nerds would even think about doing something like that, right? But what if we told you that it’s rather very simple to get your own personal cloud up and running with writing a single line of code?

Yep, you heard that right. Today we’ll show you how to host your own personal cloud using a very easy to use thing called Nextcloud.

What is Nextcloud?

Nextcloud is an open-source software that can be used to store files, photos, and videos for personal usage like Google Drive or Dropbox. The best thing about Nextcloud is that you can self-host it on almost any cloud provider you’d like. You can even host it locally if you have spare hardware available for the task.

How to install Nextcloud on Ubuntu 22.04 Server

Install the web and database servers:

The first thing we’ll do is install the web and database servers. Log into your Ubuntu Server instance and issue the command:

sudo apt-get install apache2 mysql-server -y

When that completes, start and enable the servers with the following commands:

sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mysql
sudo systemctl enable mysql

How to install the remaining dependencies

With the servers installed, let’s take care of the remaining dependencies. For that, issue the following command:

sudo apt-get install php zip libapache2-mod-php php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-mysql php-bcmath php-gmp zip -y

How to secure the MySQL server and create the database

We need to set a password for the MySQL admin user with the command:

sudo mysql_secure_installation

Give the MySQL admin user a strong/unique password and answer the remaining questions with y (for yes).

Next, we’ll log into the MySQL console with:

sudo mysql -u root -p

Create the new database with the command:


Create a new user with the command:

CREATE USER ‘nextcloud’@’localhost’ IDENTIFIED BY ‘PASSWORD’;

Where PASSWORD is a unique and strong password.

Give the new user the necessary permissions with the command:

GRANT ALL PRIVILEGES ON nextcloud.* TO ‘nextcloud’@’localhost’;

Flush the privileges and exit the console with the commands:


How to download and unpack the Nextcloud file

Download the latest version of Nextcloud with the command:


Unzip the downloaded file:


Move the newly created nextcloud directory to the Apache document root:

sudo mv nextcloud /var/www/html/

Give the Nextcloud folder the necessary ownership:

sudo chown -R www-data:www-data /var/www/html/nextcloud

How to configure Apache for Nextcloud

Create an Apache .conf file for Nextcloud with the command:

sudo nano /etc/apache2/sites-available/nextcloud.conf

In that file, paste the following:

Alias /nextcloud “/var/www/html/nextcloud/”

Options +FollowSymlinks
AllowOverride All

Dav off

SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud

Save and close the file.

Enable the new site with the command:

sudo a2ensite nextcloud

Enable the necessary Apache modules:

sudo a2enmod rewrite headers env dir mime

Finally, change the PHP memory limit:

sudo sed -i ‘/^memory_limit =/s/=.*/= 512M/’ /etc/php/7.4/apache2/php.ini

Note: If your version of PHP is a different release than 7.4, you’ll need to alter the above command accordingly.

Restart Apache:

sudo systemctl restart apache2

How to finish the installation

Open a web browser and point it to http://SERVER/nextcloud (where SERVER is the IP address or domain of the hosting server in your data center). In the window presented (Figure A), create an admin user and fill out the required information as such:

  • Database user: nextcloud
  • Database password: The password you created for the nextcloud database user
  • Database name: nextcloud

Click Finish Setup to complete the installation. You’ll find yourself logged in as the admin user, where you can start customizing your Nextcloud server.

Congratulations, you can now download the Nextcloud app for your Phone and PC and start backing up and storing your data on your very own personal cloud storage.

Which hosting provider is best to host your Nextcloud instance ?

There are many vps providers you can choose to host your Nextcloud instance but we would recommend going with Time4Vps Storage VPS plan. You could get 1TB of storage for about $42/year

Leave a Reply

Your email address will not be published. Required fields are marked *