Pages

Sunday, June 27, 2021

Fedora 34 : Install evolution tool.

Evolution is a personal information management application that provides integrated mail, calendaring and address book functionality, see the wiki gnome page.
[root@desk mythcat]# dnf search evolution
Last metadata expiration check: 3:46:10 ago on Sun 27 Jun 2021 10:18:50 AM EEST.
======================= Name Exactly Matched: evolution ========================
evolution.x86_64 : Mail and calendar client for GNOME
... 
[root@desk mythcat]# dnf install evolution.x86_64
Last metadata expiration check: 3:48:05 ago on Sun 27 Jun 2021 10:18:50 AM EEST.
Dependencies resolved.
================================================================================
 Package                  Arch        Version                Repository    Size
================================================================================
Installing:
 evolution                x86_64      3.40.2-1.fc34          updates      3.7 M
Installing dependencies:
 evolution-langpacks      noarch      3.40.2-1.fc34          updates      5.6 M
 highlight                x86_64      3.60-3.fc34            fedora       887 k
 libytnef                 x86_64      1:1.9.3-5.fc34         fedora        39 k

Transaction Summary
================================================================================
Install  4 Packages

Total download size: 10 M
Installed size: 56 M
Is this ok [y/N]: y
...
Installed:
  evolution-3.40.2-1.fc34.x86_64    evolution-langpacks-3.40.2-1.fc34.noarch   
  highlight-3.60-3.fc34.x86_64      libytnef-1:1.9.3-5.fc34.x86_64             

Complete!
The consfiguration of email account is easy.
I used my yahoo account.
The yahoo mail server ask me a token, but I close and I login again and work well.
You can see a video tutorial from my youtube channel.

Fedora 34 : ASP.NET Core application - part 001.

This tutorial is about creating an ASP project on Fedora 34 Linux distro.
Let's create a folder for a new ASP project:
[mythcat@desk ~]$ cd CSharpProjects/
[mythcat@desk CSharpProjects]$ mkdir ASPProjects
[mythcat@desk CSharpProjects]$ cd ASPProjects/
[mythcat@desk ASPProjects]$ dotnet new web -o ASP001
The template "ASP.NET Core Empty" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on ASP001/ASP001.csproj...
  Determining projects to restore...
  Restored /home/mythcat/CSharpProjects/ASPProjects/ASP001/ASP001.csproj (in 152 ms).
Restore succeeded.
In the ASP001 folder project will run these commands:
[mythcat@desk ASPProjects]$ cd ASP001/
[mythcat@desk ASP001]$ dotnet restore
  Determining projects to restore...
  All projects are up-to-date for restore.
[mythcat@desk ASP001]$ dotnet run
Building...
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: https://localhost:5001
This program will show
info: Microsoft.Hosting.Lifetime[14] Now listening on: http://localhost:5000 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Development info: Microsoft.Hosting.Lifetime[0] Content root path: /home/mythcat/CSharpProjects/ASPProjects/ASP001 ^Cinfo: Microsoft.Hosting.Lifetime[0] Application is shutting down...
This program will show on browser localhost the text: Hello World!
With the dotnet restore command, we download the necessary dependencies.
It calls into NuGet - .NET package manager to restore the tree of dependencies.
Let's see the files from this project:
[mythcat@desk ASP001]$ ls
appsettings.Development.json  ASP001.csproj  obj	 Properties
appsettings.json	      bin	     Program.cs
[mythcat@desk ASP001]$ cat Program.cs 
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Hosting;

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

if (app.Environment.IsDevelopment())
{
    app.UseDeveloperExceptionPage();
}

app.MapGet("/", (Func<string>)(() => "Hello World!"));

app.Run();
[mythcat@desk ASP001]$ cat ASP001.csproj 
...
This is the most simple tutorial about the ASP project.

Saturday, June 19, 2021

Fedora 34 : Test with the new .NET 6.0 SDK.

