By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
IT Infras HolicIT Infras HolicIT Infras Holic
  • News
  • Linux
    • Application
    • SELinux
    • Centos
    • Ubuntu
  • Docker
  • Web Server
    • Kong
    • Nginx
    • Openlitespeed
  • Database
  • Mikrotik
  • Windows
  • Mail
  • Tools
    • 2048
    • Fantasy Forest
    • Hextris
    • Crossword
Search
  • Privacy Policy
© 2024. All Rights Reserved.
Font ResizerAa
IT Infras HolicIT Infras Holic
Font ResizerAa
  • News
  • Linux
  • Docker
  • Web Server
  • Database
  • Mikrotik
  • Windows
  • Mail
  • Tools
Search
  • News
  • Linux
    • Application
    • SELinux
    • Centos
    • Ubuntu
  • Docker
  • Web Server
    • Kong
    • Nginx
    • Openlitespeed
  • Database
  • Mikrotik
  • Windows
  • Mail
  • Tools
    • 2048
    • Fantasy Forest
    • Hextris
    • Crossword
Follow US
© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.
IT Infras Holic > Blog > Linux > Application > Install Nextcloud on CentOS 7 Include SSL
ApplicationLinux

Install Nextcloud on CentOS 7 Include SSL

writer
Share
4 Min Read
SHARE

Install Nextcloud on CentOS 7 – This guide will walk you through the installation of Nextcloud on CentOS 7 with PHP 7.3, Apache and MariaDB 10.4. You can optionally configure SSL encryption with Let’s Encrypt to ensure that access and data is being transferred through a secure tunnel. Nextcloud is an open-source seft-hosted syncing and file sharing server forked from ownCloud. It is written in PHP and JavaScript and has support for MySQL, PostgreSQL, SQLite and Oracle Database.

Contents
Install Nextcloud on CentOS 7 Include SSL (Let’s Encrypt)Disable SELinux or Put in in Permissive modeInstall PHP and httpdDisable default PHP 5.x enabled repository and enable one for PHP 7.3:Install and Configure MariaDB / MySQLDownload and Install Nextcloud on CentOS 7Unzip the downloaded file & remove source file:Move the resulting nextcloud folder to /var/www/html directoryCreate data directory to store Nextcloud uploaded files. This can be any path e.g NFS mount point, SAN mount point e.t.c.Give apache user and group the ownership of nextcloud folder.Configure Apache VirtualHost – Without SSLCreate an Apache configuration file for NextcloudPaste code below to fileWhen done, save the file and start httpd service.If you have an active firewalld service, allow http and https ports.Configure Apache With Let’s Encrypt SSLTo use Let’s Encrypt SSL certificate, first install certbotInstall Nextcloud on CentOS 7Request for SSL certificate.Install Nextcloud on CentOS 7Don’t forget to change domain name & email above with yoursAccess Nextcloud UI and finish installation

Install Nextcloud on CentOS 7 Include SSL (Let's Encrypt)

Disable SELinux or Put in in Permissive mode

Disabling SELinux for smooth operations:

1
2
sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

Install PHP and httpd

1
2
sudo yum -y install epel-release yum-utils
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Disable default PHP 5.x enabled repository and enable one for PHP 7.3:

1
2
sudo yum-config-manager --disable remi-php54
sudo yum-config-manager --enable remi-php73

Install and Configure MariaDB / MySQL

Install MariaDB / MySQL database server on CentOS 7 using our previous guides. Choose one, recommended is MariaDB.

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

1
2
3
4
5
6
$ mysql -u root -p
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY "StrongPassword";
CREATE DATABASE nextcloud;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;
QUIT

Download and Install Nextcloud on CentOS 7

1
2
sudo yum -y install wget unzip
wget https://download.nextcloud.com/server/releases/latest.zip

Unzip the downloaded file & remove source file:

1
2
unzip latest.zip
rm -f latest.zip

Move the resulting nextcloud folder to /var/www/html directory

1
sudo mv nextcloud/ /var/www/html/

Create data directory to store Nextcloud uploaded files. This can be any path e.g NFS mount point, SAN mount point e.t.c.

1
2
sudo mkdir /var/www/html/nextcloud/data
sudo chown apache:apache -R /var/www/html/nextcloud/data

Give apache user and group the ownership of nextcloud folder.

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

Configure Apache VirtualHost – Without SSL

Create an Apache configuration file for Nextcloud

1
sudo vim /etc/httpd/conf.d/nextcloud.conf

Paste code below to file

1
2
3
4
5
6
7
8
9
10
11
12
<VirtualHost *:80>
  ServerName files.example.com
  ServerAdmin admin@example.com
  DocumentRoot /var/www/html/nextcloud
  <directory /var/www/html/nextcloud>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
    SetEnv HOME /var/www/html/nextcloud
    SetEnv HTTP_HOME /var/www/html/nextcloud
  </directory>
</VirtualHost>

Set correct ServerName and change other settings to suit your use.

When done, save the file and start httpd service.

1
2
3
sudo systemctl enable --now httpd
sudo semanage fcontext -a -t httpd_sys_content_t "/var/www/html(/.*)?"
sudo sudo restorecon -Rv /var/www/html

If you have an active firewalld service, allow http and https ports.

1
2
sudo firewall-cmd --add-service={http,https} --permanent
sudo firewall-cmd --reload

Configure Apache With Let’s Encrypt SSL

To use Let’s Encrypt SSL certificate, first install certbot

1
2
3
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
sudo mv certbot-auto /usr/local/bin

Install Nextcloud on CentOS 7

Request for SSL certificate.

1
2
3
export DOMAIN="files.example.com"
export EMAIL="[email protected]"
certbot-auto certonly --standalone -d $DOMAIN --preferred-challenges http --agree-tos -n -m $EMAIL --keep-until-expiring

Install Nextcloud on CentOS 7

Don't forget to change domain name & email above with yours

Modify your VirtualHost configuration file to look like below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<VirtualHost *:80>
   ServerName files.example.com
   ServerAdmin admin@example.com
   RewriteEngine On
   RewriteCond %{HTTPS} off
   RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
 
<IfModule mod_ssl.c>
   <VirtualHost *:443>
     ServerName files.example.com
     ServerAdmin admin@example.com
     DocumentRoot /var/www/html/nextcloud
     <directory /var/www/html/nextcloud>
        Require all granted
        AllowOverride All
        Options FollowSymLinks MultiViews
        SetEnv HOME /var/www/html/nextcloud
        SetEnv HTTP_HOME /var/www/html/nextcloud
    </directory>
     SSLEngine on
     SSLCertificateFile /etc/letsencrypt/live/files.example.com/fullchain.pem
     SSLCertificateKeyFile /etc/letsencrypt/live/files.example.com/privkey.pem
   </VirtualHost>
</IfModule>

Access Nextcloud UI and finish installation

Open your nextcloud server URL as configured on Apache: http://files.example.com

Setup admin password

Setup Database, don't forget to using MariaDB and set credentials

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.

Thanks for using our guide to Install Nextcloud on CentOS 7.

You Might Also Like

Monitoring File & Directory Changes using Bash Script

Vulnerability Checker CVE-2024-3094

Unleashing the Potential of Knowledge Management with Wiki.js

How to Install Apache Guacamole with Docker Compose

Unlocking Seamless Remote Access: Exploring the Power of Apache Guacamole

TAGGED: install nextcloud on centos 7, nextcloud
Share This Article
Facebook Twitter Whatsapp Whatsapp LinkedIn Telegram Copy Link
Previous Article Semanage Command Not Found Semanage Command Not Found in CentOS 7
Next Article Install MariaDB on CentOS 7 Install MariaDB on CentOS 7 (MariaDB 10.4)
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Latest News

bash
Monitoring File & Directory Changes using Bash Script
Linux Application
vulnerability
Vulnerability Checker CVE-2024-3094
Linux
wiki.js
Unleashing the Potential of Knowledge Management with Wiki.js
Application Linux
Install Apache Guacamole
How to Install Apache Guacamole with Docker Compose
Application Linux

You Might also Like

How to Install Cyberpanel on Ubuntu 22.04
OpenlitespeedUbuntuWeb Server

Install Cyberpanel on Ubuntu 22.04

8 Min Read
How to map SFTP as a drive on Windows 10
LinuxWindows

How to map SFTP as a drive on Windows 10

3 Min Read
Follow US
© 2024
activity notes activity notes
Welcome Back!

Sign in to your account

Lost your password?