<?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 Dhananja Kariyawasam on Medium]]></title>
        <description><![CDATA[Stories by Dhananja Kariyawasam on Medium]]></description>
        <link>https://medium.com/@dhananjak?source=rss-531e1523cebe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*p96tZu-MVt4ssmZmgD_ZAQ.jpeg</url>
            <title>Stories by Dhananja Kariyawasam on Medium</title>
            <link>https://medium.com/@dhananjak?source=rss-531e1523cebe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 22:49:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dhananjak/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[Install Homebrew on M1 Macbook]]></title>
            <link>https://dhananjak.medium.com/install-homebrew-on-m1-macbook-ce3a0232c19d?source=rss-531e1523cebe------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce3a0232c19d</guid>
            <dc:creator><![CDATA[Dhananja Kariyawasam]]></dc:creator>
            <pubDate>Wed, 06 Jan 2021 06:56:29 GMT</pubDate>
            <atom:updated>2021-01-30T14:10:27.516Z</atom:updated>
            <content:encoded><![CDATA[<p>Homebrew is a handy package manager for MacOS as well as for the Linux. When it comes to MacOS, by default it’s missing. So you need to install it manually on your Mac.</p><p>When it comes to Apple Intel Chip, Installing Homebrew in Intel-based Macs is straightforward and your need run below command in your terminal,</p><pre>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</pre><p>But if you running above command on the Apple Silicon M1 chip MacBook Air or Pro, you will get below error,</p><pre>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&quot;<br><br>Homebrew is not (yet) supported on ARM processors!<br>Rerun the Homebrew installer under Rosetta 2.<br>If you really know what you are doing and are prepared for a very broken experience you can use another installation option for installing on ARM:<br>  <a href="https://docs.brew.sh/Installation">https://docs.brew.sh/Installation</a></pre><p>So, After struggling couple of hours, I found couple of ways to install the Homebrew on Apple Silicon M1 chip.</p><h3>1 . Run the Homebrew installer under Rosetta 2</h3><p>If you to know more about Rosetta 2, click <a href="https://developer.apple.com/documentation/apple_silicon/about_the_rosetta_translation_environment">here</a> to read more about the Rosetta 2 and here I’ll about the Rosetta. Basically, Rosetta is a translation process that allows users to run apps that contain x86_64 instructions on Apple silicon. Rosetta was introduced when Apple’s hardware transitioned from Power-PC-based to Intel-based CPUs.</p><p>Usually It doesn’t come with macOS Big Sur. So you need to install it manually. To install Rosetta, run below command in your terminal.</p><pre>softwareupdate --install-rosetta</pre><p>Once you complete the Rosetta installation, run below command to install the Homebrew.</p><pre>arch -x86_64 /bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&quot;</pre><p>After the installation is completed, you can update the packages with Homebrew. always make sure to use <em>arch -x86_64</em> before the command.</p><pre>arch -x86_64 brew update</pre><h3>2 . Run Terminal using Rosetta</h3><p>This is the easiest ways to install home brew, First go to Application &gt; Utilities and right click on Terminal and click Get Info and tick Open using Rosetta.</p><p>Add alt text</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/0*CGjlc8qSaopvKxve" /></figure><p>Now your can run install command without mentioning the architecture.</p><pre>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</pre><h3>Extra</h3><p>On that link below you can confirm what are packages that are optimized for Apple Silicon so far.</p><p><a href="https://isapplesiliconready.com/app/Homebrew">https://isapplesiliconready.com/app/Homebrew</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce3a0232c19d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Secure Apache with Let’s Encrypt Free SSL Certificate]]></title>
            <link>https://dhananjak.medium.com/secure-apache-with-lets-encrypt-free-ssl-certificate-8d1d807f5bd6?source=rss-531e1523cebe------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d1d807f5bd6</guid>
            <category><![CDATA[ssl-certificate]]></category>
            <category><![CDATA[ssl]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[lets-encrypt]]></category>
            <category><![CDATA[apache]]></category>
            <dc:creator><![CDATA[Dhananja Kariyawasam]]></dc:creator>
            <pubDate>Tue, 14 Nov 2017 04:57:36 GMT</pubDate>
            <atom:updated>2020-04-14T17:58:00.714Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*M50NMpptK5MUH4eKnuPpPQ.png" /></figure><p>If you are looking SSL certification for your web server to ensure privacy in communication, Let’s encrypt is the best option you have and It’s a totally free, automated, and open Certificate Authority which facilitates you in acquiring free SSL/TLS certificates needed for secure web browsing and they provide Domain Validated (DV SSL) certificate for free.</p><p>This tutorial will guide you on how can install the Free SSL certificate on your web server and this guide based on CentOS 7 operating system and the same you can apply on RedHat also.</p><p><strong>Basic Requirements</strong></p><p>A public registered domain name (Domain name “A” record should be pointed to the server IP)</p><p>Apache webserver and SSL module installed on Centos 7</p><p>SSH client to access the Server (Here I used Putty as SSH client)</p><p>Step 1: Install Apache and mod_ssl module</p><p>First, you need to connect your server locally or SSH and switch your user account to Root user.</p><blockquote><em># su — { to switch the user account to root}</em></blockquote><p>If you don’t have Apache and mod_ssl on your server, run following command in terminal to install the Apache.</p><blockquote><em>#yum install –y httpd mod_ssl</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/0*WfMSV6vKwvbTpjKg." /></figure><p>Once the apache and mod_ssl installation is done, run following command to start the service and enable as boot up service.</p><blockquote><em>#systemctl start httpd</em></blockquote><blockquote><em>#systemctl enable httpd</em></blockquote><p>To check the server is get stared, run below command to verify the status of Apache and it will list up all associated processors.</p><blockquote><em>#systemctl status httpd</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/0*YcYpId647reqXB0L." /></figure><p>Step 2: Create a sample web site</p><p>Now our Apache web server up and running and its fresh installation and don’t have a configured web server. Hence, need create a sample website for our testing purpose and either you can create a sample website by following commands or you can upload your own website to <em>/var/www/html</em> document root directory.</p><blockquote><em># echo “SSL Testing” &gt; /var/www/html/index.html</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/0*kAx7qKJLIIR37aYx." /></figure><p>Step 3: Configuring Firewall</p><p>CentOS 7 has a local Linux firewall and need to allow http and https traffic go through that firewall. Otherwise, it will block all incoming and outgoing traffic on your web server except SSH traffic.</p><p>You can check whether firewall is up or not by running following command.</p><blockquote><em>#systemctl status firewalld</em></blockquote><p>If is it not enable by default, you run following two commands to start and enable the <em>firewalld</em>service.</p><blockquote><em>#systemctl start firewalld</em></blockquote><blockquote><em>#systemctl enable firewalld</em></blockquote><p>Once you start the <em>firewalld</em> service, you need to allow https and https traffic on your server. You can execute following commands to allow the traffic.</p><blockquote><em>#firewall-cmd — zone=public –add-service=http –permanent</em></blockquote><blockquote><em>#firewall-cmd — zone=public –add-service=https –permanent</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*4oIz7YHlUlBQFpgP." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/0*crNTnTDoQ6mkkOS7." /></figure><p>After that to apply these two firewall rules, need to reload the <em>firewalld</em> service on your server,</p><blockquote><em>#firewall-cmd –reload</em></blockquote><blockquote><em>#firewall-cmd –list-all</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/0*7Q9rmR7TRehe_Ygo." /></figure><p>At this point, we are ready to check our web server and we just want to check it’s up and running. Open up your web browser and type your domain name and hit enter. It will give you output as you expected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/0*hyCqR8hn_lHht1zx." /></figure><p>If you tried to access with https, it will ask to install the self-sign certificate on your web browser and you can add an exception and continue to your website. But here ignore it and move to the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/0*l38WoNHx8e3w7CzL." /></figure><p>Step 4: Install epel-release and Certbot application</p><p>Let’s encrypt is required Certbot application to install the SSL certification and to install Certbot package, need add <em>epel release</em> repository on your server. Run below command in your terminal to install epel the repository.</p><blockquote><em># yum install -y epel-release</em></blockquote><p>Now we have added epel repository and you can go ahead and install Certbot package.</p><blockquote><em>#yum install -y certbot</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/0*xduWqJWj_wQC6DMX." /></figure><p>Certbot application has few different plugins that allow you to automatically update your configuration for the web server that you are using. Hence, we using apache web server and need to install Apache Certbot plugin. You can search right package using following command,</p><blockquote><em>#yum search certbot</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*R6AOnKbiusdx8xiL." /></figure><p>After that you can install exact package as you required.</p><blockquote><em>#yum install -y python2-certbot-apache</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/0*M5VPOF8dxCn3D9DE." /></figure><p>Step 5: Install Let’s encrypt SSL certification</p><p>Now let’s start to configure SSL with your domain name and here we are going use <em>Certbot</em>command to configure the domain with apache. Your run below command to start the SSL configuration.</p><blockquote><em>#certbot –apache -d (your domain name)</em></blockquote><p>Then hit enter and it will ask few questions and you have answer each question to complete this process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/0*Ccf753y3mTeO8HD6." /></figure><p>Enter your email and hit enter key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/0*mLS-Z8KMGG59iyC8." /></figure><p>Read the term of the service and type “A” to agree with that and hit enter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/0*YT5AbT5NwWF4dFqr." /></figure><p>Type “N” and hit enter, if you are want share your email address, you can go with Yes option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/0*vxaXvBTL6YNkyaxm." /></figure><p>Here the Certbot utility trying figure out where the Apache configuration files are store and it’s asking where exactly we want to put it. We have only one option right now and type “1” and hit enter to continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/0*8m1Rpe_9VT7gBzIh." /></figure><p>Again it will ask same question and do the same as earlier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/0*apKx5oizZFWbYylS." /></figure><p>Now it will ask to choose two options to select and here you go with “secure” option because it will redirect all http traffic to https.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/0*0zdsiiUPwpbZZzwm." /></figure><p>When you are done the answering to these questions, you will get an output as below. And you will able to find out all configuration files related to let’s encrypt on <em>/etc/letsencrypt/live</em>directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*H9TbjD28NvCLjK58." /></figure><p>Now you can verify SSL certificate with your web browser and open up the browser and go to your website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/0*PwmRS8ECU8IbF6L_." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/0*18E4xi7v_j40T2Pl." /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/0*yxuQOqU-6_Sgxeq_." /></figure><p>Step 6: SSL Certificate renewal</p><p>SSL certificate issued by Let’s encrypt valid only for 90 days. So you have to renew it after 90 days and you can use “certbot renew” command to renew the SSL certification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/0*7gJuxHovMTLVVHww." /></figure><p>There are couple of automated ways to handle SSL certificate renewal and you choose one of this option to renew your certificate.</p><p>One way is to create a <em>CronJob</em> and to create <em>CronJob </em>you can run “crontab –e” in your terminal and enter below command and save it.</p><blockquote><em>#crontab -e</em></blockquote><blockquote><em>#SSL Cert Renew</em></blockquote><blockquote><em>0 0 * * * /usr/bin/certbot renew &amp;&gt; /var/log/certbotrenew.log</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*sQmqhlMiMZKYWnyL." /></figure><p>To save the cronjob, hit “esc” and type “:wq!” and hit enter key. And you can verify that scheduled cronjob by running below command.</p><blockquote><em>#crontab -l</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/0*2lMKpYQq5gMcBQ-L." /></figure><p>The second way to automatically schedule renewal using systemd timers and certbot package included certbot-renew systemd service. So you can enable this service by executing below commands.</p><blockquote><em>#systemctl enable certbot-renew.service</em></blockquote><blockquote><em>#systemctl start certbot-renew.service</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/0*TNzQpdHo6zkdGRMC." /></figure><p>After that you need to enable <em>systemd timer</em> and run following command to enable it.</p><blockquote><em>#systemctl enable certbot-renew.timer</em></blockquote><blockquote><em>#systemctl start certbot-renew.timer</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y6rKgSAyi6DwdPIY." /></figure><p>And you can check the timers by running below command.</p><blockquote><em>#systemctl list-timers</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/0*Nh_ZghVRifY9_Xbj." /></figure><p>Finally we have done the free SSL certificate installation and if you have further question regarding to this tutorial feel free to ask in comment section.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d1d807f5bd6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>