Now Fedora 34 distro comes integrated in the repo with DotNet 5.
Today I tested DotNet 6.
Let's create a new folder for the .NET 6.0 SDK .
[mythcat@desk ~]$ mkdir -p $HOME/dotnet
[mythcat@desk ~]$ cd dotnet/
First open your browser and download the .NET 6.0 SDK from the official website.
[mythcat@desk dotnet]$ ls
dotnet-sdk-6.0.100-preview.5.21302.13-linux-x64.tar.gz
Use the following commands to extract the SDK and make the commands available at the terminal.
[mythcat@desk dotnet]$ tar zxf dotnet-sdk-6.0.100-preview.5.21302.13-linux-x64.tar.gz  -C $HOME/dotnet
[mythcat@desk dotnet]$ export DOTNET_ROOT=$HOME/dotnet
[mythcat@desk dotnet]$ export PATH=$PATH:$HOME/dotnet
Let's see the content of the dotnet folder:
[mythcat@desk dotnet]$ ls
dotnet							sdk
dotnet-sdk-6.0.100-preview.5.21302.13-linux-x64.tar.gz	sdk-manifests
host							shared
LICENSE.txt						templates
packs							ThirdPartyNotices.txt
Let's run the binary dotnet from this folder:
[mythcat@desk dotnet]$ ./dotnet --version
6.0.100-preview.5.21302.13 
I added to PATH into .bashrc file:
[mythcat@desk dotnet]$cat ~/.bashrc 
export PS1="[\u@\h \W]\$ "
PATH=$PATH:$HOME/dotnet

Friday, June 18, 2021

Fedora 34 : Defragmenting an XFS file system with xfs_fsr.

The xfs_fsr tool improves the organization of mounted filesystems.
The XFS is an extent-based file system, it is usually unnecessary to defragment a whole file system
I can use this command to Defragmenting my XFS file system.
[root@desk mythcat]# xfs_fsr /dev/mapper/fedora-root -v -d
...
set temp attr
DEBUG: fsize=6774 blsz_dio=6656 d_min=512 d_max=2147483136 pgsz=4096
Temporary file has 1 extents (2 in original)
extents before:2 after:1 DONE ino=95047551
ino=95050118
ino=95050118 extents=2 can_save=1 tmp=/.fsr/ag14/tmp10249
orig forkoff 288, temp forkoff 0
orig forkoff 288, temp forkoff 296
orig forkoff 288, temp forkoff 296
orig forkoff 288, temp forkoff 296
orig forkoff 288, temp forkoff 296
orig forkoff 288, temp forkoff 296
orig forkoff 288, temp forkoff 296
orig forkoff 288, temp forkoff 288
set temp attr
DEBUG: fsize=6541 blsz_dio=6144 d_min=512 d_max=2147483136 pgsz=4096
Temporary file has 1 extents (2 in original)
extents before:2 after:1 DONE ino=95050118
This is all about this command.

Wednesday, June 16, 2021

Fedora 34 : The grubby command line tool.

The grubby command line tool used to configure bootloader menu entries across multiple architectures.
All information can be find with the manual linux commands:
[root@desk mythcat]# man grubby
Let's see some simple examples.
This command can list all the installed kernel:
[root@desk mythcat]# grubby --info=ALL | grep ^kernel
kernel="/boot/vmlinuz-5.12.10-300.fc34.x86_64"
kernel="/boot/vmlinuz-5.12.8-300.fc34.x86_64"
kernel="/boot/vmlinuz-0-rescue-fc76db87af524282b0c7e05a9c5d18f4
To get more details on the installed kernel:
[root@desk mythcat]# grubby --info="/boot/vmlinuz-$(uname -r)"
index=0
kernel="/boot/vmlinuz-5.12.10-300.fc34.x86_64"
args="ro resume=/dev/mapper/fedora-swap rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet splash 
acpi_osi=Linux"
root="/dev/mapper/fedora-root"
initrd="/boot/initramfs-5.12.10-300.fc34.x86_64.img"
title="Fedora (5.12.10-300.fc34.x86_64) 34 (MATE-Compiz)"
id="fc76db87af524282b0c7e05a9c5d18f4-5.12.10-300.fc34.x86_64"
Add selinux=0 to the kernel with this tool:
[root@desk mythcat]# grubby --update-kernel ALL --args selinux=0
Let's see if is added:
[root@desk mythcat]# grubby --info="/boot/vmlinuz-$(uname -r)"
index=0
kernel="/boot/vmlinuz-5.12.10-300.fc34.x86_64"
args="ro resume=/dev/mapper/fedora-swap rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet splash 
acpi_osi=Linux selinux=0"
root="/dev/mapper/fedora-root"
initrd="/boot/initramfs-5.12.10-300.fc34.x86_64.img"
title="Fedora (5.12.10-300.fc34.x86_64) 34 (MATE-Compiz)"
id="fc76db87af524282b0c7e05a9c5d18f4-5.12.10-300.fc34.x86_64"
Remove the selinux=0 option from the bootloader with this tool:
[root@desk mythcat]# grubby --update-kernel ALL --remove-args selinux
Let's see if is removed:
[root@desk mythcat]# grubby --info="/boot/vmlinuz-$(uname -r)"
index=0
kernel="/boot/vmlinuz-5.12.10-300.fc34.x86_64"
args="ro resume=/dev/mapper/fedora-swap rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet splash 
acpi_osi=Linux"
root="/dev/mapper/fedora-root"
initrd="/boot/initramfs-5.12.10-300.fc34.x86_64.img"
title="Fedora (5.12.10-300.fc34.x86_64) 34 (MATE-Compiz)"
id="fc76db87af524282b0c7e05a9c5d18f4-5.12.10-300.fc34.x86_64"
You can see is removed.
Get the index number of all the installed kernels:
[root@desk mythcat]# grubby --info=ALL | grep -E "^kernel|^index"
index=0
kernel="/boot/vmlinuz-5.12.10-300.fc34.x86_64"
index=1
kernel="/boot/vmlinuz-5.12.8-300.fc34.x86_64"
index=2
kernel="/boot/vmlinuz-0-rescue-fc76db87af524282b0c7e05a9c5d18f4"
I can set the default kernel by index with this tool:
[root@desk mythcat]# grubby --set-default-index=1
These are not all features of this command.

Tuesday, June 15, 2021

Fedora 34 : The uresourced resource tool.

The uresourced tool is a daemon that will give resource allocations to active graphical users.
You can enable easy with systemctl command:
[root@desk mythcat]# systemctl status uresourced
○ uresourced.service - User resource assignment daemon
     Loaded: loaded (/usr/lib/systemd/system/uresourced.service; disabled; vend>
     Active: inactive (dead)

[root@desk mythcat]# systemctl enable uresourced
Created symlink /etc/systemd/system/user@.service.wants/uresourced.service → 
/usr/lib/systemd/system/uresourced.service.
[root@desk mythcat]# systemctl start  uresourced
[root@desk mythcat]# systemctl status uresourced
● uresourced.service - User resource assignment daemon
...

Sunday, June 13, 2021

Fedora 34 : Linux tool to prevent OOM Killer.

The OOM Killer or Out of Memory Killer is a process that the Linux kernel employs when the system is critically low on memory
This situation occurs because processes on the server are consuming a large amount of memory, and the system requires more memory for its processes and to allocate to other processes.
A simple example with OOM Killer: if will swap out the desktop environment, drop the whole page cache, and empty every buffer before it will ultimately kill a process.
This tool named earlyoom is a simple, stable, and tiny OOM prevention daemon.
That is written in C and is the best choice for old servers.
It has minimum dependencies and can work with the oldest kernels.
The earlyoom checks the amount of available memory and free swap up.
This command causes memory consumption, and the process will exits before OOM occurs if this tool works.
The tool can be installed with the following command:
[root@desk mythcat]# dnf install earlyoom
Last metadata expiration check: 0:38:00 ago on Sun 13 Jun 2021 11:38:22 AM EEST.
Package earlyoom-1.6.2-3.fc34.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
You can see all options for this tool with this command:
[root@desk mythcat]# earlyoom -h
earlyoom 1.6.2
Usage: earlyoom [OPTION]...
Then the service is activated with:
[root@desk mythcat]# systemctl enable --now earlyoom
My configuration file for this tool is:
[root@desk mythcat]# vim  /etc/default/earlyoom
EARLYOOM_ARGS="-r 1 -m 1 -s 5 -M 1514244 --prefer '^Web Content$' 
--avoid '^(dnf|packagekitd|gnome-shell|gnome-session-c|gnome-session-b|lightdm|
sddm|sddm-helper|gdm|gdm-wayland-ses|gdm-session-wor|gdm-x-session|Xorg|Xwayland|
systemd|systemd-logind|dbus-daemon|dbus-broker|cinnamon|cinnamon-sessio|kwin_x11|
kwin_wayland|plasmashell|ksmserver|plasma_session|startplasma-way|xfce4-session|
mate-session|marco|lxqt-session|openbox|cryptsetup)$'"
You can check the status of the service to be active:
[root@desk mythcat]# systemctl status earlyoom
...
Active: active (running) since 
... 
You can test it easily with these commands:
[root@desk mythcat]# sudo swapoff -a
[root@desk mythcat]# tail /dev/zero
Terminated
The process tail must occupy the entire available RAM on the system, this will low your system and after the earlyoom tool freeing the RAM all works well.
To see the tool on work, use the command:
[root@desk mythcat]# earlyoom 
earlyoom 1.6.2
mem total: 7899 MiB, swap total: 7898 MiB
sending SIGTERM when mem <= 10.00% and swap <= 10.00%,
        SIGKILL when mem <=  5.00% and swap <=  5.00%
