Solutons Lounge

How to Deploy the Nextcloud Cloud Server on AlmaLinux


Cloud services are all over the place. For most people, the usual options (such as Google, iCloud, etc.) are fine. For others who demand more security and control, there are additional options, such as Nextcloud.

Nextcloud is an open source platform that includes all the features you’ve grown accustomed to (such as files, editors, chat, version control and much more) and can be deployed to hardware on your network. Because of that, you don’t have to worry about third parties having access to your data. That’s a win for any security/privacy-minded individuals or companies.

I want to show you how to deploy Nextcloud to the open source AlmaLinux operating system. Unlike deploying to Ubuntu Server, there are a few more steps required, which can often trip people up.

Let me help you avoid those pitfalls.

Ready?

What You’ll Need

The only things you’ll need for this basic installment are a running instance of AlmaLinux 9 and a user with sudo privileges. Of course, if you want to point a domain name to the instance, you’ll need an FQDN and secure it with SSL. Since I’m only deploying this to an internal network, I’m not going to worry about those things at the moment.

With those things at the ready, let’s install them.

Installing the Requirements

There are a few dependencies we have to take care of.

Apache

The first thing we’ll do is install the Apache web server. Log into AlmaLinux and issue the command:

When the installation is completed, start and enable Apache with:

After you take care of this, you’ll need to open the firewall with the following two commands:

PHP

Next, we’ll install the necessary PHP release. First, enable the EPEL release with:

Install the REMI repository (which will get us access to PHP 8.1) with:

Reset the current PHP config with:

Enable REMI repository module with:

Install all of the necessary PHP software with the following command:

Configure PHP

We now need to configure PHP. Open the configuration file with:

You’ll need to locate and make sure to set the following:

Where YOUR_TIMEZONE is the timezone in which your server is located.

You can make a short-shrift of locating the above entries by using the nano search tool (which is called up with the Ctrl+w keyboard shortcut).

Save and close the file.

Next, open the PHP OPCache configuration file with:

In this file, you want to make sure to uncomment and change (if necessary) the following lines:

Save and close the file.

Restart Apache and PHP with the following:

Install the Database

The next step is the installation of the MariaDB database. To do that, we must create a repository file with the command:

In that file, paste the following:

Save and close the file.

Install MariaDB with:

Start and enable the database with:

Secure the database installation with the command:

Hit Enter when prompted for the admin password, type n for unix_socket, type and verify a new admin password, and answer y to the remaining questions.

With the MariaDB installed, it’s time to create our database. Access the MariaDB console with:

Create the database with:

Create a new database user with:

Where PASSWORD is a strong and unique password.

Grant the required permissions with:

Flush the privileges and exit the console with:

Download Nextcloud

Before you download Nextcloud, you’ll need to install a few more bits with:

Change into the Apache document root with:

Download the Nextcloud source with:

Unzip the file with:

Give the newly-created Nextcloud directory the required ownership with:

SELinux

Unless we configure SELinux properly, Nextcloud will not function. The first thing to do is to properly label all of the Nextcloud files and folders with the following commands:

Next, you must allow the webserver to connect to the network with the following commands:

We have to create a new policy module to ensure PHP-FPM can connect to the MariaDB socket. First, create a new file with the command:

Paste the following into that file:

Save and close the file.

Convert the file to an SELinux policy module with the command:

Compile the policy with:

Apply the new policy module with:

Virtual Host

We now have to create a virtual host file with the command:

In that file, paste the following, making sure to edit as needed for your situation:

Save and close the file.

Restart Apache with:

Finishing Up the Installation

You should now be able to point a web browser to http://SERVER (where SERVER is the IP address of the hosting server) and be greeted by the Nextcloud web-based installer, where you can create an admin user and finish up the process with a few clicks.

If you find there’s an error connecting to the database and writing to the data directory, temporarily disable SELinux (until the next reboot) with:

After the installation completes, reboot the machine and SELinux is back to keeping tabs on the system and Nextcloud is up and running.

And that, my friends, is how you deploy Nextcloud to AlmaLinux.

YOUTUBE.COM/THENEWSTACK

Tech moves fast, don’t miss an episode. Subscribe to our YouTube
channel to stream all our podcasts, interviews, demos, and more.


Group Created with Sketch.



Source link

Exit mobile version