<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by David Adrián Cañones on Medium]]></title>
        <description><![CDATA[Stories by David Adrián Cañones on Medium]]></description>
        <link>https://medium.com/@dcanones?source=rss-7a5220cb57d3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2pR6aXOhz0l6CAi5I8c6-A.jpeg</url>
            <title>Stories by David Adrián Cañones on Medium</title>
            <link>https://medium.com/@dcanones?source=rss-7a5220cb57d3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 17:26:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dcanones/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The definitive guide to Python virtual environments with conda ]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/datatau/the-definitive-guide-to-python-virtual-environments-with-conda-aa321bc03780?source=rss-7a5220cb57d3------2"><img src="https://cdn-images-1.medium.com/max/2600/1*CjO8lpH_M88CnqAYlyBMTA.jpeg" width="4430"></a></p><p class="medium-feed-snippet">Master Python virtual environments with conda, once and for all</p><p class="medium-feed-link"><a href="https://medium.com/datatau/the-definitive-guide-to-python-virtual-environments-with-conda-aa321bc03780?source=rss-7a5220cb57d3------2">Continue reading on DataTau »</a></p></div>]]></description>
            <link>https://medium.com/datatau/the-definitive-guide-to-python-virtual-environments-with-conda-aa321bc03780?source=rss-7a5220cb57d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa321bc03780</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[virtual-enviroment]]></category>
            <category><![CDATA[anaconda]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[David Adrián Cañones]]></dc:creator>
            <pubDate>Mon, 07 Jun 2021 11:08:03 GMT</pubDate>
            <atom:updated>2021-06-07T11:12:30.589Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[The online courses you must take to be a better Data Scientist]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/datatau/the-online-courses-you-must-take-to-be-a-better-data-scientist-36a06016c819?source=rss-7a5220cb57d3------2"><img src="https://cdn-images-1.medium.com/max/2000/0*-Er6wXUxBHOvUoX-" width="2000"></a></p><p class="medium-feed-snippet">There are lots of them but&#x2026; which ones to choose?</p><p class="medium-feed-link"><a href="https://medium.com/datatau/the-online-courses-you-must-take-to-be-a-better-data-scientist-36a06016c819?source=rss-7a5220cb57d3------2">Continue reading on DataTau »</a></p></div>]]></description>
            <link>https://medium.com/datatau/the-online-courses-you-must-take-to-be-a-better-data-scientist-36a06016c819?source=rss-7a5220cb57d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/36a06016c819</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[David Adrián Cañones]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 09:42:43 GMT</pubDate>
            <atom:updated>2020-07-03T08:19:50.216Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Hadoop with Python: PySpark]]></title>
            <link>https://medium.com/datatau/hadoop-with-python-pyspark-a65a6f97ddf2?source=rss-7a5220cb57d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a65a6f97ddf2</guid>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[David Adrián Cañones]]></dc:creator>
            <pubDate>Mon, 25 May 2020 12:40:27 GMT</pubDate>
            <atom:updated>2020-05-25T12:58:10.438Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hadoop with Python (I): PySpark</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s1mIggZLeE1tpHSVYPHIfA.jpeg" /><figcaption>Big Data Cluster</figcaption></figure><h3>Introduction</h3><p>This is the first part of a series of posts about how to leverage <a href="https://hadoop.apache.org/">Hadoop</a> (the Distributed Computing Framework) using Python.</p><p>The goal of this series of posts is to focus on <strong>specific tools and recipes</strong> to solve recurrent challenges many Data professionals face, for example:</p><ul><li><strong>Moving HDFS</strong> (Hadoop Distributed File System) <strong>files</strong> using Python.</li><li><strong>Loading Data from HDFS</strong> into a Data Structure like a <strong>Spark</strong> or <strong>pandas</strong> DataFrame in order to make calculations.</li><li><strong>Write</strong> the <strong>results</strong> of an analysis back to HDFS.</li></ul><p>First tool in this series is <a href="https://spark.apache.org/">Spark</a>. A framework which defines itself as a unified analytics engine for large-scale data processing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*joUH0iKdfCNTfUE1.png" /><figcaption>Apache Spark</figcaption></figure><h3>PySpark and findspark installation</h3><blockquote>I encourage you to use <a href="https://docs.conda.io/en/latest/"><strong>conda</strong></a> virtual environments. If you don’t know how to set up conda, please read <a href="https://medium.com/datatau/the-definitive-data-scientist-environment-setup-a7fd49f944fb">this</a> post.</blockquote><p>First of all, install findspark, a library that will help you to integrate Spark into your Python workflow, and also pyspark in case you are working in a local computer and not in a proper Hadoop cluster.</p><p><strong>If you are following this tutorial in a Hadoop cluster, can skip PySpark install</strong>.</p><pre>conda install -c conda-forge findspark -y</pre><pre># optional, for local setup<br>conda install -c conda-forge pyspark openjdk -y</pre><h3>Spark setup with findspark</h3><p>Once you install findspark, it is time to setup Spark for usage in your Python code.</p><p>Code for both <strong>local</strong> and <strong>cluster</strong> mode is provided here, uncomment the line you need and adapt paths depending on your particular infrastructure and library versions (cloudera Spark path should be pretty similar to the one provided here):</p><pre><strong>import</strong> findspark</pre><pre><em># Local Spark<br>findspark.init(‘/home/cloudera/miniconda3/envs/&lt;your_environment_name&gt;/lib/python3.7/site-packages/pyspark/’)</em></pre><pre><em># Cloudera Cluster Spark<br></em>findspark.init(spark_home=’/opt/cloudera/parcels/SPARK2–2.3.0.cloudera4–1.cdh5.13.3.p0.611179/lib/spark2/’)</pre><blockquote>This tutorial have been written using Cloudera Quickstart VM (a CentOS linux distribution with an username called cloudera), remember to adapt paths to your infrastructure!</blockquote><h3>Creating a Spark application</h3><p>Once Spark is initialized, we have to create a Spark application, execute the following code, and make sure you <strong>specify the master you need</strong>, like &#39;yarn&#39; in the case of a proper Hadoop cluster, or &#39;local[*]&#39; in the case of a fully local setup:</p><pre><strong>from</strong> pyspark.sql <strong>import</strong> SparkSession<br>spark = SparkSession.builder.appName(‘example_app’).master(‘yarn’).getOrCreate()</pre><h3>PySpark Recipes and Use Cases</h3><p>Once we have our working Spark, let’s start interacting with Hadoop taking advantage of it with some common use cases.</p><h4>Listing Hive databases</h4><p>Let’s get existing databases. I assume you are familiar with Spark DataFrame API and its methods:</p><pre>spark.sql(&quot;show databases&quot;).show()</pre><p>You should get something like this:</p><pre>+------------+ <br>|databaseName| <br>+------------+ <br>|         db1| <br>|     default| <br>|     fhadoop| <br>+------------+</pre><h4>Transform pandas DataFrame into a Spark DataFrame</h4><p>First integration is about how to move data from pandas library, which is Python standard library to perform in-memory data manipulation, to Spark.</p><p>First, let’s load a pandas DataFrame. This one is about <strong>Air Quality in Madrid</strong> (just to satisfy your curiosity, but not important with regards to moving data from one place to another one). You can download it <a href="https://www.kaggle.com/decide-soluciones/air-quality-madrid">here</a>. Make sure you install the library pytables to read hdf5 formatted data.</p><pre><strong>import</strong> pandas <strong>as</strong> pd</pre><pre>air_quality_df = pd.read_hdf(‘data/air_quality/air-quality-madrid/madrid.h5’, key=’28079008&#39;) <br>air_quality_df.head()</pre><p>This data is a time series for many well known pollutants like NOX, Ozone, and more:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QerdAmxGouvRd-H4eaOD0g.png" /></figure><p>Let’s make some changes to this DataFrame, like resetting datetime index to avoid losing information when loading into Spark. Datetime column will also be transformed to string as Spark has some issues working with dates (related to system locale, timezones, and so on) unless further configuration depending on your locale.</p><pre>air_quality_df.reset_index(inplace=<strong>True</strong>) <br>air_quality_df[‘date’] = air_quality_df[‘date’].dt.strftime(‘%Y-%m-%d %H:%M:%S’)</pre><p>We can simply load from pandas to Spark with createDataFrame:</p><pre>air_quality_sdf = spark.createDataFrame(air_quality_df)</pre><p>Once DataFrame is loaded into Spark (as air_quality_sdf here), can be manipulated easily using PySpark DataFrame API:</p><pre>air_quality_sdf.<strong>select</strong>(&#39;date&#39;, &#39;NOx&#39;).show(5)</pre><p>Output should look like this:</p><pre>+— — — — — — — — — -+ — — — — — — — — — + <br>|               date|                NOx| <br>+ — — — — — — — — — + — — — — — — — — — + <br>|2001–07–01 01:00:00|             1017.0| <br>|2001–07–01 02:00:00| 409.20001220703125| <br>|2001–07–01 03:00:00| 143.39999389648438| <br>|2001–07–01 04:00:00|  149.3000030517578| <br>|2001–07–01 05:00:00| 124.80000305175781| <br>+ — — — — — — — — — + — — — — — — — — — + <br>only showing top 5 rows</pre><h4>Create Hive table from Spark DataFrame</h4><p>To persist a Spark DataFrame into HDFS, where it can be queried using default Hadoop SQL engine (Hive), one straightforward strategy (not the only one) is to create a temporal view from that DataFrame:</p><pre>air_quality_sdf.createOrReplaceTempView(&quot;air_quality_sdf&quot;)</pre><p>Once the temporal view is created, it can be used from Spark SQL engine to create a real table using create table as select. Before creating this table, I will create a new database called analytics to store it:</p><pre>sql_create_database = &quot;&quot;&quot;<br>create database if not exists analytics<br>location &#39;/user/cloudera/analytics/&#39;<br>&quot;&quot;&quot;</pre><pre>result_create_db = spark.sql(sql_create_database)</pre><p>Then, we can create a new table there:</p><pre>sql_create_table = &quot;&quot;&quot; <br>create table if not exists analytics.pandas_spark_hive <br>using parquet as select <br>to_timestamp(date) as date_parsed, * <br>from air_quality_sdf<br>&quot;&quot;&quot;</pre><pre>result_create_table = spark.sql(sql_create_table)</pre><h4>Reading data from Hive table using PySpark</h4><p>Once we have created our Hive table, can check results using Spark SQL engine to load results back, for example to select ozone pollutant concentration over time:</p><pre>spark.sql(&quot;select * from analytics.pandas_spark_hive&quot;) \ .select(&quot;date_parsed&quot;, &quot;O_3&quot;).show(5)</pre><p>Output :</p><pre>+ — — — — — — — — — + — — — — — — — — — + <br>| date_parsed       |                O_3| <br>+ — — — — — — — — — + — — — — — — — — — + <br>|2001–07–01 01:00:00|  9.010000228881836| <br>|2001–07–01 02:00:00|  23.81999969482422| <br>|2001–07–01 03:00:00| 31.059999465942383| <br>|2001–07–01 04:00:00| 23.780000686645508| <br>|2001–07–01 05:00:00| 29.530000686645508| <br>+ — — — — — — — — — + — — — — — — — — — + <br>only showing top 5 rows</pre><p>Hope you liked this post. In the next weeks we will release a series of posts with alternative tools you can use to master Hadoop with Python.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a65a6f97ddf2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatau/hadoop-with-python-pyspark-a65a6f97ddf2">Hadoop with Python: PySpark</a> was originally published in <a href="https://medium.com/datatau">DataTau</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Definitive Data Scientist Environment Setup]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/datatau/the-definitive-data-scientist-environment-setup-a7fd49f944fb?source=rss-7a5220cb57d3------2"><img src="https://cdn-images-1.medium.com/max/1280/0*G7OW3dvjrNHWeJIW.jpg" width="1280"></a></p><p class="medium-feed-snippet">Learn how to setup the definitive hardware and software environment to make Data Science.</p><p class="medium-feed-link"><a href="https://medium.com/datatau/the-definitive-data-scientist-environment-setup-a7fd49f944fb?source=rss-7a5220cb57d3------2">Continue reading on DataTau »</a></p></div>]]></description>
            <link>https://medium.com/datatau/the-definitive-data-scientist-environment-setup-a7fd49f944fb?source=rss-7a5220cb57d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7fd49f944fb</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[David Adrián Cañones]]></dc:creator>
            <pubDate>Mon, 04 May 2020 10:00:00 GMT</pubDate>
            <atom:updated>2020-06-17T09:18:47.214Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Save money self-hosting your own apps]]></title>
            <link>https://medium.com/datatau/save-money-self-hosting-your-own-apps-857ff0a31f00?source=rss-7a5220cb57d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/857ff0a31f00</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[David Adrián Cañones]]></dc:creator>
            <pubDate>Sat, 01 Jun 2019 12:00:00 GMT</pubDate>
            <atom:updated>2020-05-05T15:54:10.697Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Data center" src="https://cdn-images-1.medium.com/max/1024/0*Vq4zv5qra2XT-_mm.jpg" /><figcaption>Data center</figcaption></figure><h3>Why self-hosting</h3><p><strong>If you are running an app or website</strong>, are probably familiar with VPS (virtual private servers) and hosting providers. A mid-tier server in Linode, AWS Lightsail or DigitalOcean can cost between 40 and 80$/month.</p><p>If you are a human, probably likes listening to music, watching some TV shows, and saving your personal and important files in a cloud service. It means paying subscriptions to Spotify, Netflix, and if you are serious about storage, Dropbox or a similar service.</p><p>Adding up all that costs, you are paying every month, let’s say, about <strong>100$</strong>. However, you probably have some old laptop or even a decent workstation at home that is wasted most of the time. In this article I will show you how to implement a self-hosted home infrastructure for your personal projects and even how to replace some popular services like Spotify, Netflix or Dropbox with self-hosted alternatives.</p><p>Not everything is nice about self-hosting. Here you have the main advantages and drawbacks it has in my opinion:</p><p><strong>Advantages</strong>:</p><ul><li>Saving money</li><li>Reuse old stuff and giving it a second life</li><li>You will learn a lot (believe me)</li><li>You will own your data</li></ul><p><strong>Disadvantages</strong>:</p><ul><li>You are not backed up by a corporation (some guarantees uptime SLA, etc.)</li><li>Your risk of failure is higher: many things can fail. May experience a blackout, your internet can fail because of your ISP company or building, your home router can fail, and adding.</li><li>You need the knowledge to manage all those things by yourself, or at least have the strength to learn on the way.</li></ul><h3>Self-hosted equivalents to popular services</h3><ul><li>VPS (AWS <a href="https://aws.amazon.com/lightsail/pricing/">Lightsail</a>, DigitalOcean, Linode): an <a href="https://twitter.com/TheGurusTeam/status/1127861689716703232">old desktop computer or laptop</a> you have.</li><li>Spotify: <a href="https://www.plex.tv/">Plex</a>. There are open source alternatives like Kodi, but I had no time to test it deeply, and Plex is very straightforward.</li><li>Netflix: Plex (I share an account with some friends, so I have to admit that I use it too).</li><li>Dropbox: <a href="https://nextcloud.com/">Nextcloud</a>.</li><li>GitHub (purchased by Microsoft): <a href="https://about.gitlab.com/">Gitlab</a>.</li></ul><h3>Misconceptions</h3><ul><li>“I can not secure an app with an SSL certificate if I host it at home”: false, SSL certificates are associated to a domain, not a particular IP, so you can serve your app over a dynamic IP and secure it, for example with a Let’s Encrypt certificate.</li><li>“I can only serve one app from home, using 80 or 443 port”: false, you can serve as much apps as your infrastructure can support from home. Using Nginx we serve various apps, as well as static websites like this blog or IndieHackers Madrid Meetup page.</li></ul><h3>My stack</h3><p>When I moved to Madrid (10/17), in the very beginning, was sharing an apartment with my roommates. As our internet connection was shared, I had no choice to self-host my services. Some people would be playing online games, others watching TV. I did not want to disturb or impact their experience disrupting internet connection and making complex configurations and port redirects.</p><p>Once I moved with my girlfriend (6/18), I slowly developed a fairly complex infrastructure, with several computers. It does not mean you have to copy it ‘as is’. Probably, most you need is just an old laptop to serve some web apps, or maybe a workstation you occasionally use as media center. <strong>This is the complete list of my infrastructure</strong>:</p><ul><li><a href="https://www.asus.com/Networking/RT-AC1200G-plus/"><strong>ASUS RT-AC1200G+ Router</strong></a>: one of my best acquisitions so far. Later in this post I will explain why <strong>a good Router</strong> is so important. I bought it secondhand for about 30€.</li><li><strong>Apps Server</strong>: an old Acer laptop from Pedro. It has 8GB RAM, a 4-core i7 processor and about 1Tb hard drive memory. We use it for projects we develop together under The Gurus brand. This blog is hosted there, as well as <a href="https://moderator-guru.com/">The Moderator Guru</a> and our scrapping process for High Speed Train tickets pricing project. A VPS with those features can cost up to 60$ per month. This laptop is up 24/7, so I also bought a plug-in energy monitor which measures energy consumption (KWh) for 10€ at Amazon.</li><li><strong>Raspberry Pi 3 Model B</strong>: a gift from my girlfriend (her best one so far). I use it as ssh entry point to my home infrastructure. It has a very low consumption (tough is not very powerful) and is up 24/7. Have a <strong>Nextcloud</strong> server running here with <em>serious</em> things like code repositories, documents, etc. I run Nextcloud using an external USB Toshiba HDD with 1Tb storage. An interesting usage of it is that is physically connected to my workstation trough ethernet and can use as a Wake-On-Lan device (to turn on my WS remotely).</li><li><strong>Analytics Workstation</strong>: this is my multipurpose WS. With 32GB RAM, a 4-core i5 processor, dual boot Linux/W10 (just for gaming), some HDDs and SSDs, and a powerful Nvidia GPU. It server the purpose of being a powerful machine to perform analytics tasks that a Data Scientist do (like training models and exploring data, running Jupyter server). It also runs a <strong>Plex</strong> server with all my media library, and a <strong>Nextcloud</strong> server for media sharing and easy access purposes.</li></ul><h3>How to…</h3><p>This is not intended to be a detailed guide with tons of bash commands about how to setup all this, but a general guidelines about what to do, best practices and more. I will link some interesting content from other blogs if I find it interesting from a technical point of view.</p><h3>1. Get a good internet connection</h3><p>If you are going to host your own services at home, make sure your connection can support it. Remember that the limitation when streaming music or video from home, or to serve an app fast is your upload speed. Most people focus on having high download speeds, but few people take care of upload (except if you are a gamer and make gameplays and live streams). My recommendation is going with a minimum of 50MB fiber symmetric connection. With less than that, or using old unstable DSL, your and your users experience will be damaged.</p><p>To test connection speed from your server, speedtest command line interface is a very useful tool, install it with the following command: sudo apt install speedtest-cli and test your download / upload speeds typing: speedtest</p><p><strong>My choice</strong>:</p><p>I use a 300Mb symmetric connection from a low cost ISP (and for the sake of transparency, I pays 43€ for a mobile connection of 23Gb and unlimited calls + 300Mb home internet).</p><h3>2. Get out of dual NAT (Carrier Grade NAT)</h3><p>You need a public IP. It does not matter if it is static (best option but expensive) or dynamic (most common option, not a problem). There is an option your ISP is assigning you a public IP shared with a lot of other customers (it is called dual NAT or CGNAT). You need to configure your internet service to get you out of dual NAT or Carrier Grade NAT, so you have your own public IP. This IP will probably be dynamic, it is, changing over time (when your router reboots it will be assigned a new public IP).</p><p>Going out of CGNAT, in my case (Pepephone) consisted on calling ISP technical service and took about a week to be completed.</p><h3>3. Get a domain</h3><p>In case you want to easily access your services from outside your home you will need a domain. If you want to host web apps used by many people you will be familiar with this. It is also very important to setup Nextcloud clients in your laptop or mobile phone.</p><p>Those domains can be configured to dynamically point to your public ip through a Dynamic DNS or DDNS service. There are some popular DDNS out there, like <a href="https://www.noip.com/">No-IP</a>, <a href="https://dyn.com/">dyndns</a> (now part of Oracle). Most of these services can integrate with your router so it automatically notice them when its public IP (dynamic) has changed, so those domains always point to your router.</p><p><strong>My choice</strong>:</p><p>Personally, I use a Dynamic DNS service integrated in my router and provided for free by Asus for its router buyers, so my domain looks like &lt;chosen_name&gt;.asuscomm.com. All our domains ( <a href="https://thegurus.tech/">The Gurus</a>, <a href="https://moderator-guru.com/">The Moderator Guru</a>, etc.) points to this domain using CNAME records.</p><h3>4. Get a decent router</h3><p>The default router that your ISP company ships to you when you sign up your contract is probably not the best option if you are serious about self-hosting and want some reliability. There are come popular brands our there like TP-Link, D-Link, and more… Have this in mind: routers are expensive. There are some requirements you need for your router:</p><ul><li><strong>Port Forwarding</strong>: It must be able to redirect traffic to certain IPs and ports (most routers can do this).</li><li><strong>Good wireless connectivity</strong>: It must have a reliable wireless. Specially if you can’t plug all your infrastructure to the router’s ethernet ports and have to rely on wireless networking. This is where most of modern routers supplied by ISP’s fail miserably. Don’t miss dual 2G/5G bands and lots and big antennas.</li><li><strong>Gigabit ethernet connection</strong>: Very important if you are going to serve web apps from home to the rest of the world with some traffic. You want your connection between your apps server and the router to be as fast as possible.</li><li><strong>NAT hairpin</strong>: to allow you to connect, for example to your Nextcloud server from your domain being at home. Without this feature (not all routers have this!) you will be able to access your services from work or the university library, but not from your very own network (yeah, this is counter-intuitive).</li><li><strong>Remote Management</strong>: Not mandatory, but a plus. Some routers have remote management capabilities, so you can check your network status, connect to management app from a web browser or a mobile app to open ports, redirect traffic and more.</li></ul><p><strong>My choice</strong>:</p><p>The one I can fully recommend is <strong>Asus</strong>, model <a href="https://www.asus.com/Networking/RT-AC1200G-plus/">ASUS RT-AC1200G+ Router</a> as said above. This model get all advanced features I needed. As I have the fiber modem integrated in my ISP router (a not so bad Sagemcom) I had to configure it to work in bridge mode, so it only acts as a fiber modem and letting my Asus router get all routing job.</p><h3>5. Get a computer/server</h3><p>Whether you want to host your own version of Netflix and Spotify, a blog or a web app with active users, you will need a computer. How powerful it is is not extremely important unless you have a huge user base with lots of concurrent active users. Most 4–5 years old laptops are more than suitable to host a web app, Nextcloud or Plex.</p><p>Take into account that power consumption is important, so if you go with an old powerful workstation your electricity bill will be considerable next time. To take control over it, can use a plug-in energy monitor.</p><p><strong>My choice</strong>:</p><p>We are using an old laptop from Pedro whose features are listed above. More than enough to move our apps, serve our blogs and perform web scrapping. It is connected through ethernet to the router.</p><h3>6. Install Ubuntu Server and setup ssh</h3><p>This is a very personal choice, but I have found over the years that the less time you spend managing small things and technical problems, the more time you can spend doing something productive, or just spending time with family and friends.</p><p>When it comes to server operating systems, the king is Ubuntu Server. There is lots of Linux distros and I am a big fan of many of them, but believe when I say that going with the standard is an advantage in this case. Whatever you need to do with your server, you will find lots of packages, lots of guides, tutorials and support all over the internet. There is also builtin snap integration, which is a kind of new system for installing apps that relies on virtual containers.</p><p>Many people hates snap, and about the same number of people love it. It is useful sometimes to install an app if you need to setup a database and install many things and on top of that, configure everything to work well together (like Nextcloud for example), as it makes it automatically for you and confine everything into a stand alone container.</p><p>If you don’t need a graphical interface, can go with Ubuntu Server, download it from <a href="https://www.ubuntu.com/download/server">here</a>. In other case, choose the flavour most suitable for you depending on your taste about graphical Linux desktops.</p><p>Once you got Ubuntu installed, install ssh server to connect remotely: sudo apt install openssh-server</p><p>If you have various servers at home, will have to configure a different ssh port for everyone. Default ssh port is 22, so you can use different ports (popular ones are 2222 onwards) and specify it editing configuration file: /etc/ssh/ sshd_config</p><p>Once you set your desired port, restart ssh service running: sudo service ssh restart</p><p>Last step:</p><ul><li>Remember to set a static IP for that computer in your router configuration and redirects port 22 (or whichever you set as ssh port) to that IP: port in your router port forwarding configuration.</li></ul><p><strong>My choice</strong>:</p><p>We have Ubuntu Server 18.04 running on our server. Moreover, we got latest LTS Ubuntu running on all our computers, with exception of Raspberry Pi (which runs Raspbian). For example, for laptop and workstations that needs a graphical interface I prefer Kubuntu, while Pedro prefer vanilla Ubuntu which is based on Gnome.</p><h3>7. Setup Nextcloud</h3><p><strong>Nextcloud</strong> is a app equivalent to Dropbox, made to store your files on your own cloud. It has tons of features and plugins, desktop apps for automatic syncing, mobile app to access your data on the go, pdf and pictures previews. You are not going to miss many features from 3rd party closed source apps.</p><p>You can install in Ubuntu as a snap like this: sudo snap install nextcloud</p><ul><li>The most difficult thing is make it work with <strong>external storage</strong>, for example an USB HDD, which is very important if you are setting up in a Raspberry Pi with a 16Gb SD (like me) or want to use that massive storage 3TB HDD you bought last Black Friday and not your SSD where the OS is installed. The best tutorial about performing Nextcloud installation using external storage so far I have found is <a href="https://ashgoodman.com/install-nextcloud-with-external-storage-as-primary-storage/">this</a> one, from Ashley Goodman.</li><li>You will also have to set http and <strong>https</strong> (very important, in case you don’t want your data to be accessed by 3rd parties while transferring from and to the server). There is a detailed explanation about how to do this using snap installation <a href="https://github.com/nextcloud/nextcloud-snap">here</a>.</li><li>In case you need to perform further configuration, like allowing connections from your domain name and more, remember that Nextcloud snap config file is in path /var/snap/nextcloud/current/nextcloud/config/config.php, and that after changing config you need to restart that snap: sudo snap restart nextcloud</li></ul><h3>8. Setup Plex Media Server</h3><p><strong>Plex</strong> is a media server app that makes easy accessing your media library wherever you are. It has apps for the following platforms:</p><ul><li>Mobile: though have to pay about 5$ for unlocking it (otherwise streaming will be limited to 1 minute). Available for Android and iOS.</li><li>Web: free.</li><li>TV: free.</li></ul><p>To install Plex on Ubuntu runs: sudo snap install plexmediaserver.</p><p>Setting up Plex is fairly easy as it is designed to be used by non technical people. Just open your web browser and go to your server ip and 32400 port. There you can config as much as you need about Plex, including changing port, adding folders to your library.</p><p>The most interesting thing about Plex is that automatically manage remote connection to your server (even creates some kind of bridge or indirect connection in case you don’t have your router configured properly to allow external connections). All you need is a Plex account.</p><p>Take into account that Plex runs over port 32400, so you will need to configure port forwarding in your router to allow direct connection to your Plex server (you want good streaming speeds!).</p><h3>9. Setup Gitlab</h3><p>Nowadays, most people uses <a href="https://github.com/">GitHub</a>. There is nothing wrong with GitHub, we use it too at The Gurus ( <a href="https://github.com/TheGurus">this</a> is ours). If you want to get noticed and want your public repositories to be found by many people, GH is certainly the best solution.</p><p>Nevertheless, there are some problems with GitHub. The first one, and this is very opinionated, is that is part of Microsoft. It may be or not a problem for you, but the idea of having your code and private repositories accessible by a company which makes money making software is not appealing to me.</p><p><a href="https://about.gitlab.com/">GitLab</a> is an alternative you can self-host at home. The good thing is that it offers much more than just a git server (Continuous Integration capabilities, etc.). You can install in Ubuntu following <a href="https://about.gitlab.com/install/#ubuntu">these</a> instructions.</p><h3>10. Setup Nginx</h3><p><a href="https://www.nginx.com/">Nginx</a> defines itself as a high performance web server. You can use it to serve web apps from your home infrastructure. Those webs can be fully featured web apps (using, for example PHP, Python or JavaScript to communicate with a Database and perform complex operations in the background), or just a bunch of static files in a folder (like for example, this blog). Install it in Ubuntu typing: sudo apt install nginx.</p><p>With Nginx, you can have different domains and serve different webs from home <strong>at the same time</strong>. Nginx full configuration is massive and out of the scope of this post, but we will provide the configuration we use to serve this blog, so you can reuse it for example to host a simple blog like this one. In case you are interested, <a href="https://thegurus.tech/">https://thegurus.tech</a> blog, where I originally published this article is open source, and you can find repo <a href="https://github.com/TheGurus/thegurus">here</a>, but we will make a post about it in the future:</p><pre>server {</pre><pre>if ($host = <a href="http://www.thegurus.tech/">www.thegurus.tech</a>) {<br>      return 301 <a href="https://thegurus.tech$request_uri/">https://thegurus.tech$request_uri</a>;<br>    } # seo and security</pre><pre>root /home/ubuntu/projects/thegurus/blog/output;</pre><pre>index index.html;<br>  error_page 404 /404.html;</pre><pre>server_name thegurus.tech <a href="http://www.thegurus.tech/">www.thegurus.tech</a>;</pre><pre>listen 443 ssl; # managed by Certbot<br>    ssl_certificate /etc/letsencrypt/live/thegurus.tech/fullchain.pem; # managed by Certbot<br>    ssl_certificate_key /etc/letsencrypt/live/thegurus.tech/privkey.pem; # managed by Certbot<br>    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot<br>    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot</pre><pre>}<br>server {<br>    if ($host = <a href="http://www.thegurus.tech/">www.thegurus.tech</a>) {<br>        return 301 <a href="https://$host$request_uri/">https://$host$request_uri</a>;<br>    } # managed by Certbot</pre><pre>if ($host = thegurus.tech) {<br>        return 301 <a href="https://$host$request_uri/">https://$host$request_uri</a>;<br>    } # managed by Certbot</pre><pre>listen 80;</pre><pre>server_name thegurus.tech <a href="http://www.thegurus.tech/">www.thegurus.tech</a>;<br>    return 404; # managed by Certbot<br>}</pre><p>In case you want to host another website, just change to your static files path, set up your own domain names and you are done.</p><p>In case you want to host a more complex app, for example a Python backend based (Django or Flask) like <a href="https://moderator-guru.com/">The Moderator Guru</a> you have to point to a socket and combine Nginx in the case of Python with a WSGI HTTP Server like <a href="https://gunicorn.org/">Gunicorn</a>.</p><h3>11. Bonus: Setup Wake on Lan</h3><p>As a bonus, I will teach you how to turn on your computer remotely. In case you are using a low consumption laptop or a Raspberry Pi board as server, you will not have to worry about energy consumption very much, but in case you are using an old desktop computer or laptop, or a powerful workstation is a good practice to turn it off while you are not using it actively.</p><p>As a WoL device I use a Raspberry Pi connected via ethernet to my workstation and the excellent app etherwake. You can install it in Ubuntu (or Debian based distributions like Raspbian) doing: sudo apt install etherwake, and turning on your computer with: sudo etherwake XX:XX:XX:XX:XX:XX, where that X placeholder stands for the particular computer MAC address.</p><blockquote><em>Originally published at </em><a href="https://thegurus.tech/"><em>https://thegurus.tech</em></a><em> and </em><a href="https://davidadrian.cc/"><em>https://davidadrian.cc</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=857ff0a31f00" width="1" height="1" alt=""><hr><p><a href="https://medium.com/datatau/save-money-self-hosting-your-own-apps-857ff0a31f00">Save money self-hosting your own apps</a> was originally published in <a href="https://medium.com/datatau">DataTau</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>