mem avail:  4742 of  7899 MiB (60.04%), swap free: 7898 of 7898 MiB (100.00%)
mem avail:  4742 of  7899 MiB (60.04%), swap free: 7898 of 7898 MiB (100.00%)
mem avail:  4751 of  7899 MiB (60.15%), swap free: 7898 of 7898 MiB (100.00%)
mem avail:  4754 of  7899 MiB (60.19%), swap free: 7898 of 7898 MiB (100.00%)

Thursday, June 10, 2021

Fedora 34 : Fix conflicts are between the version of the packages.

You can have conflicts are between the version of the packages, see this example:
[root@desk mythcat]# dnf update --refresh
file /usr/share/doc/gstreamer1-plugins-good/README from install of 
gstreamer1-plugins-good-1.19.1-1.fc34.i686 conflicts with file from package 
gstreamer1-plugins-good-1.18.4-2.fc34.x86_64
This command will fix conflicts are between the version of the packages:
[root@desk mythcat]# dnf remove --duplicates
...
 gstreamer1                          i686    1.19.1-1.fc34       updates  1.4 M
Reinstalling:
 gst-editing-services                x86_64  1.19.1-1.fc34       updates  608 k
     replacing  gst-editing-services.x86_64 1.18.4-1.fc34
 gstreamer1                          x86_64  1.19.1-1.fc34       updates  1.3 M
     replacing  gstreamer1.x86_64 1.18.4-2.fc34
 gstreamer1-plugins-bad-free         x86_64  1.19.1-1.fc34       updates  2.6 M
     replacing  gstreamer1-plugins-bad-free.x86_64 1.18.4-1.fc34
 gstreamer1-plugins-bad-free-extras  x86_64  1.19.1-1.fc34       updates  422 k
     replacing  gstreamer1-plugins-bad-free-extras.x86_64 1.18.4-1.fc34
 gstreamer1-plugins-ugly-free        x86_64  1.19.1-1.fc34       updates  103 k
     replacing  gstreamer1-plugins-ugly-free.x86_64 1.18.4-1.fc34
 gucharmap                           x86_64  13.0.8-1.fc34       updates  514 k
     replacing  gucharmap.x86_64 13.0.7-1.fc34
 gucharmap-libs                      x86_64  13.0.8-1.fc34       updates  1.2 M
     replacing  gucharmap-libs.x86_64 13.0.7-1.fc34
 kernel-headers                      x86_64  5.12.9-300.fc34     updates  1.2 M
     replacing  kernel-headers.x86_64 5.12.5-300.fc34
