Prerequisites
The newly installed system’s follow initial server setup. Shell access with sudo privileges account.
Step 1 – Disable SELinux
Before starting, it is a good idea to disable the SELinux in your system. To disable SELinux, open the /etc/selinux/config file: Change the following line:
Step 2 – Install LAMP Stack
The first of all, to set up Nextcloud you must have running LAMP server on your CentOS 8 system. If you already have running LAMP stack skip this step else use the following commands to install it.
Install Apache2
Install MySQL
Install PHP
NextCloud required PHP 5.6 or higher version. Let’s install PHP on your system using below comamnd.
Step 3 – Download Nextcloud
After successfully configuring lamp server on your system, Let’s download latest Nextcloud from its official website. Now extract downloaded archive under website document root and set up appropriate permissions on files and directories. Nextcloud required a directory to keep its data. So create a data directory and set the proper permissions on nextcloud directory
Step 4 – Create MySQL User and Database
After extracting code, let’s create a MySQL database and user account for configuring Nextcloud. Use following set of command to login to MySQL server and create database and user.
Step 5 – Configure Apache
Now configure Apache server to host Nextcloud. Create a configuration file with an Alias to Nextcloud directory. Add below values:
Save file and close it. Now, restart Apache service to reload changes.
Step 6 – Run Nexctloud Web Installer
Now access the Nextcloud directory on a web browser as below. Change localhost to your server IP address or domain name. Enter new admin credentials to create an admin account and provide the location of the data folder.
Now slide your page down and input the database credentials and click on Finish Setup.
After completing the setup you will get the admin dashboard. Where you can create a user, groups, assigned them permissions, etc.
Conclusion
Congratulations, You have a working Nextcloud file hosting service on your CentOS 8 Linux system.