{"id":108154,"date":"2020-01-27T08:00:00","date_gmt":"2020-01-27T08:00:00","guid":{"rendered":"https:\/\/fedoramagazine.org\/?p=29554"},"modified":"2020-01-27T08:00:00","modified_gmt":"2020-01-27T08:00:00","slug":"build-your-own-cloud-with-fedora-31-and-nextcloud-server","status":"publish","type":"post","link":"https:\/\/sickgaming.net\/blog\/2020\/01\/27\/build-your-own-cloud-with-fedora-31-and-nextcloud-server\/","title":{"rendered":"Build your own cloud with Fedora 31 and Nextcloud Server"},"content":{"rendered":"<p><a rel=\"noreferrer noopener\" aria-label=\"Nextcloud (opens in a new tab)\" href=\"https:\/\/nextcloud.com\/\" target=\"_blank\">Nextcloud<\/a> is a software suite for storing and syncing your data across multiple devices. You can learn more about Nextcloud Server&#8217;s features from <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/github.com\/nextcloud\/server#nextcloud-server-\" target=\"_blank\">https:\/\/github.com\/nextcloud\/server<\/a>.<\/p>\n<p>This article demonstrates how to build a personal cloud using Fedora and Nextcloud in a few simple steps. For this tutorial you will need a dedicated computer or a virtual machine running Fedora 31 server edition and an internet connection.<\/p>\n<h2>Step 1: Configure the server<\/h2>\n<p>Start by updating your system and rebooting:<\/p>\n<pre class=\"wp-block-preformatted\">$ sudo -i\n# dnf upgrade\n# reboot<\/pre>\n<p>Next, disable SELinux by changing <em>enforcing<\/em> to <em>disabled<\/em> in <em>\/etc\/selinux\/config<\/em> and then rebooting to activate the new setting:<\/p>\n<pre class=\"wp-block-preformatted\"># vi \/etc\/selinux\/config\n# reboot<\/pre>\n<p>If you don&#8217;t want to reboot right away, you can use the <em>setenforce<\/em> command to disable SELinux in the current session.<\/p>\n<pre class=\"wp-block-preformatted\"># setenforce 0<\/pre>\n<p>Alternatively, you can follow the directions <a href=\"https:\/\/docs.nextcloud.com\/server\/17\/admin_manual\/installation\/selinux_configuration.html?highlight=selinux\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"here (opens in a new tab)\">here<\/a> to configure SELinux to work with Nextcloud.<\/p>\n<h2>Step 2: Install the prerequisites<\/h2>\n<p>Before installing and configuring Nextcloud, a few prerequisites must be satisfied.<\/p>\n<p>First, install Apache web server:<\/p>\n<pre class=\"wp-block-preformatted\"># dnf install httpd<\/pre>\n<p>Next, install PHP and some additional modules. Make sure that the PHP version being installed meets <a href=\"https:\/\/docs.nextcloud.com\/server\/17\/admin_manual\/installation\/system_requirements.html#server\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Nextcloud's requirements (opens in a new tab)\">Nextcloud&#8217;s requirements<\/a>:<\/p>\n<pre class=\"wp-block-preformatted\"># dnf install php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-pecl-redis php-opcache php-imagick php-zip php-process<\/pre>\n<p>After PHP is installed enable and start the Apache web server:<\/p>\n<pre class=\"wp-block-preformatted\"># systemctl enable --now httpd<\/pre>\n<p>Next, allow <em>HTTP<\/em> traffic through the firewall:<\/p>\n<pre class=\"wp-block-preformatted\"># firewall-cmd --permanent --add-service=http<br \/># firewall-cmd --reload<\/pre>\n<p>Next, install the MariaDB server and client:<\/p>\n<pre class=\"wp-block-preformatted\"># dnf install mariadb mariadb-server<\/pre>\n<p>Then enable and start the MariaDB server:<\/p>\n<pre class=\"wp-block-preformatted\"># systemctl enable --now mariadb<\/pre>\n<p>Now that MariaDB is running on your server, you can run the <em>mysql_secure_installation<\/em> command to secure it:<\/p>\n<pre class=\"wp-block-preformatted\"># mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the\ncurrent password for the root user. If you've just installed\nMariaDB, and you haven't set the root password yet, the password\nwill be blank, so you should just press enter here. Enter current password for root (enter for none): <strong>&lt;ENTER&gt;<\/strong>\nOK, successfully used password, moving on... Setting the root password ensures that nobody can log into\nthe MariaDB root user without the proper authorization. Set root password? [Y\/n] <strong>&lt;ENTER&gt;<\/strong>\nNew password: <strong>Your_Password_Here<\/strong>\nRe-enter new password: <strong>Your_Password_Here<\/strong> Password updated successfully! Reloading privilege tables... ... Success! By default, a MariaDB installation has an anonymous user,\nallowing anyone to log into MariaDB without having to have\na user account created for them. This is intended only for\ntesting, and to make the installation go a bit smoother. You\nshould remove them before moving into a production environment. Remove anonymous users? [Y\/n] <strong>&lt;ENTER&gt;<\/strong> ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the\nroot password from the network. Disallow root login remotely? [Y\/n] <strong>&lt;ENTER&gt;<\/strong> ... Success! By default, MariaDB comes with a database named 'test' that\nanyone can access. This is also intended only for testing, and\nshould be removed before moving into a production environment. Remove test database and access to it? [Y\/n] <strong>&lt;ENTER&gt;<\/strong> - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes\nmade so far will take effect immediately. Reload privilege tables now? [Y\/n] <strong>&lt;ENTER&gt;<\/strong> ... Success! Cleaning up... All done! If you've completed all of the above steps, your\nMariaDB installation should now be secure. Thanks for using MariaDB!<\/pre>\n<h2>Step 3: Install Nextcloud Server<\/h2>\n<p>Now that the prerequisites for your Nextcloud installation have been satisfied, download and unzip <a href=\"https:\/\/nextcloud.com\/install\/#instructions-server\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"the Nextcloud archive (opens in a new tab)\">the Nextcloud archive<\/a>:<\/p>\n<pre class=\"wp-block-preformatted\"># wget https:\/\/download.nextcloud.com\/server\/releases\/nextcloud-17.0.2.zip\n# unzip nextcloud-17.0.2.zip -d \/var\/www\/html\/<\/pre>\n<p>Next, create a data folder and grant Apache read and write access to the <em>nextcloud<\/em> directory tree:<\/p>\n<pre class=\"wp-block-preformatted\"># mkdir \/var\/www\/html\/nextcloud\/data\n# chown -R apache:apache \/var\/www\/html\/nextcloud<\/pre>\n<p>Next, create a dedicated user and database for your Nextcloud instance:<\/p>\n<pre class=\"wp-block-preformatted\"># mysql -p\n&gt; create database nextcloud;\n&gt; create user 'nc_admin'@'localhost' identified by 'SeCrEt';\n&gt; grant all privileges on nextcloud.* to 'nc_admin'@'localhost';\n&gt; flush privileges;\n&gt; exit;<\/pre>\n<h2>Step 4: Configure N<strong>extclou<\/strong>d<\/h2>\n<p>Nextcloud can be configured using its web interface or from the command line.<\/p>\n<h3>Using the web interface<\/h3>\n<p>From your favorite browser, access <em>http:\/\/your_server_ip\/nextcloud<\/em> and fill the&nbsp;fields:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.sickgaming.net\/blog\/wp-content\/uploads\/2020\/01\/build-your-own-cloud-with-fedora-31-and-nextcloud-server.png\" alt=\"\" class=\"wp-image-29619\" width=\"171\" height=\"442\" \/><\/figure>\n<\/div>\n<h3>Using the command line<\/h3>\n<p>From the command line, just enter the following, substituting the values you used when you created a dedicated Nextcloud user in MariaDB earlier:<\/p>\n<pre class=\"wp-block-preformatted\"># sudo -u apache php occ maintenance:install --data-dir \/var\/www\/html\/nextcloud\/data\/ --database \"mysql\" --database-name \"nextcloud\" --database-user \"nc_admin\" --database-pass \"DB_SeCuRe_PaSsWoRd\" --admin-user \"admin\" --admin-pass \"Admin_SeCuRe_PaSsWoRd\"<\/pre>\n<h2>Final Notes<\/h2>\n<ul>\n<li>I used the <em>http<\/em> protocol, but Nextcloud also works over <em>https<\/em>. I might write a follow-up about securing Nextcloud in a future article.<\/li>\n<li>I disabled SELinux, but your server will be more secure if you configure it.<\/li>\n<li>The recommend PHP memory limit for Nextcloud is 512M. To change it, edit the <em>memory_limit<\/em> variable in the <em>\/etc\/php.ini<\/em> configuration file and restart your <em>httpd<\/em> service.<\/li>\n<li>By default, the web interface can only be accessed using the <em>http:\/\/localhost\/<\/em> URL. If you want to allow access using other domain names, <a rel=\"noreferrer noopener\" aria-label=\"you can do so by editing the \/var\/www\/html\/nextcloud\/config\/config.php file (opens in a new tab)\" href=\"https:\/\/help.nextcloud.com\/t\/adding-a-new-trusted-domain\/26\" target=\"_blank\">you can do so by editing the <em>\/var\/www\/html\/nextcloud\/config\/config.php<\/em> file<\/a>. The * character can be used to bypass the domain name restriction and allow the use of any URL that resolves to one of your server&#8217;s IP addresses.<\/li>\n<\/ul>\n<pre class=\"wp-block-preformatted\">'trusted_domains' =&gt; array ( 0 =&gt; 'localhost', 1 =&gt; '*', ),<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nextcloud is a software suite for storing and syncing your data across multiple devices. You can learn more about Nextcloud Server&#8217;s features from https:\/\/github.com\/nextcloud\/server. This article demonstrates how to build a personal cloud using Fedora and Nextcloud in a few simple steps. For this tutorial you will need a dedicated computer or a virtual machine [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":108155,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[899,45,61,637,46,47,900],"class_list":["post-108154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fedora-os","tag-could","tag-fedora","tag-fedora-project-community","tag-file-sharing","tag-magazine","tag-news","tag-nextcloud"],"_links":{"self":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/108154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/comments?post=108154"}],"version-history":[{"count":0,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/posts\/108154\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media\/108155"}],"wp:attachment":[{"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/media?parent=108154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/categories?post=108154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sickgaming.net\/blog\/wp-json\/wp\/v2\/tags?post=108154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}