NEXTCLOUD on ORACLE CLOUD + CLOUDFLARE TUNNEL

These days, it’s hard to imagine life without the convenience of the cloud. Many of us rely on cloud storage services to store our photos, important documents, emails and other important files. However, with the increasing reliance on these services, there is also an increase in abuses of cloud systems. From privacy breaches to security breaches, cloud services can be vulnerable to all sorts of risks.

Fortunately, there is an alternative that can help minimize these risks: the self-host cloud, such as Nextcloud. Instead of relying on third parties to store your data, the self-host cloud allows you to host your own files and data on a private server that you control. With this, you can ensure the privacy and security of your data, as well as have full control over what is stored and who can access it.

Hosting Nextcloud on a VPS (Virtual Private Server) in the cloud can offer several advantages in terms of performance, scalability and ease of use. And hosting on a trusted provider like Oracle Cloud can ensure even more security and reliability.

Here are some advantages of hosting Nextcloud on a VPS on Oracle Cloud:

  1. Scalability: With a VPS, you can increase or decrease storage capacity and processing power, according to the needs of your business. With Oracle Cloud, you can easily scale your VPS to meet your needs in real time, with no disruption or downtime.
  2. Performance: By hosting Nextcloud on a VPS, you can ensure consistent and fast performance for users, regardless of location or number of users accessing the platform. Oracle Cloud delivers fast, reliable network performance, ensuring your VPS runs smoothly and without interruption.
  3. Security: Oracle Cloud is a trusted cloud service provider with multiple security features to protect your data and ensure the privacy of your users. This includes firewall, real-time security monitoring, encryption of data at rest and in transit, user authentication, and more.
  4. Easy management: Hosting Nextcloud on a VPS in the Oracle Cloud also means you can have a simplified management solution. You can easily manage your VPS through an intuitive control panel, install updates and packages with just a few clicks, and have access to reliable technical support.

In summary, hosting Nextcloud on a VPS in the Oracle Cloud can offer several advantages in terms of scalability, performance, security, and management. If you’re looking for a reliable and scalable cloud storage solution, considering hosting Nextcloud on Oracle Cloud can be a great option.

To install Nextcloud on a VPS on Oracle Cloud, there are a few necessary items that you should keep in mind:

  1. Linux system: Nextcloud is compatible with multiple operating systems, but we recommend using a Linux distribution such as Ubuntu, CentOS, or Debian.
  2. Docker: Docker is a container platform that makes it easy to build, deploy, and run containerized applications. It is recommended that you install Docker on your VPS before installing Nextcloud.
  3. Portainer: Portainer is an easy-to-use container management platform that allows you to easily manage your Docker containers. It also allows you to monitor the performance and resource utilization of containers. It is recommended that you install Portainer on your VPS before installing Nextcloud.
  4. Nextcloud: After installing Docker and Portainer, you can install Nextcloud as a Docker container on Portainer. Nextcloud is an open source cloud storage software, which offers features such as file storage, file sharing, and real-time collaboration.
  5. Cloudflare Tunnel: Cloudflare Tunnel is a tool that allows you to expose a web server to the Internet securely. It offers an easy way to secure your applications and cloud services and increase your security. It is recommended that you install Cloudflare Tunnel to ensure the security of your connections.

Once you have installed these items, you can install Nextcloud on your VPS and start using it to store your files in the cloud. With Cloudflare Tunnel, you can ensure that your connections are secure and protected from external threats.

To do this installation, we must follow the following steps. after accessing your instance through SSH.

1.0 Update the system.

To update our system, we must use the following command:

sudo apt-get update

2.0 Install all Packages for HTTPS:

In this next step we will install all the applications that will allow the use of the HTTPS repository:

sudo apt-get install \
ca-certificates \
curl \
gnupg

3.0 Add the Docker GPG key.

These steps are used to install Docker on Ubuntu and add the Docker repository signing key to the system

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

4.0 Configure the repository:

This step in a Linux script is adding a new software source to your operating system’s software repository list file.

echo \
“deb [arch=”$(dpkg –print-architecture)” signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
“$(. /etc/os-release && echo “$VERSION_CODENAME”)” stable” | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

5.0 Installing Docker

This step is a command to install Docker on a Linux system

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

6.0 Instale o Docker Engine, containerd e Docker Compose.

This step is a command line in Linux terminal that installs Docker CE (Community Edition), Docker CLI (Command Line Interface), containerd.io (runtime container) and the docker-buildx and docker-compose plugins on your system .

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

7.0 Install Portainer

These two command lines are used to create a Docker volume for Portainer and then run a Portainer container using that volume.

The first line creates a Docker volume called “portainer”, which will be used to store Portainer’s persistent data, such as configurations, logs and metadata. The “docker volume create” command creates a volume in Docker so that it can be used by running containers.

The second line runs a Portainer Docker container, which is a GUI-based Docker container manager. It runs in the background (-d) and is accessible through port 9000 (-p 9000:9000) on the host. The container name is set to “portainer” (–name portainer) and is configured to automatically restart on failure (–restart always).

sudo docker volume create portainer
sudo docker run -d -p 9000:9000 –name portainer –restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer:/data portainer/portainer-ce:latest -H unix:///var/run/docker.sock

8.0 Instale o Nextcloud utilizando o Portainer

After installing Portainer on your VPS, it is recommended that you create a user to access the Portainer GUI. This is necessary to ensure security and access control to your Docker containers.

To create a user in Portainer, just follow these steps:

Access your VPS IP address on port 9000 in the browser. This will open the Portainer interface.

Click on “Create User” in the upper right corner of the screen.

Fill in user information such as first name, last name, email and password. Make sure you use a strong and secure password.

Click “Create User” to save user information.

After creating a user, you can access the Portainer GUI using that user’s credentials.

Now, to deploy Nextcloud on Portainer, you can create a stack using the command below:


version: “2”
services:
app:
depends_on:
– db
environment:
– MYSQL_PASSWORD=nextcloud
– MYSQL_DATABASE=nextcloud
– MYSQL_USER=nextcloud
– MYSQL_HOST=db
image: nextcloud
links:
– db
ports:
– “8080:80”
restart: always
volumes:
– “/mnt/docker/nextcloud/nextcloud:/var/www/html”
– “/mnt/docker/nextcloud/apps:/var/www/html/custom_apps”
– “/mnt/docker/nextcloud/config:/var/www/html/config”
– “/mnt/docker/nextcloud/data:/var/www/html/data”
– “/mnt/docker/nextcloud/theme:/var/www/html/themes/<YOUR_CUSTOM_THEME>”
db:
command: “–transaction-isolation=READ-COMMITTED –binlog-format=ROW”
environment:
– MYSQL_ROOT_PASSWORD=nextcloud
– MYSQL_PASSWORD=nextcloud
– MYSQL_DATABASE=nextcloud
– MYSQL_USER=nextcloud
image: “mariadb:10.6”
restart: always
volumes:
– “/mnt/docker/nextcloud/db:/var/lib/mysql”

This Docker compose file creates a Nextcloud container and a MariaDB container (to store the Nextcloud data) and configures them to work together.

To deploy this stack, simply go to the Portainer interface, click on “Stacks” in the left panel, then click on “Add stack” and paste the Docker YAML compose file into the stack creation window. After saving and deploying the stack, Nextcloud should be accessible on your VPS IP address using the default Nextcloud login credentials.

9.0 Instale o Cloudflare Tunnel

To access your Nextcloud without opening any ports on your VPS, one option is to use Cloudflare Tunnel. It allows you to expose a secure connection between Cloudflare’s cloud and your VPS, without having to open ports on your firewall. Thus, you can access your Nextcloud as if you were connected directly to your VPS, without opening ports in the firewall, which improves security.

To use Cloudflare Tunnel, follow these steps:

  1. Install the Cloudflare CLI on your local machine. You can find more information on how to do this in Cloudflare’s official documentation.
  2. Create a configuration file for Cloudflare Tunnel. The configuration file should contain the information you need to connect your VPS to the Cloudflare cloud. You’ll need to define the subdomain you want to use for your Nextcloud, the IP address of your VPS, and the name of the service you’re running (e.g. Nextcloud).
  3. Launch Cloudflare Tunnel on your VPS by running the cloudflared tunnel run command. This command will start the tunnel with the settings configured in the configuration file.
  4. You can now access your Nextcloud through the subdomain you set up, such as https://seusubdominio.cloudflaretunnel.com. Traffic will be routed through Cloudflare Tunnel to your VPS in a secure and encrypted manner.

By using Cloudflare Tunnel, you can protect your Nextcloud and VPS while maintaining secure access without exposing the ports to the Internet. In addition, the connection is encrypted and secured by Cloudflare’s security system, which increases the security of your Nextcloud instance.

 

1 thought on “NEXTCLOUD on ORACLE CLOUD + CLOUDFLARE TUNNEL”

  1. Stuck on Step 7:
    ubuntu@pop:/home/test# sudo docker run -d -p 9000:9000 –name portainer –restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer:/data portainer/portainer-ce:latest -H unix:///var/run/docker.sock
    docker: invalid reference format.
    See ‘docker run –help’.

    Need help

    Server Details: ARM on Oracle

Leave a Comment

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