Atlantic.Net Blog

How to Install Nextcloud on Rocky Linux 8

Hitesh Jethva
by Atlantic.Net (345 posts) under Dedicated Server Hosting, Tutorials
0 Comments

Nextcloud is an enterprise-ready suite of client-server software built to help users create, host, and share files. Nextcloud is a free and open-source file hosting service, making it an excellent choice for home users, with scalability to enterprise-level deployments.

In this post, we will show you how to install Nextcloud on Rocky Linux 8.

Prerequisites

  • A server running RockyLinux 8 on the Atlantic.Net Cloud Platform
  • A root password is configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Rocky Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your server, run the following command to update your base system with the latest available packages.

dnf update -y

Step 2 – Install LAMP Stack

Before starting, a LAMP stack must be installed on your server. You can install it using the following command:

dnf install httpd mariadb-server php php-curl php-gd php-intl php-json php-ldap php-mbstring php-mysqlnd php-xml php-zip php-opcache unzip curl -y

After the successful installation, start the Apache and MariaDB services and enable them to start after system reboot:

systemctl start httpd
systemctl enable httpd
systemctl start mariadb
systemctl enable mariadb

Step 3 – Create a Database and User for NextCloud

First, secure the MariaDB installation and set the MariaDB root password using the following command:

mysql_secure_installation

Answer all the questions as shown below:

Enter current password for root (enter for none): 
Set root password? [Y/n] Y
New password: 
Re-enter new password: 
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Next, log in to MariaDB using the following command:

Nextcloud uses MariaDB or MySQL as a database backend. First, log in to MariaDB with the following command:

mysql -u root -p

Once you are logged in, create a database and user with the following command:

CREATE DATABASE nextcloud;
CREATE USER 'nextcloud'@'%' IDENTIFIED BY 'password';

Next, grant all the privileges to the Nextcloud database using the following command:

GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'%';

Next, flush the privileges and exit from the MariaDB shell using the command below:

FLUSH PRIVILEGES;
EXIT;

Step 4 – Install NextCloud

At the time of writing this tutorial, the latest version of Nextcloud is 21. You can download it using the following command:

wget https://download.nextcloud.com/server/releases/latest-21.zip

Once the download is completed, extract it to the Apache web root directory with the following command:

unzip latest-21.zip -d /var/www/html/

Next, create a data directory for Nextcloud with the following command:

mkdir -p /var/www/html/nextcloud/data

Next, change the ownership of the Nextcloud directory to Apache:

chown -R apache:apache /var/www/html/nextcloud/

Step 5 – Create an Apache Virtual Host Configuration File

Next, you will need to create an Apache virtual host configuration file to host Nextcloud using the Apache webserver.

nano /etc/httpd/conf.d/nextcloud.conf

Add the following code:

<VirtualHost *:80>
    ServerName nextcloud.yourdomain.com
    DocumentRoot /var/www/html/nextcloud
    ErrorLog /var/log/httpd/nextcloud_error.log
    CustomLog /var/log/httpd/nextcloud_requests.log combined
</VirtualHost>

Save the file when you are finished, then restart the Apache service to apply the changes:

systemctl restart httpd

You can check the status of Apache using the following command;

systemctl status httpd

You should get the following output:

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─php-fpm.conf
   Active: active (running) since Tue 2021-09-14 09:56:13 UTC; 5s ago
     Docs: man:httpd.service(8)
 Main PID: 38015 (httpd)
   Status: "Started, listening on: port 80"
    Tasks: 213 (limit: 23695)
   Memory: 30.8M
   CGroup: /system.slice/httpd.service
           ├─38015 /usr/sbin/httpd -DFOREGROUND
           ├─38016 /usr/sbin/httpd -DFOREGROUND
           ├─38017 /usr/sbin/httpd -DFOREGROUND
           ├─38018 /usr/sbin/httpd -DFOREGROUND
           └─38019 /usr/sbin/httpd -DFOREGROUND

Sep 14 09:56:13 RockyLinux8 systemd[1]: Starting The Apache HTTP Server...

Step 6 – Configure Firewall

If firewalld is installed and running in your server, then you will need to allow port 80 through the firewall. You can allow it using the following command:

firewall-cmd --add-port=80/tcp --zone=public --permanent

Next, reload the firewall to apply the changes:

firewall-cmd --reload

Step 7 – Access NextCloud

Note: If you get the following error about PHP, follow these steps.

This version of Nextcloud requires at least PHP 7.3
You are currently running 7.2.24. Please update your PHP version.

yum module list php
yum module reset php
yum module enable php:7.3 -y
yum install -y php php-cli php-common

To access Nextcloud, open your web browser and visit the URL http://nextcloud.yourdomain.com. You should see the following screen:
NextCloud Welcome page
NextCloud Welcome page2
Provide your administrator account name, password, define your data directory, database credentials and click on the Finish setup button. You will be redirected to the Nextcloud login page:
NextCloud Login page
Provide your admin account username, password and click on the Log in button. You should see the Nextcloud dashboard:
NextCloud Dashboard page

Conclusion

Now that you have installed Nextcloud on Rocky Linux 8, you can easily create and share documents, calendars, and more with your friends and family. Get started on dedicated hosting from Atlantic.Net.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

How to Install Python 3.10 on Rocky Linux 8
How to Install TaskBoard on Rocky Linux 8
How to Set Up Pritunl VPN Server on Rocky Linux 8
How to Install Teampass Password Manager on Rocky Linux 8
How to Install and Configure RabbitMQ Server on Rocky Linux 8

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources