{"id":7469,"date":"2019-01-19T13:52:36","date_gmt":"2019-01-19T10:52:36","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=7469"},"modified":"2022-01-13T15:21:58","modified_gmt":"2022-01-13T12:21:58","slug":"install-nextcloud-on-centos-linux-server","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/install-nextcloud-on-centos-linux-server\/","title":{"rendered":"Install Nextcloud 23 on CentOS 7 With Let&#8217;s Encrypt SSL"},"content":{"rendered":"\n<p>How do I install Nextcloud 23 on CentOS 7 Linux?. This guide will walk you through the installation of Nextcloud 23 on CentOS 7 with PHP 7.3, Apache and MariaDB 10.4. You can optionally configure SSL encryption with Let&#8217;s Encrypt to ensure that access and data <g class=\"gr_ gr_7 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace\" id=\"7\" data-gr-id=\"7\">is<\/g> being transferred through a secure tunnel.<\/p>\n\n\n\n<p>For Ubuntu\/ Debian, check:<a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/computingforgeeks.com\/how-to-install-nextcloud-on-ubuntu-debian\/\" target=\"_blank\"> How to Install Nextcloud on Ubuntu \/ Debian<\/a><\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install NextCloud on CentOS 7 with Let&#8217;s Encrypt SSL<\/h2>\n\n\n\n<p>Nextcloud provides client applications for Windows, Linux, macOS, Android and iOS which are used to sync files between your Desktop and the Nextcloud file server. It also has a modern and easy-to-use web interface which enables you to access files from a web browser.<\/p>\n\n\n\n<p>Follow the steps provided in this article to install and configure Nextcloud on your CentOS 7 server. It can be a freshly installed or a server with running applications provided you can satisfy pre-requisites and required dependencies.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Disable SELinux or Put in in Permissive mode<\/h4>\n\n\n\n<p>Consider disabling SELinux for smooth operations:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo setenforce 0\nsudo sed -i 's\/^SELINUX=.*\/SELINUX=permissive\/g' \/etc\/selinux\/config<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install PHP and httpd<\/h3>\n\n\n\n<p>We require PHP and Apache to run Nextcloud on CentOS 7. For PHP, we will use PHP 7.3 since it is the latest stable release of PHP available for CentOS 7. This is available on Remi repository which needs to be added prior to installation.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo yum -y install epel-release yum-utils\nsudo yum -y install http:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm<\/code><\/pre>\n\n\n\n<p>Disable default PHP 5.x enabled repository and enable one for PHP 7.4:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo yum-config-manager --disable remi-php54\nsudo yum-config-manager --enable remi-php74<\/code><\/pre>\n\n\n\n<p>Then install Apache and PHP packages:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo yum -y install vim httpd mod_ssl php php-cli php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-pdo php-pecl-apcu php-pecl-apcu-devel php-ldap<\/code><\/pre>\n\n\n\n<p>Confirm your PHP version<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <span class=\"has-inline-color has-pale-pink-color\">php -v<\/span>\nPHP 7.4.20 (cli) (built: Jun  1 2021 15:41:56) ( NTS )\nCopyright (c) The PHP Group\nZend Engine v3.4.0, Copyright (c) Zend Technologies<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Install and Configure MariaDB \/ MySQL<\/h3>\n\n\n\n<p>Install MariaDB \/ MySQL database server on CentOS 7 using our previous guides. Choose one, recommended is MariaDB.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a rel=\"noreferrer noopener\" href=\"https:\/\/computingforgeeks.com\/install-mariadb-on-ubuntu-and-centos\/\" target=\"_blank\">Install MariaDB 10.x on CentOS 7<\/a><\/li><\/ul>\n\n\n\n<p>After the installation, login as a root user to MySQL console and create a new database for Nextcloud.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <span class=\"has-inline-color has-pale-pink-color\">mysql -u root -p<\/span>\nCREATE USER 'nextcloud'@'localhost' IDENTIFIED BY \"<span class=\"has-inline-color has-vivid-cyan-blue-color\">StrongPassword<\/span>\";\nCREATE DATABASE nextcloud;\nGRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';\nFLUSH PRIVILEGES;\nQUIT<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"mce_45\">Step 3: Download and Install Nextcloud on CentOS 7<\/h3>\n\n\n\n<p>Download the latest release of Nextcloud:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo yum -y install wget unzip\nwget https:\/\/download.nextcloud.com\/server\/releases\/latest-23.zip<\/code><\/pre>\n\n\n\n<p>Unzip the downloaded file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unzip latest-23.zip\nrm -f latest-23.zip<\/code><\/pre>\n\n\n\n<p>Move the resulting <code>nextcloud<\/code> folder to <code>\/var\/www\/html<\/code> directory. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mv nextcloud\/ \/var\/www\/html\/<\/code><\/pre>\n\n\n\n<p>Create data directory to store Nextcloud uploaded files. This can be any path e.g NFS mount point, SAN mount point e.t.c.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir \/var\/www\/html\/nextcloud\/data<br>sudo chown apache:apache -R \/var\/www\/html\/nextcloud\/data<\/code><\/pre>\n\n\n\n<p>Give  apache user and group the ownership of nextcloud folder.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown apache:apache -R \/var\/www\/html\/nextcloud<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Configure Apache VirtualHost &#8211; Without SSL<\/h3>\n\n\n\n<p>Now create an Apache configuration file for Nextcloud.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vim \/etc\/httpd\/conf.d\/nextcloud.conf<\/code><\/pre>\n\n\n\n<p>Paste below content to the file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n  ServerName files.example.com\n  ServerAdmin admin@example.com\n  DocumentRoot \/var\/www\/html\/nextcloud\n  &lt;directory \/var\/www\/html\/nextcloud&gt;\n    Require all granted\n    AllowOverride All\n    Options FollowSymLinks MultiViews\n    SetEnv HOME \/var\/www\/html\/nextcloud\n    SetEnv HTTP_HOME \/var\/www\/html\/nextcloud\n  &lt;\/directory&gt;\n&lt;\/VirtualHost&gt;<\/code><\/pre>\n\n\n\n<p>Set correct <code>ServerName<\/code> and change other settings to suit your use. When done, save the file and start httpd service.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable --now httpd<\/code><\/pre>\n\n\n\n<p>Configure SELinux:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo semanage fcontext -a -t httpd_sys_rw_content_t \"\/var\/www\/html(\/.*)?\"\nsudo sudo restorecon -Rv \/var\/www\/html<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Configure Firewall:<\/h4>\n\n\n\n<p>If you have an active firewalld service, allow http and https ports.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo firewall-cmd --add-service={http,https} --permanent<br>sudo firewall-cmd --reload<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"mce_66\">Step 5: Configure Apache With Let&#8217;s Encrypt SSL<\/h3>\n\n\n\n<p>To use Let&#8217;s Encrypt SSL certificate, first install certbot<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo yum -y install epel-release\nsudo yum -y install certbot<\/code><\/pre>\n\n\n\n<p>Then request for SSL certificate.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export DOMAIN=\"files.example.com\"\nexport EMAIL=\"admin@example.com\"\nsudo certbot certonly --standalone -d $DOMAIN --preferred-challenges http --agree-tos -n -m $EMAIL --keep-until-expiring<\/code><\/pre>\n\n\n\n<p>Modify your VirtualHost configuration file to look like below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;VirtualHost *:80&gt;\n   ServerName files.example.com\n   ServerAdmin admin@example.com\n   RewriteEngine On\n   RewriteCond %{HTTPS} off\n   RewriteRule ^(.*)$ https:\/\/%{HTTP_HOST}$1 &#91;R=301,L]\n&lt;\/VirtualHost&gt;\n\n&lt;IfModule mod_ssl.c&gt;\n   &lt;VirtualHost *:443&gt;\n     ServerName files.example.com\n     ServerAdmin admin@example.com\n     DocumentRoot \/var\/www\/html\/nextcloud\n     &lt;directory \/var\/www\/html\/nextcloud&gt;\n        Require all granted\n        AllowOverride All\n        Options FollowSymLinks MultiViews\n        SetEnv HOME \/var\/www\/html\/nextcloud\n        SetEnv HTTP_HOME \/var\/www\/html\/nextcloud\n    &lt;\/directory&gt;\n     SSLEngine on\n     SSLCertificateFile \/etc\/letsencrypt\/live\/files.example.com\/fullchain.pem\n     SSLCertificateKeyFile \/etc\/letsencrypt\/live\/files.example.com\/privkey.pem\n   &lt;\/VirtualHost&gt;\n&lt;\/IfModule&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Access Nextcloud UI and finish installation<\/h3>\n\n\n\n<p>Open your nextcloud server URL as configured on Apache: <code><a aria-label=\" (opens in a new tab)\" href=\"https:\/\/computingforgeeks.com\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/files.example.com<\/a><\/code> , for http you can also use IP address to access Nextcloud Web interface.<\/p>\n\n\n\n<p>Create admin account on first page.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"830\" height=\"494\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-01.png\" alt=\"nextcloud\" class=\"wp-image-7478\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-01.png 830w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-01-300x179.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-01-768x457.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-01-696x414.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-01-706x420.png 706w\" sizes=\"auto, (max-width: 830px) 100vw, 830px\" \/><\/figure>\n\n\n\n<p>Provide admin username and password. Also configure MySQL \/ MariaDB database.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"687\" height=\"583\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-02.png\" alt=\"nextcloud\" class=\"wp-image-7479\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-02.png 687w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-02-300x255.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2019\/01\/install-nextcloud-15-centos-7-02-495x420.png 495w\" sizes=\"auto, (max-width: 687px) 100vw, 687px\" \/><\/figure>\n\n\n\n<p>When done click the &#8220;<strong>Finish Setup&#8221;<\/strong> button. You should get the Files dashboard of Nextcloud. Now install <a href=\"https:\/\/nextcloud.com\/clients\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Nextcloud Agent <\/a>on your end device to start syncing files.<\/p>\n\n\n\n<p>Thanks for using our guide to install Nextcloud 23 on CentOS 7 and securing with Let&#8217;s Encrypt SSL. Stay connected for more informative guides.<\/p>\n\n\n\n<p>More guides:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" href=\"https:\/\/computingforgeeks.com\/setup-glusterfs-storage-with-heketi-on-centos-server\/\" target=\"_blank\">Setup GlusterFS Storage With Heketi on CentOS 8 \/ CentOS 7<\/a><\/li><li><a aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" href=\"https:\/\/computingforgeeks.com\/how-to-setup-s3-compatible-object-storage-server-with-minio\/\" target=\"_blank\">How To Setup S3 Compatible Object Storage Server with Minio<\/a><\/li><li><a aria-label=\" (opens in a new tab)\" href=\"https:\/\/computingforgeeks.com\/install-and-use-stratis-to-manage-local-storage-on-rhel-8\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Use Stratis to Manage Local Storage on RHEL 8 \/ CentOS 8<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>How do I install Nextcloud 23 on CentOS 7 Linux?. This guide will walk you through the installation of Nextcloud 23 on CentOS 7 with PHP 7.3, Apache and MariaDB 10.4. You can optionally configure SSL encryption with Let&#8217;s Encrypt to ensure that access and data is being transferred through a secure tunnel. For Ubuntu\/ &#8230; <a title=\"Install Nextcloud 23 on CentOS 7 With Let&#8217;s Encrypt SSL\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/install-nextcloud-on-centos-linux-server\/\" aria-label=\"Read more about Install Nextcloud 23 on CentOS 7 With Let&#8217;s Encrypt SSL\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":7478,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[663,17,299,50],"tags":[36652,753,36653,754],"class_list":["post-7469","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-storage","category-centos","category-how-to","category-linux-tutorials","tag-install-nextcloud-on-centos-7","tag-nextcloud","tag-nextcloud-on-centos-7","tag-owncloud"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/7469","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=7469"}],"version-history":[{"count":0,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/7469\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/7478"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=7469"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=7469"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=7469"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}