...
The next command will update you Linux distro:
[root@desk mythcat]# dnf update --refresh
Copr repo for dotnet owned by @dotnet-sig       5.1 kB/s | 3.3 kB     00:00    
Adobe Systems Incorporated                      7.6 kB/s | 2.9 kB     00:00    
Fedora 34 - x86_64                               58 kB/s |  26 kB     00:00    
Fedora 34 - x86_64 - Updates                     41 kB/s |  23 kB     00:00    
google-chrome                                   9.0 kB/s | 1.3 kB     00:00    
RPM Fusion for Fedora 34 - Free                  16 kB/s | 7.9 kB     00:00    
RPM Fusion for Fedora 34 - Free - Updates        18 kB/s | 7.9 kB     00:00    
RPM Fusion for Fedora 34 - Nonfree               21 kB/s | 8.0 kB     00:00    
RPM Fusion for Fedora 34 - Nonfree - Updates     13 kB/s | 8.0 kB     00:00    
The Zeek Network Security Monitor. (Fedora_33)  6.6 kB/s | 1.7 kB     00:00    
Visual Studio Code                              6.0 kB/s | 3.0 kB     00:00    
WineHQ packages                                 9.3 kB/s | 3.2 kB     00:00    
Dependencies resolved.
...
 gstreamer1-plugins-good-1.19.1-1.fc34.i686  
...

Wednesday, June 9, 2021

Fedora 34 : Programming with the ncurses library - part 003.

This is a simple example with ncurses library to see how can define an array and used with random colors:
This example is build with this command:
[mythcat@desk ncursesProject]$ gcc test_008.c -o test_008 -lncurses
This is source code:
#include <ncurses.h>
#include <stdlib.h> 

int main(void) {
    
    initscr();
    
    start_color();
    
    char colors[8][20] = {
    "COLOR_BLACK",
    "COLOR_RED",
    "COLOR_GREEN",
    "COLOR_YELLOW",
    "COLOR_BLUE",
    "COLOR_MAGENTA",
    "COLOR_CYAN",
    "COLOR_WHITE"
    };
    
    int n;
    for ( n=0 ; n<16 ; ++n )
    {
        int aleator1 = rand() % 256 + 1;
        int result1 = *colors[aleator1];
        int aleator2 = rand() % 256 + 1;
        int result2 = *colors[aleator2];
        //printw("%d",result1);
        init_pair(n, result1, result2);
        attron(COLOR_PAIR(n));
        printw("Hello word!\n");
    }
    
    refresh();

    getch();

    endwin();
}

Saturday, June 5, 2021

Fedora 34 : Neix feed reader.

neix is a simple, work in progress terminal feed reader for all common RSS/Atom feeds on the web out there.
Let't install from the GitHub repository.
[mythcat@desk ~]$ git clone https://github.com/tomschwarz/neix.git  
Cloning into 'neix'...
remote: Enumerating objects: 2574, done.
remote: Counting objects: 100% (365/365), done.
remote: Compressing objects: 100% (274/274), done.
remote: Total 2574 (delta 189), reused 198 (delta 77), pack-reused 2209
Receiving objects: 100% (2574/2574), 26.07 MiB | 6.27 MiB/s, done.
Resolving deltas: 100% (1529/1529), done.
[mythcat@desk ~]$ cd neix
[mythcat@desk neix]$ cmake .
-- The C compiler identification is GNU 11.1.1
-- The CXX compiler identification is GNU 11.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
...
-- Found Curses: /usr/lib64/libncursesw.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mythcat/neix
[mythcat@desk neix]$ make 
Scanning dependencies of target neixParser
[  5%] Building CXX object CMakeFiles/neixParser.dir/src/parser/FactoryParser.cpp.o
...
[ 89%] Built target neixFeed
Scanning dependencies of target neix
[ 94%] Building CXX object CMakeFiles/neix.dir/src/main.cpp.o
[100%] Linking CXX executable bin/neix
[100%] Built target neix
[mythcat@desk neix]$ sudo make install
[sudo] password for mythcat: 
[ 26%] Built target neixParser
[ 42%] Built target neixConfig
[ 57%] Built target neixApplication
[ 73%] Built target neixHelper
[ 89%] Built target neixFeed
[100%] Built target neix
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/neix
-- Installing: /usr/local/share/man/man1/neix.1
-- Installing: /usr/local/share/neix/neix.conf
-- Installing: /usr/local/share/neix/feeds.conf
Let's run it:
[mythcat@desk neix]$ neix 
[neix] Starting version v0.1.5
[neix] Loading configuration files
[neix] Loading feeds 
[neix] Launch TUI 
Use feeds.conf to set the list of feeds you want to read.
This is a screenshot with the result of the build: