<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Samuel Opoku Asare</title>
    <description>The latest articles on DEV Community by Samuel Opoku Asare (@nolimithendrix).</description>
    <link>https://dev.to/nolimithendrix</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F574047%2F968099a0-f879-401a-9c72-e4c77c61896a.jpeg</url>
      <title>DEV Community: Samuel Opoku Asare</title>
      <link>https://dev.to/nolimithendrix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nolimithendrix"/>
    <language>en</language>
    <item>
      <title>How To Create A New User And Assign Super User Privileges On Your Ubuntu Server</title>
      <dc:creator>Samuel Opoku Asare</dc:creator>
      <pubDate>Thu, 05 Dec 2024 14:50:15 +0000</pubDate>
      <link>https://dev.to/nolimithendrix/how-to-create-a-new-user-and-assign-super-user-privileges-on-your-ubuntu-server-3k2l</link>
      <guid>https://dev.to/nolimithendrix/how-to-create-a-new-user-and-assign-super-user-privileges-on-your-ubuntu-server-3k2l</guid>
      <description>&lt;p&gt;Whether you are a seasoned developer or a DevOps engineer, setting up a dedicated Ubuntu server is a common task when working with Infrastructure as a Service (IaaS) providers. One of the first things you'll need to do is create a new user and grant them superuser privileges. This guide will walk you through the process seamlessly. Before we proceed, ensure that you have already connected to your remote server via SSH.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a New User
&lt;/h2&gt;

