How To Install NextCloud 17 on CentOS 8

Prerequisites

Install the Apache server and MariaDB/MySQL.

yum install httpd mariadb-server mariadb wget unzip -y

Install the PHP and its extensions using the yum command.

yum install -y php php-mysqlnd php-common php-json php-xml  php-gd php-mbstring php-process  php-pecl-zip php-pdo php-intl php-ldap

Start the Apache and MariaDB/MySQL service.

systemctl start httpd

systemctl start mariadb

Enable both Apache and MySQL/MariaDB service to start automatically at system start-up.

systemctl enable httpd

systemctl enable mariadb

Creating The Database

Set up a new root password when asked. You can accept the defaults for everything.

mysql_secure_installation

After the installation, login as a root user to MySQL console and create a new database for Nextcloud.

mysql -u root -p

Create a database called nextclouddb.

create database nextclouddb;

Grant permission to nextclouduser on the nextclouddb database on the localhost with a predefined password.

Change the PASSWORD to a secure and strong password of your choice.

grant all on nextclouddb.* to 'nextclouduser'@'localhost' identified by 'password';

will reloads the grant tables in the mysql database enabling the changes to take effect without reloading or restarting mysql service.

FLUSH PRIVILEGES;

Exit from the MariaDB prompt.

quit;

Download Nextcloud

Download the latest version of Nextcloud with the below command.

cd /tmp/ 

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

Unzip the Nextcloud archive using the following command.

unzip nextcloud-17.0.2.zip

Move the extracted files to Apache’s document root and then create a data directory to hold the user data.

mv nextcloud /var/www/html/ 

mkdir /var/www/html/nextcloud/data

Set the ownership of the files inside the NextCloud directory so that apache user can write the data into it.

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

Firewall

Create a firewall rule to allow access from external machines to the Nextcloud.

firewall-cmd --permanent --add-service=http

firewall-cmd --reload

Modify your apache configuration file to look like below.

vi /etc/httpd/conf/httpd.conf    

<Directory "/var/www">
     AllowOverride All
  # Allow open access:
    Require all granted
   </Directory>    

<Directory "/var/www/html">
AllowOverride All

Restart the apache service after modified the configuration file.

systemctl restart httpd

SELinux

Run below commands to set the SELinux context to allow NextCloud to write data inside its important directories.

yum install -y policycoreutils-python-utils
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/apps(/.*)?'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.htaccess'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.user.ini'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?' 

Configure NextCloud

From your web browser, open the URL:

http://IP_Address/nextcloud

From here, you will have to configure and setup the nextcloud using the web interface.

When you visit the nextcloud configuration page create a username and password.

nextcloud

You need to select MySQL/MariaDB option

nextcloud

When done click the “Finish Setup” button. You should get the Files dashboard of Nextcloud. Now install Nextcloud Agent on your end device to start syncing files.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS