Skip to main content

[Oracle VPS] Create your own Cloud Server always free

·11 mins· 0 · 0 ·
Tuto VPS Oracle Cloud Server NextCloud Always Free
JustinType
Author
JustinType
Cybersecurity Engineer and CTF Player
Table of Contents
VPS Oracle - This article is part of a series.
Part 3: This Article

Introduction #

This article is part of a series dedicated to hosting free services for life on a private server. In this one, I’ll show you how to create your own Cloud server.

What is the Cloud? #

We often hear people talk about this term without necessarily understanding what’s behind it. It’s actually quite simple!

The Cloud is a set of IT services accessible via the Internet.

Instead of using softwares and storage on your own computer, you use the servers of other companies who own these resources.

These services are provided by specialized companies such as :

  • Amazon Web Services (AWS)
  • Google Cloud
  • Oracle Cloud Infrastructure (OCI)
  • Microsoft Azure
  • OVH

For Google Cloud, for example:

Instead of installing Word, Excel, PowerPoint and storing all your files on your computer, you use Google’s servers, where you have a certain amount of reserved storage space and where all these softwares are already installed.

In a simple sentence: “The Cloud is using someone else’s resources remotely.

matrix

The different types of Cloud #

Although the principle remains the same, there are different types of Clouds.

Public Cloud vs. Private Cloud #

A public cloud is a service offered to several customers by a single provider. Customers share the provider’s resources. Although customers only see their own data, in reality each customer’s data is stored in the same place.

All customers use the same “computer”, but each has his or her own reserved folder.

In contrast, the private cloud is a service that is not shared with any other organization. The private cloud user has the cloud to himself.

In this case, the customer uses a computer that is reserved for him but does not belong to him.

public_vs_private_clouds

Hybrid cloud vs Multi-cloud #

The hybrid cloud can be defined as an environment made up of several interconnected clouds. It can be made up of several public or private clouds, or a mixture of the two. The public cloud can be used for certain tasks, and the private cloud for others.

Often confused with the hybrid cloud, the multi-cloud relies on different cloud services from different providers.

All hybrid clouds are by definition multiclouds, even if the reverse is not always true.

multi_vs_hybride_clouds

Benefits and disadvantages #

A public cloud is generally less expensive and easier to manage, as the provider takes care of software installation, configuration and updates…

On the other hand, it can raise security concerns, because if one of the supplier’s customers is hacked and the attackers gain full access to the server, they’ll be able to steal your data since it’s all in the same place!

A public cloud saves time and money, at the cost of security.

On the other hand, a private cloud is more secure because you’re the only user of your space, but it’s generally more expensive, and you’re responsible for installing, configuring and updating the software.

A private individual simply wishing to store a few vacation photos for posting on social networks will be more than happy with a public cloud, whereas a company with sensitive data will be more likely to opt for a private cloud.

As always, it all depends on your needs! Every problem has its solution.

problem_solving

But don’t think that private clouds are just for business!

In fact, if you want to store passwords, work documents on personal projects, share private documents only with certain people, etc., then the private cloud may be of interest to you.

And that’s just what we’re going to do by creating our own private server!

Solution chosen: NextCloud #

Nextcloud is an online file storage and sharing solution that you can install on your own server.

Pros #

  • It’s open-source, meaning that its source code is publicly available. There is continuous improvement of the software, as anyone can contribute to the code.
  • It has a large community, which guarantees regular updates and extensive documentation.
  • It has numerous applications that let you turn your cloud into a password manager (like BitWarden), a music server (like Spotify), a videoconferencing server (like Teams), and many more.
  • It’s multi-platform, so it’s easy to use on Windows, MacOS, Linux, Android or iOS.
  • It’s free for life!

Cons #

  • Requires you to install and configure the application yourself.
  • 200 GB maximum free storage (limited by OCI’s “Always Free” offer)
In comparison, you get 15 GB free with Google and 5 GB with Apple.

Well, now that you know everything, let’s get started!

Cloud server creation #

