Personal Cloud

What Is Personal Cloud Storage?

Personal cloud storage software lets you store your files in the cloud with more control than traditional cloud storage. You generally access your personal cloud using a sync folder on your device, like you do with Google Drive or pCloud

Unlike Google Drive, though, a DIY system often requires cloud hosting. Follow our best web hosting guide to find out how to pick the best option for you.

The Best Personal Cloud Storage

  1. Nextcloud — Plans for everyone, free cloud storage, Nextcloud Hub
  2. ownCloud — Easy to use, free storage space, “delta sync” feature
  3. Seafile — Open source, easy to use, straightforward pricing
  4. Pydio —  Streamlined chat, Pydio Cells
  5. Resilio — P2P, lots of plan options

We choose nextcloud?

Nextcloud is everywhere these days. There’s a good reason for that–of all the on-premise cloud solutions on the market, the open-source Nextcloud is the easiest to install, most flexible, scales from a single user to an enterprise environment, and makes using the cloud as easy as any other tool.

What you’ll need

  • An instance of Ubuntu Server 20.04
  • A user account with sudo privileges

Note: You can install Nextcloud on distributions other than Ubuntu Server. I prefer Ubuntu because it’s one of the most widely used server platforms (it’s the most used Linux distribution on Azure) and it’s incredibly user-friendly.

How to install the necessary dependencies

The first thing to be done is the installation of the necessary dependencies. We’ll break this into two sections. Log in to your server and access a terminal window. Install the first set of dependencies with the command:

sudo apt-get install apache2 mysql-server -y

When that completes, install the second group of dependencies with the 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 -y

How to secure the MySQL database

With the dependencies out of the way, the next thing to be taken care of is securing the database server. Back at the terminal window, issue the command:

sudo mysql_secure_installation

Give MySQL a new admin password and answer the remaining questions with y (for yes).

How to create the database

Now we’ll create the Nextcloud database and a database user. Log in to the MySQL console with the command:

sudo mysql -u root -p

Create the new database with the command:

CREATE DATABASE nextcloud;

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:

FLUSH PRIVILEGES;
exit

How to download and unpack the Nextcloud file

In order to install Nextcloud, we have to first download the necessary zipped file. To do that, issue the command:

wget https://download.nextcloud.com/server/releases/nextcloud-21.0.1.zip (check for latest)

Unpack that file with the command:

unzip nextcloud-21.0.1.zip

Move the newly-created nextcloud file to the Apache document root with the command:

sudo mv nextcloud /var/www/html/

Next, we’ll give the Nextcloud folder the necessary ownership with the command:

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

How to configure the web server

With the Nextcloud directory in place, we now have to make Apache aware of it. For that, we have to create a .conf file with the command:

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

In that file, paste the following:

Alias /nextcloud "/var/www/html/nextcloud/"
<Directory /var/www/html/nextcloud/>
    Options +FollowSymlinks
    AllowOverride All
      <IfModule mod_dav.c>
        Dav off
      </IfModule>     

     SetEnv HOME /var/www/html/nextcloud
    SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>

Save and close the file. 

Enable the new site with the command:

sudo a2ensite nextcloud

We’ll now enable the necessary Apache modules by issuing the command:

sudo a2enmod rewrite headers env dir mime

Finally, we’ll change the PHP memory limit with the command:

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

Restart Apache with the command:

sudo systemctl restart apache2

How to finish the installation

Your venture into the command line is complete. Now you can open a browser and point it to http://SERVER_IP/nextcloud (where SERVER_IP is the IP address of the hosting server). You’ll first be greeted by the web-based installer

Enable PHP Opcache

One of the memory caches that NextCloud supports is PHP OPcache. For best results, any NextCloud server should have this enabled by adding the following parameters to your 10-opcache.ini file (found under your /etc/php directory such as /etc/php/7.0/fpm/conf.d/10-opcache.ini)

opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1

Enable Redis and/or APCu memory cache

NextCloud also allows you to specify a local and/or file locking cache in its config.php file. PHP APCu and Redis are both key value stores that can be used to accelerate the performance of a PHP application such as NextCloud.

If you are running on a small cloud instance (say, less than 2GB RAM), or a resource-constrained device such as Raspberry Pi, Redis can be used for both local caching and file locking.

To install Redis on Ubuntu:

apt-get install redis-server php-redis -y

Then, add the following lines to config.php if you are using a local Redis server.

'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => array(
'host' => 'localhost',
'port' => 6379,
),

If you have the memory overhead to run both PHP APCu and Redis, you would enjoy better performance by running APCu as the local cache, and Redis as the file locking cache based on a user benchmark on GitHub.

To install PHP APCu also:

apt-get install php-apcu -y

After restarting your web server, make the following changes to config.php

'memcache.local' => '\OC\Memcache\APCu',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' => array(
'host' => 'localhost',
'port' => 6379,
),

Any NextCloud installation can benefit from these simple performance tweaks. In fact, NextCloud will show a warning on the admin page if you’ve set up your instance without a memory cache. It’s in your best interest to resolve the issue before creating logins for your users, lest they run into timeouts and slow thumbnails in the UI.

About the Author

wpadmin

Leave a Reply

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