{"id":2953,"date":"2018-11-09T06:03:20","date_gmt":"2018-11-09T06:03:20","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=2953"},"modified":"2018-11-12T01:11:00","modified_gmt":"2018-11-12T01:11:00","slug":"how-to-install-and-configure-nextcloud-with-apache-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/09\/how-to-install-and-configure-nextcloud-with-apache-on-centos-7\/","title":{"rendered":"How To Install and Configure Nextcloud with Apache on CentOS 7"},"content":{"rendered":"<p><a href=\"https:\/\/nextcloud.com\/\">Nextcloud<\/a> is an open source, self-hosted file share and collaboration platform, similar to Dropbox. It comes bundled with media player, calendar and contact management.<\/p>\n<p>Nextcloud is extensible via apps and has desktop and mobile clients for all major platforms.<\/p>\n<p>This tutorial will walk you through the process of installing and configuring Nextcloud with Apache on a CentOS 7 system.<\/p>\n<h2>Prerequisites<\/h2>\n<p>Before starting with the tutorial, make sure you are logged in as a <a href=\"\/post\/create-a-sudo-user-on-centos\/\">user with sudo privileges<\/a>.<\/p>\n<h2>Step 1: Creating MySQL Database<\/h2>\n<p>NextCloud can use SQLite, <a href=\"\/post\/how-to-install-postgresql-on-centos-7\/\">PostgreSQL<\/a> or MySQL database to store all its data.<\/p>\n<p>In this tutorial we will use MySQL as the database of choice.<\/p>\n<p>If you already don\u2019t have MySQL or MariaDB installed on your CentOS server you can install by following one of the instructions below:<\/p>\n<ul>\n<li><a href=\"\/post\/install-mysql-on-centos-7\/\">Install MySQL on CentOS 7<\/a><\/li>\n<li><a href=\"\/post\/install-mariadb-on-centos-7\/\">Install MariaDB on CentOS 7<\/a><\/li>\n<\/ul>\n<p>Start by logging to to the MySQL shell by typing the following command:<\/p>\n<p>Run the following SQL statements to <a href=\"\/post\/how-to-create-a-mysql-database\/\">create a database<\/a> named nextcloud, user named nextclouduser and to <a href=\"\/post\/how-to-create-mysql-user-accounts-and-grant-privileges\/\">grant the necessary privileges<\/a> to the user:<\/p>\n<p>CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;<br \/>\nGRANT ALL ON nextcloud.* TO &#8216;nextclouduser&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;change-with-strong-password&#8217;;<br \/>\nFLUSH PRIVILEGES;<br \/>\nEXIT;<\/p>\n<h2>Step 2: Installing PHP and Apache<\/h2>\n<p>Nextcloud is a PHP application. CentOS 7 ships with PHP 5.4 which is not supported by Nextcloud.<\/p>\n<p>We will install PHP 7.1 from the Remi repository. The commands below will enable EPEL and Remi repositories:<\/p>\n<p>sudo yum install epel-release yum-utils<br \/>\nsudo yum install http:\/\/rpms.remirepo.net\/enterprise\/remi-release-7.rpm<br \/>\nsudo yum-config-manager &#8211;enable remi-php71<\/p>\n<p>Once the repositories are enabled <a href=\"\/post\/how-to-install-apache-on-centos-7\/\">install Apache<\/a> <a href=\"\/post\/install-php-7-on-centos-7\/\">PHP 7.1<\/a> and all required PHP extensions with the following command:<\/p>\n<p>sudo yum install httpd php php-gd php-json php-mysql php-curl php-mbstring php-intl php-mcrypt php-imagick php-xml php-zip<\/p>\n<h2>Step 3: Configuring firewall<\/h2>\n<p>If you are running <a href=\"\/post\/how-to-setup-a-firewall-with-firewalld-on-centos-7\/\">Firewall<\/a> on your CentOS server, you\u2019ll need to open HTTP (80) and HTTPS (443) ports.<\/p>\n<p>You can do that by running the following commands:<\/p>\n<p>sudo firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-service=http<br \/>\nsudo firewall-cmd &#8211;permanent &#8211;zone=public &#8211;add-service=https<br \/>\nsudo firewall-cmd &#8211;reload<\/p>\n<h2>Step 4: Downloading Nextcloud<\/h2>\n<p>Download the latest version of Nextcloud from the <a href=\"https:\/\/nextcloud.com\/install\/#instructions-server\">Nextcloud download page<\/a> with <a href=\"\/post\/wget-command-examples\/\">wget<\/a>:<\/p>\n<p>wget -P \/tmp https:\/\/download.nextcloud.com\/server\/releases\/nextcloud-14.0.3.zip<\/p>\n<p>At the time of writing this article, the latest version of Nextcloud is version 14.0.3.<\/p>\n<p>Once the download is complete, <a href=\"\/post\/how-to-unzip-files-in-linux\/\">extract the archive<\/a> and move the Nextcloud extracted files to the \/var\/www directory:<\/p>\n<p>unzip \/tmp\/nextcloud-14.0.3.zip<br \/>\nsudo mv \/tmp\/nextcloud \/var\/www\/<\/p>\n<p>Set the correct permissions so that the Apache web server can have full access to the Nextcloud\u2019s files and directories.<\/p>\n<p>sudo chown -R apache: \/var\/www\/nextcloud<\/p>\n<h2>Step 5: Configure Apache<\/h2>\n<p>Open your text editor and create the following Apache configuration file.<\/p>\n<p>sudo nano \/etc\/httpd\/conf.d\/nextcloud.conf<\/p>\n<p>\/etc\/httpd\/conf.d\/nextcloud.conf<\/p>\n<p>Alias \/nextcloud &#8220;\/var\/www\/nextcloud\/&#8221;<\/p>\n<p>&lt;Directory \/var\/www\/nextcloud\/&gt;<br \/>\nOptions +FollowSymlinks<br \/>\nAllowOverride All<\/p>\n<p>&lt;IfModule mod_dav.c&gt;<br \/>\nDav off<br \/>\n&lt;\/IfModule&gt;<\/p>\n<p>SetEnv HOME \/var\/www\/nextcloud<br \/>\nSetEnv HTTP_HOME \/var\/www\/nextcloud<\/p>\n<p>&lt;\/Directory&gt;<\/p>\n<p>Activate the changes by restarting Apache service:<\/p>\n<p>sudo systemctl restart httpd<\/p>\n<h2>Step 6: Installing Nextcloud<\/h2>\n<p>Now that Nextcloud is downloaded and all necessary services are configured open you browser and start the Nextcloud installation by visiting your server\u2019s domain name or IP address followed by \/nextcloud :<\/p>\n<p>http:\/\/domain_name_or_ip_address\/nextcloud<\/p>\n<p>You will be presented with the Nextcloud setup page.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/lxer.com\/post\/how-to-install-and-configure-nextcloud-on-centos-7\/install-nextcloud-centos.jpg\" alt=\"\" \/><\/p>\n<p>Enter your desired admin username and password and the MySQL user and database details you previously created.<\/p>\n<p>Click on the Finish setup button and once the installation process is completed you will be redirected to the Nextcloud dashboard logged in as admin user.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/lxer.com\/post\/how-to-install-and-configure-nextcloud-on-centos-7\/nextcloud-dashboard.jpg\" alt=\"\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>You have learned how to install and configure Nextcloud on your CentOS 7 machine. If you have a domain name associated with your Nextcloud server, you can follow this guide and secure your <a href=\"\/post\/secure-apache-with-let-s-encrypt-on-centos-7\/\">Apache with Let\u2019s Encrypt<\/a>.<\/p>\n<p>To find more information about how to manage your Nextcloud instance visit the <a href=\"https:\/\/docs.nextcloud.com\">Nextcloud documentation<\/a> page.<\/p>\n<p>If you have any question, please leave a comment below.<\/p>\n<p><a href=\"http:\/\/lxer.com\/module\/newswire\/ext_link.php?rid=262648\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nextcloud is an open source, self-hosted file share and collaboration platform, similar to Dropbox. It comes bundled with media player, calendar and contact management. Nextcloud is extensible via apps and has desktop and mobile clients for all major platforms. This tutorial will walk you through the process of installing and configuring Nextcloud with Apache on &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/09\/how-to-install-and-configure-nextcloud-with-apache-on-centos-7\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How To Install and Configure Nextcloud with Apache on CentOS 7&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2953","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=2953"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2953\/revisions"}],"predecessor-version":[{"id":3166,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/2953\/revisions\/3166"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=2953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=2953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=2953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}