You are strongly advised to read the introduction of this series, as it introduces the OCI “Always Free” offer we’ll be using. Concepts such as creating a VM, allocating its resources, accessing it, transferring files, configuring the firewall, etc., are covered.

Thumbnail Oracle Minecraft Server
→ Read the introduction of this serie

Creating an instance #

To begin with, we’ll need to create an instance on OCI.

Choose a server name, leave the default compartment and change the image:

instance1

Select the image Ubuntu 20.04 :

instance2

Choose the resources to allocate :

instance3

Be careful not to exceed your “Always Free” resources if you have other instances!

You can change the VNIC or leave the default one, then download the SSH private key:

instance4

Create a boot volume of the desired size, here I take the maximum so 200 GB :

instance5

You don’t need to change anything else, you can create the instance:

instance6

Once the instance has been created, make a note of your VM’s IP address:

instance7
Modified IP address

Connect to your VM via SSH:

ssh ubuntu@[IP_of_your_VM] -i [ssh_key]

Then perform system updates:

sudo apt update -y && sudo apt upgrade -y

Your instance is now ready, and we’re ready to install NextCloud.

Installing NextCloud #

Install the nextcloud package via snap :

sudo snap install nextcloud

Creating an administrator account #

Create a new administrator account with the following command. This account will be used to set up NextCloud:

sudo nextcloud.manual-install [account] [password]

The following message indicates that Nextcloud has been configured correctly:

Nextcloud was successfully installed

Setting the trusted domain #

During command-line installation, NextCloud limits the hostnames to which the instance will respond.

By default, NextCloud only allows localhost as trusted domain, but we won’t be able to access this domain from the outside, so we need to add the server’s IP address as trusted domain.

You can view the current settings by querying the value of the trusted_domains array:

sudo nextcloud.occ config:system:get trusted_domains

trusted_domain1

Currently, only localhost is present as a value in the table. We can add our server’s IP address by typing :

sudo nextcloud.occ config:system:set trusted_domains 1 --value=[IP_of_your_VM]
If you have a domain name, you can replace the IP address of your VM with this domain name.

trusted_domain2

If we query the trusted domains again, we see that we do indeed have the IP address of our VM :

sudo nextcloud.occ config:system:get trusted_domains

trusted_domain3

You can add other IP addresses or domains with the config:system:set command, simply increment the number → example for a second domain: sudo nextcloud.occ config:system:set trusted_domains 2 --value=second_domain.com

NextCloud configuration #

Our NextCloud server is currently set up to trust a domain name or IP address. However, no encryption process has been configured.

You know the little padlock that indicates you’re in HTTPS.

https

If we stop there, the data transmitted to your cloud server will be unencrypted on the network, and we want to avoid that!

To do this, we’re going to set up an SSL/TLS certificate.

SSL/TLS certificate with Let’s Encrypt #

This solution is intended for people with a domain name, if this is not your case, follow the instructions for the self-signed certificate.

If you have a domain name associated with your NextCloud server, the best option for securing your web interface is to obtain a Let’s Encrypt certificate.

Let’s Encrypt is a free, automated certification authority provided by the public utility Internet Security Research Group (ISRG).

Request a Let’s Encrypt certificate by typing :

sudo nextcloud.enable-https lets-encrypt

You will first be asked whether your server meets the requirements for requesting a certificate from the Let’s Encrypt service:

In order for Let's Encrypt to verify that you actually own the
domain(s) for which you're requesting a certificate, there are a
number of requirements of which you need to be aware:

1. In order to register with the Let's Encrypt ACME server, you must
   agree to the currently-in-effect Subscriber Agreement located
   here:

       https://letsencrypt.org/repository/

   By continuing to use this tool you agree to these terms. Please
   cancel now if otherwise.

2. You must have the domain name(s) for which you want certificates
   pointing at the external IP address of this machine.

3. Both ports 80 and 443 on the external IP address of this machine
   must point to this machine (e.g. port forwarding might need to be
   setup on your router).

Have you met these requirements? (y/n)

→ Type y to continue.

Next, you will be asked to provide an e-mail address to be used for recovery operations:

Please enter an email address (for urgent notices or key recovery):

→ Enter your e-mail address and press Enter to continue.

Finally, enter the domain name associated with your NextCloud server:

Please enter your domain name(s) (space-separated): example.com

Your Let’s Encrypt certificate will be requested and, if all goes well, the internal Apache instance will be restarted to immediately implement SSL :

Attempting to obtain certificates... done
Restarting apache... done

You can now proceed to the NextCloud firewall configuration step.

Self-signed SSL/TLS certificate #

If you have no domain name, you can still set up encryption on your Nextcloud server by generating a self-signed SSL/TLS certificate. This certificate will enable access to the web interface via an encrypted connection.

Your browser will probably display a warning when you try to connect to the web interface. This is normal, as it cannot verify the identity of your server.

To generate a self-signed certificate and use it on your Nextcloud server, type:

sudo nextcloud.enable-https self-signed

self_signed

The output above indicates that NextCloud has generated and activated a self-signed certificate.

You can now proceed to the NextCloud firewall configuration step.

Firewall configuration #

The basic Ubuntu OCI image is set up with iptables, blocking access to ports 80 and 443 (ports used by HTTP and HTTPS protocols).

We’re going to replace this setting with the ufw firewall and open these ports.

First, run the following commands:

sudo iptables -P INPUT ACCEPT
sudo iptables -P OUTPUT ACCEPT
sudo iptables -P FORWARD ACCEPT
sudo iptables -F

Then authorize the ufw firewall with the command:

sudo ufw enable

You can check whether ufw is active with the command:

sudo ufw status

Finally, enable the SSH protocol as well as ports 80 and 443:

sudo ufw allow ssh
sudo ufw allow 443/tcp
sudo ufw allow 80/tcp

You can check the firewall rules with the command:

sudo ufw status numbered

firewall1

All you have to do is open these ports on the OCI VNIC:

firewall2

→ Your Nexcloud server is ready to use!

Using NextCloud #

Go to the url https://[IP_of_your_VM] and log in with the administrator account you created earlier:

utilisation1

For each new user, NextCloud creates “template” files. These are used to give examples of use, but you can delete them at any time.

Check storage space #

Go to “Administration settings > System” to check the available storage space on your server:

utilisation2

utilisation3

Create users #

Go to the “Users” tab:

utilisation4

Then click on “New account” and fill in the information for the new account:

utilisation5

You can choose the storage reserved for this user.

This user can now connect and store files on your NextCloud server:

utilisation6

utilisation7

You can share access with your friends or family, while fine-tuning the settings for each person. For example, you can allow only photos or videos to be stored, or specify the amount of storage space reserved for each person.

For more information: NextCloud documentation

Access your server from your smartphone #

You can access your NextCloud server from any browser via the url https://[IP_of_your_VM] or you can install the NextCloud mobile app on your smartphone.

All you need to do is enter your server’s URL:

smartphone1

Then log in to access all your files:

smartphone2

Applications #

You can also install applications from the “Applications” tab:

apps1

apps2

NextCloud has many community-written applications, here are just a few examples:

  • Audio Player → for storing and playing music (like Spotify)
  • Only Office → to edit word, excel, powerpoint files simultaneously (like Google Drive)
  • Passwords → to store and manage your passwords (like BitWarden)
  • Talk → to make audio and video calls (like Teams)
  • Calendar → manage your calendars (like Google Calendar or Outlook)
  • Notes → to manage your online notes with markdown language (like Notion)
You can find all the available applications here: NextCloud App Store

Conclusion #

In this article, I’ve shown you how to create your own free Cloud server for life with the NextCloud solution, using Oracle Cloud Infrastructure’s “Always Free” offering.

The aim was to provide you with a practical, free solution while familiarizing you with the field of cloud and IT security.

After reading this article, you’ll now know :

  • What a Cloud is
  • What the different types of Cloud are
  • How to create your own free Cloud for life

I hope you’ve enjoyed reading the article, and if you have, please feel free to like it and share it with any friends or colleagues who might be interested!

VPS Oracle - This article is part of a series.
Part 3: This Article