How to Install and Configure NextCloud in Apache using CentOS8?
Step1. Login to the server with SSH.
![](https://support.gmoace.com/wp-content/uploads/2024/01/p1.png)
Step2. Installing PHP and Apache.
[root@zcom-mm ~]# yum install epel-release yum-utils
![](https://support.gmoace.com/wp-content/uploads/2024/01/p2-1-1024x192.png)
[root@zcom-mm ~] # yum install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
![](https://support.gmoace.com/wp-content/uploads/2024/01/p3-1-1024x297.png)
To install the yum-utils package
[root@zcom-mm ~] # dnf install yum-utils
![](https://support.gmoace.com/wp-content/uploads/2024/01/p4-1-1024x114.png)
To enable the module stream for 8.2
[root@zcom-mm ~] # dnf module reset php
[root@zcom-mm ~] # dnf module install php:remi-8.2
[root@zcom-mm ~] # dnf update
![](https://support.gmoace.com/wp-content/uploads/2024/01/p5-1-1024x183.png)
Installing PHP and the required modules
[root@zcom-mm ~] # dnf install -y php php-cli php-gd php-mbstring php-intl php-pecl-apcu\ php-mysqlnd php-opcache php-json php-zip
![](https://support.gmoace.com/wp-content/uploads/2024/01/p6-1-1024x114.png)
Installing optional modules redis/imagick
[root@zcom-mm ~] #dnf install -y php-redis php-imagick
![](https://support.gmoace.com/wp-content/uploads/2024/01/p7-1-1024x147.png)
Step3. Install MariaDB 10.11 on CentOS8.
Firstly, Create a new repo file /etc/yum.repos.d/MariaDB.repo in your system and add below code:
[root@zcom-mm ~] # vim /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.11 CentOS repository list - created 2024-01-24 18:19 UTC # https://mariadb.org/download/ [mariadb] name = MariaDB # rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details. # baseurl = https://rpm.mariadb.org/10.11/centos/$releasever/$basearch baseurl = https://mirror.kku.ac.th/mariadb/yum/10.11/centos/$releasever/$basearch # gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB gpgkey = https://mirror.kku.ac.th/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck = 1
![](https://support.gmoace.com/wp-content/uploads/2024/01/p8.png)
Step4. Install the MariaDB server and client packages.
[root@zcom-mm ~] # dnf install -y mariadb mariadb-server
![](https://support.gmoace.com/wp-content/uploads/2024/01/p9-1024x216.png)
Step5. When the installation is finished, please check mariadb status.
[root@zcom-mm ~] # systemctl status mariadb
![](https://support.gmoace.com/wp-content/uploads/2024/01/p10.png)
[root@zcom-mm ~] # systemctl enable mariadb
[root@zcom-mm ~] # systemctl start mariadb
[root@zcom-mm ~] # systemctl stautus mariadb
![](https://support.gmoace.com/wp-content/uploads/2024/01/p11-1024x248.png)
Step6.We need to secure your MariaDB installation using passwords and do some other changes. Please check the below instructions.
[root@zcom-mm ~] # mysql_secure_installation
![](https://support.gmoace.com/wp-content/uploads/2024/01/p12-1024x72.png)
![](https://support.gmoace.com/wp-content/uploads/2024/01/p13-1024x847.png)
Then you will need to install the redis service and enable it for start up on reboot using the following commands:
[root@zcom-mm ~] # dnf install -y redis
[root@zcom-mm ~] # systemctl enable redis.service
[root@zcom-mm ~] # systemctl start redis.service
![](https://support.gmoace.com/wp-content/uploads/2024/01/p14-1024x69.png)
Step7.After installing and completing the configuration, connect to MariaDB server. Use the following command and login to the Mariadb Server.
[root@zcom-mm ~] # mysql -u root -p
Step7.1 Then create a database.
MariaDB [(none)]> CREATE DATABASE nextclouddb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Step7.2 Allow “nextclouduser” to access the “nextclouddb” database on localhost with a predefined password.
MariaDB [(none)]> GRANT ALL ON nextclouddb.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'change-with-strong-password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]>EXIT;
![](https://support.gmoace.com/wp-content/uploads/2024/01/p15.png)
Step8. Then, we need to configure firewall setting.
[root@zcom-mm ~] # firewall-cmd --permanent --zone=public --add-service=http
[root@zcom-mm ~] # firewall-cmd --permanent --zone=public --add-service=https
[root@zcom-mm ~] # firewall-cmd --reload
![](https://support.gmoace.com/wp-content/uploads/2024/01/p16.png)
Download the NextCloud.
Download the latest version of Nextcloud from the Nextcloud download page with wget command:
[root@zcom-mm ~] # wget https://download.nextcloud.com/server/releases/nextcloud-26.0.5.zip
![](https://support.gmoace.com/wp-content/uploads/2024/01/p17-1024x34.png)
Once the download is complete, extract the archive to the /var/www directory:
[root@zcom-mm ~] # unzip nextcloud-26.0.5.zip -d /var/www/
![](https://support.gmoace.com/wp-content/uploads/2024/01/p18-1024x38.png)
Set the ownership of the files inside the NextCloud directory so that apache user can write the data into it.
[root@zcom-mm ~] # chown -R apache: /var/www/nextcloud
![](https://support.gmoace.com/wp-content/uploads/2024/01/p20.png)
Step9. Then configure the apache.
[root@zcom-mm ~] # vim /etc/httpd/conf.d/nextcloud.conf
Alias /nextcloud "/var/www/nextcloud/" <Directory /var/www/nextcloud/> Options +FollowSymlinks AllowOverride All <IfModule mod_dav.c> Dav off </IfModule> SetEnv HOME /var/www/nextcloud SetEnv HTTP_HOME /var/www/nextcloud </Directory>
![](https://support.gmoace.com/wp-content/uploads/2024/01/p21.png)
[root@zcom-mm ~] # systemctl restart httpd
Open up your web browser, can access the nextcloud with ip (or) domainhttp://150.95.**.***/nextcloud/
![](https://support.gmoace.com/wp-content/uploads/2024/01/p19-1024x505.png)
Thank you!!!