Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - Build your own cloud with Fedora 31 and Nextcloud Server

#1
Build your own cloud with Fedora 31 and Nextcloud Server

<div style="margin: 5px 5% 10px 5%;"><img src="https://www.sickgaming.net/blog/wp-content/uploads/2020/01/build-your-own-cloud-with-fedora-31-and-nextcloud-server.png" width="342" height="884" title="" alt="" /></div><div><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’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>
<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>
<h2>Step 1: Configure the server</h2>
<p>Start by updating your system and rebooting:</p>
<pre class="wp-block-preformatted">$ sudo -i
# dnf upgrade
# reboot</pre>
<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>
<pre class="wp-block-preformatted"># vi /etc/selinux/config
# reboot</pre>
<p>If you don’t want to reboot right away, you can use the <em>setenforce</em> command to disable SELinux in the current session.</p>
<pre class="wp-block-preformatted"># setenforce 0</pre>
<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>
<h2>Step 2: Install the prerequisites</h2>
<p>Before installing and configuring Nextcloud, a few prerequisites must be satisfied.</p>
<p>First, install Apache web server:</p>
<pre class="wp-block-preformatted"># dnf install httpd</pre>
<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’s requirements</a>:</p>
<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>
<p>After PHP is installed enable and start the Apache web server:</p>
<pre class="wp-block-preformatted"># systemctl enable --now httpd</pre>
<p>Next, allow <em>HTTP</em> traffic through the firewall:</p>
<pre class="wp-block-preformatted"># firewall-cmd --permanent --add-service=http<br /># firewall-cmd --reload</pre>
<p>Next, install the MariaDB server and client:</p>
<pre class="wp-block-preformatted"># dnf install mariadb mariadb-server</pre>
<p>Then enable and start the MariaDB server:</p>
<pre class="wp-block-preformatted"># systemctl enable --now mariadb</pre>
<p>Now that MariaDB is running on your server, you can run the <em>mysql_secure_installation</em> command to secure it:</p>
<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
current password for the root user. If you've just installed
MariaDB, and you haven't set the root password yet, the password
will be blank, so you should just press enter here. Enter current password for root (enter for none): <strong>&lt;ENTER&gt;</strong>
OK, successfully used password, moving on... Setting the root password ensures that nobody can log into
the MariaDB root user without the proper authorization. Set root password? [Y/n] <strong>&lt;ENTER&gt;</strong>
New password: <strong>Your_Password_Here</strong>
Re-enter new password: <strong>Your_Password_Here</strong> Password updated successfully! Reloading privilege tables... ... Success! By default, a MariaDB installation has an anonymous user,
allowing anyone to log into MariaDB without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother. You
should 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
root 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
anyone can access. This is also intended only for testing, and
should 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
made 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
MariaDB installation should now be secure. Thanks for using MariaDB!</pre>
<h2>Step 3: Install Nextcloud Server</h2>
<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>
<pre class="wp-block-preformatted"># wget https://download.nextcloud.com/server/re...17.0.2.zip
# unzip nextcloud-17.0.2.zip -d /var/www/html/</pre>
<p>Next, create a data folder and grant Apache read and write access to the <em>nextcloud</em> directory tree:</p>
<pre class="wp-block-preformatted"># mkdir /var/www/html/nextcloud/data
# chown -R apache:apache /var/www/html/nextcloud</pre>
<p>Next, create a dedicated user and database for your Nextcloud instance:</p>
<pre class="wp-block-preformatted"># mysql -p
&gt; create database nextcloud;
&gt; create user 'nc_admin'@'localhost' identified by 'SeCrEt';
&gt; grant all privileges on nextcloud.* to 'nc_admin'@'localhost';
&gt; flush privileges;
&gt; exit;</pre>
<h2>Step 4: Configure N<strong>extclou</strong>d</h2>
<p>Nextcloud can be configured using its web interface or from the command line.</p>
<h3>Using the web interface</h3>
<p>From your favorite browser, access <em>http://your_server_ip/nextcloud</em> and fill the&nbsp;fields:</p>
<div class="wp-block-image">
<figure class="aligncenter is-resized"><img 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>
</div>
<h3>Using the command line</h3>
<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>
<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>
<h2>Final Notes</h2>
<ul>
<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>
<li>I disabled SELinux, but your server will be more secure if you configure it.</li>
<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>
<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’s IP addresses.</li>
</ul>
<pre class="wp-block-preformatted">'trusted_domains' =&gt; array ( 0 =&gt; 'localhost', 1 =&gt; '*', ),</pre>
</div>


https://www.sickgaming.net/blog/2020/01/...ud-server/
Reply



Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum software by © MyBB Theme © iAndrew 2016