&lt;p&gt;To begin, you will need to create a new user. This process is straightforward:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your terminal.&lt;/li&gt;
&lt;li&gt;Execute the following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;adduser &lt;span class="o"&gt;[&lt;/span&gt;user_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;[user_name]&lt;/code&gt; with your desired username. During this process, the system will prompt you to enter a password and other details such as the full name, room number, and more. Ensure you choose a strong password to maintain server security.&lt;br&gt;
&lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Assigning Superuser Privileges
&lt;/h2&gt;

&lt;p&gt;Once the new user is created, the next step is to grant them superuser privileges. This will allow the user to perform administrative tasks using the &lt;code&gt;sudo&lt;/code&gt; command.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run the following command:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; &lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;user_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Again, replace &lt;code&gt;[user_name]&lt;/code&gt; with the username you set up previously. This command adds the new user to the &lt;code&gt;sudo&lt;/code&gt; group, enabling them to execute commands with elevated privileges.&lt;/p&gt;

&lt;p&gt;And that's it—in just a few commands, you have successfully created a new user with superuser privileges on your Ubuntu server. This configuration will empower the user to perform critical tasks while maintaining a secure environment.&lt;/p&gt;

&lt;p&gt;Feel free to share your thoughts and experiences. If you want to learn more about similar topics, don't hesitate to check out my other work.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;More about the author &lt;a href="https://superhendrix.dev/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. &lt;br&gt;
Cover photo by &lt;a href="https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/" rel="noopener noreferrer"&gt;Tima Miroshnichenko&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>devops</category>
      <category>ubuntu</category>
      <category>terminal</category>
    </item>
    <item>
      <title>Hosting a Rails App on Ubuntu 20.04 with Nginx and Phusion Passenger: A Comprehensive Guide</title>
      <dc:creator>Samuel Opoku Asare</dc:creator>
      <pubDate>Mon, 02 Dec 2024 00:40:54 +0000</pubDate>
      <link>https://dev.to/nolimithendrix/hosting-a-rails-app-on-ubuntu-2004-with-nginx-and-phusion-passenger-a-comprehensive-guide-4jb8</link>
      <guid>https://dev.to/nolimithendrix/hosting-a-rails-app-on-ubuntu-2004-with-nginx-and-phusion-passenger-a-comprehensive-guide-4jb8</guid>
      <description>&lt;p&gt;In today's rapidly evolving software landscape, Platform as a Service (PaaS) offerings like Heroku have gained immense popularity for their convenience and ease of use. They allow developers to deploy applications without worrying about the intricacies of server management. However, this convenience often comes at a hefty price, making it a less attractive option for developers and small businesses operating on a tight budget.&lt;/p&gt;

&lt;p&gt;For those who prefer to maintain complete control over their application stack and want to avoid recurring PaaS costs, hosting a Rails app on a dedicated server remains a viable and cost-effective solution. Yet, finding reliable resources that guide you through the manual setup process can be daunting. This guide is designed for users who are ready to roll up their sleeves and dive into the intricacies of server management, bypassing the need for pricey service fees that come with PaaS. If you're someone who isn't afraid of getting your hands dirty and want to deploy a Rails app manually using Nginx and Phusion Passenger on Ubuntu 20.04, this detailed walkthrough is just what you need.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step-by-Step Guide to Host Your Rails App on Ubuntu
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Update System Packages
&lt;/h4&gt;

&lt;p&gt;Start by ensuring your system is up-to-date. This is crucial for security and stability.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Install RVM and Ruby
&lt;/h4&gt;

&lt;p&gt;Ruby Version Manager (RVM) is essential for managing Ruby installations and gemsets efficiently.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;curl gpg
curl &lt;span class="nt"&gt;-sSL&lt;/span&gt; https://get.rvm.io | bash &lt;span class="nt"&gt;-s&lt;/span&gt; stable
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.rvm/scripts/rvm
rvm &lt;span class="nb"&gt;install &lt;/span&gt;ruby
rvm use ruby &lt;span class="nt"&gt;--default&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Install Rails
&lt;/h4&gt;

&lt;p&gt;Once Ruby is installed, proceed to install Rails, the framework used to build your application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gem &lt;span class="nb"&gt;install &lt;/span&gt;rails
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  4. Install Node.js and Yarn
&lt;/h4&gt;

&lt;p&gt;Rails requires a JavaScript runtime like Node.js for its asset pipeline, and Yarn helps in managing JavaScript dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-sL&lt;/span&gt; https://deb.nodesource.com/setup_14.x | &lt;span class="nb"&gt;sudo&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; bash -
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; nodejs
npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--global&lt;/span&gt; yarn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  5. Install MySQL (or Your Preferred Database)
&lt;/h4&gt;

&lt;p&gt;Set up the database system of your choice; MySQL is used here for demonstration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;mysql-server libmysqlclient-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  6. Install and Configure Nginx
&lt;/h4&gt;

&lt;p&gt;Nginx will serve your Rails application to the web, providing fast and efficient delivery.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  7. Install Passenger
&lt;/h4&gt;

&lt;p&gt;Phusion Passenger is an application server that integrates seamlessly with Nginx to handle Ruby applications.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;dirmngr gnupg
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-key adv &lt;span class="nt"&gt;--keyserver&lt;/span&gt; hkps.pool.sks-keyservers.net &lt;span class="nt"&gt;--recv-keys&lt;/span&gt; 95C1DD26C60FA986 4B2C1C7E1088DA93
&lt;span class="nb"&gt;sudo &lt;/span&gt;sh &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s1"&gt;'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger focal main &amp;gt; /etc/apt/sources.list.d/passenger.list'&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;libnginx-mod-http-passenger
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Configuring Nginx and Passenger
&lt;/h4&gt;

&lt;p&gt;Edit your Nginx configuration to enable Passenger:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open Nginx's main configuration file &lt;code&gt;/etc/nginx/nginx.conf&lt;/code&gt; and uncomment the following line:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;   &lt;span class="k"&gt;include&lt;/span&gt; &lt;span class="n"&gt;/etc/nginx/passenger.conf&lt;/span&gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a server block for your Rails application in &lt;code&gt;/etc/nginx/sites-available/your_app_name.conf&lt;/code&gt;:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;   &lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;your_domain_or_IP&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="kn"&gt;root&lt;/span&gt; &lt;span class="n"&gt;/path/to/your/app/public&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="kn"&gt;passenger_enabled&lt;/span&gt; &lt;span class="no"&gt;on&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
     &lt;span class="kn"&gt;passenger_ruby&lt;/span&gt; &lt;span class="n"&gt;/usr/share/rvm/rubies/ruby-x.y.z/bin/ruby&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;# Update to your Ruby version&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Enable the site by creating a symbolic link:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /etc/nginx/sites-available/your_app_name.conf /etc/nginx/sites-enabled/
   &lt;span class="nb"&gt;sudo &lt;/span&gt;nginx &lt;span class="nt"&gt;-t&lt;/span&gt;
   &lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  SSL with Certbot
&lt;/h4&gt;

&lt;p&gt;Secure your site with SSL using Certbot, which automates the process of obtaining and renewing SSL certificates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install &lt;/span&gt;python3-certbot-nginx
&lt;span class="nb"&gt;sudo &lt;/span&gt;certbot &lt;span class="nt"&gt;--nginx&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;By following these steps, you bypass the high costs associated with PaaS solutions and gain complete control over your Rails application's deployment. This approach might require a bit more effort, but the freedom and cost savings are well worth it. If full ownership of your server environment sounds appealing, this guide empowers you to host your Rails app with confidence. Enjoy the flexibility and financial freedom that come with self-hosting your applications!``&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>devops</category>
      <category>ubuntu</category>
      <category>terminal</category>
    </item>
    <item>
      <title>Adding Custom Fonts In Expo React-Native.</title>
      <dc:creator>Samuel Opoku Asare</dc:creator>
      <pubDate>Fri, 10 Sep 2021 04:19:47 +0000</pubDate>
      <link>https://dev.to/nolimithendrix/adding-custom-fonts-in-expo-react-native-84c</link>
      <guid>https://dev.to/nolimithendrix/adding-custom-fonts-in-expo-react-native-84c</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;If you are a beginner to expo react-native there are a lot of things you might find very difficult doing and not to talk about unavailability of resources to help. These problems may include how to use custom fonts in your project.&lt;br&gt;
Do not worry. Here, I will try my very best to teach you the easiest way to do so.&lt;br&gt;
Expo by default supports all &lt;a href="https://fonts.google.com/" rel="noopener noreferrer"&gt;google fonts&lt;/a&gt;. You didn't pick your custom fonts from there? Well, there's still a way to use them in your projects. Let's learn how.&lt;/p&gt;
&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;A fair knowledge of react-native.&lt;/li&gt;
&lt;li&gt;A simple react native setup.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Adding Google Fonts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Install the font package by using the syntax &lt;em&gt;'expo install @expo-google-fonts/{name_of_font}'&lt;/em&gt;. In this example I will be using the &lt;a href="https://fonts.google.com/specimen/Montserrat?query=monts" rel="noopener noreferrer"&gt;montseratt font&lt;/a&gt;. So we can install with the command &lt;code&gt;expo install @expo-google-fonts/montserrat&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The code below demonstrates how you should add the font you just downloaded to your project.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'
import { Text, StyleSheet, View } from 'react-native'
import {useFonts, Montserrat_400Regular} from '@expo-google-fonts/montserrat'

export default function ExpoCustomFonts() {

    const [fontsLoaded] = useFonts({
        Montserrat_400Regular
    })

    if(!fontsLoaded){

        return null

    }else{

        return (
            &amp;lt;View style={styles.container}&amp;gt;

                &amp;lt;Text style={styles.text}&amp;gt;
                    Hello react native
                &amp;lt;/Text&amp;gt;

            &amp;lt;/View&amp;gt;
        )

    }

}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#fff',
        alignItems: 'center',
        justifyContent: 'center',
    },
    text: {
        fontSize: 32,
        fontFamily: 'Montserrat_400Regular', 
        color: "#1DA1F2",
    }
})

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  What's happening in the code?
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;From line 1 to line 3 we import all the resources needed for this project.&lt;/li&gt;
&lt;li&gt;In line 3, we import two things, the font style we want to use and a very important hook, the &lt;em&gt;useFonts&lt;/em&gt; hook, I will soon explain what this hook does. For now lets proceed.&lt;/li&gt;
&lt;li&gt;In line 5, we declare and export the component &lt;em&gt;ExpoCustomFonts&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Line 7 to line 9 is where all the fun begins, here we tell react-native to load our montseratt font. We do this by using the react hook; useFonts. Its job is to load a map of fonts and return the boolean true if it does so successfully or an error if it doesn't. We save the return value in the constant &lt;em&gt;fontsLoaded&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Finally, we check if our font was loaded successfully. If yes, we return a component containing the text styled with the montserrat font. If not, we return null. Certainly, this is not advisable in real world. In the real world, you would want to return a component which has not been styled with the custom font. This way, you indirectly tell react-native to use the default fonts provided on whichever platform your application will run on.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Adding any other font
&lt;/h3&gt;

&lt;p&gt;The steps in doing so is quite similar to what we did with the google fonts. Only in this case you direct react-native to where in the project structure you have fonts saved. By convention and good practice's sake, you should save your fonts in 'assets/fonts' directory.&lt;br&gt;
The implementation is demonstrated below;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import * as React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { useFonts } from 'expo-font';

export default function App() {
  const [loaded] = useFonts({
    Montserrat: require('./assets/fonts/Montserrat.ttf'),
  });

  if (!loaded) {
    return null;
  }

  return (
    &amp;lt;View style={styles.container}&amp;gt;
      &amp;lt;Text style={styles.text}
      &amp;gt;Montserrat&amp;lt;/Text&amp;gt;
    &amp;lt;/View&amp;gt;
  );
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#fff',
        alignItems: 'center',
        justifyContent: 'center',
    },
    text: {
        fontSize: 30,
        fontFamily: 'Montserrat', 
        color: "#1DA1F2",
    }
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;So that's pretty much it. I hope you find this useful and not hesitate to share. Please drop a like if this was useful and helped you solve a problem. Thank you😊.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>mobile</category>
      <category>beginners</category>
      <category>100daysofcode</category>
    </item>
  </channel>
</rss>
