Pages

Tuesday, July 28, 2020

Fedora 32 : Play Minecraft with TLauncher.

Today I will show you how you can install java and use TLauncher to play Minecraft game on Fedora 32.
You need to have version Java 9 or 10 in order to use this software.
First, download the archive from the official website.
Create a folder name and unzip it into this folder and use these commands:
[mythcat@desk TLauncher]$ ls
README-EN.txt  README-RUS.txt  TLauncher-2.72.jar
[mythcat@desk TLauncer]$ sudo su 
[root@desk TLauncher]# dnf list java* | grep openjdk-devel
java-latest-openjdk-devel.x86_64                  1:14.0.1.7-2.rolling.fc32        @updates
java-1.8.0-openjdk-devel.x86_64                   1:1.8.0.262.b10-1.fc32           updates 
java-1.8.0-openjdk-devel-slowdebug.i686           1:1.8.0.262.b10-1.fc32           updates 
java-1.8.0-openjdk-devel-slowdebug.x86_64         1:1.8.0.262.b10-1.fc32           updates 
java-11-openjdk-devel.i686                        1:11.0.8.10-2.fc32               updates 
java-11-openjdk-devel.x86_64                      1:11.0.8.10-2.fc32               updates 
java-11-openjdk-devel-slowdebug.x86_64            1:11.0.8.10-2.fc32               updates 
java-latest-openjdk-devel.i686                    1:14.0.1.7-2.rolling.fc32        updates 
java-latest-openjdk-devel-slowdebug.x86_64        1:14.0.1.7-2.rolling.fc32        updates 
[root@desk TLauncher]# dnf install java-11-openjdk.x86_64
Last metadata expiration check: 0:09:17 ago on Tue 28 Jul 2020 09:33:24 PM EEST.
Dependencies resolved.
=====================================================================================================================
 Package                              Architecture       Version                           Repository           Size
=====================================================================================================================
Installing:
 java-11-openjdk                      x86_64             1:11.0.8.10-2.fc32                updates             251 k
Installing dependencies:
 java-11-openjdk-headless             x86_64             1:11.0.8.10-2.fc32                updates              38 M
 ttmkfdir                             x86_64             3.0.9-58.fc32                     fedora               58 k
 xorg-x11-fonts-Type1                 noarch             7.5-24.fc32                       fedora              500 k

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

Total download size: 39 M
Installed size: 173 M
Is this ok [y/N]: y
...
[root@desk TLauncher]# sudo alternatives --config java

There are 4 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
   1           /opt/jdk1.8.0_232/bin/java
   2           /opt/jdk1.8.0_201/bin/java
*+ 3           java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-1.fc32.x86_64/jre/bin/java)
   4           java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.8.10-2.fc32.x86_64/bin/java)

Enter to keep the current selection[+], or type selection number: 4
[root@desk TLauncher]# export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.8.10-2.fc32.x86_64/
[root@desk TLauncher]# echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk-11.0.8.10-2.fc32.x86
[root@desk TLauncher]# java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment 18.9 (build 11.0.8+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10, mixed mode, sharing)
Now you can start the program:
[mythcat@desk TLauncher]$ sudo java -jar TLauncher-2.72.jar

-------------------------------------------------------------------
run double running protection
[Downloader2] Loaded configuration: normal
[Downloader2] Files in queue 15
[Downloader2] Starting download 15 files...
...
The last command will run the software and you will able to play the game.

Saturday, July 11, 2020

Fedora 32 : Upgrade from Fedora 31 to the new Fedora 32.

Today I managed to upgrade to Fedora 32.
After some time I started the system and used the tutorial from here.
I also used the following Linux commands:
#sudo dnf distro-sync --allowerasing
#dnf reinstall xorg-\* mesa\* libglvnd\*
In the following image, you can see the new upgrade works very well with my Cinnamon desktop environment.

Tuesday, February 25, 2020

Fedora 31 : Install Unity 3D on Fedora Linux.

If you want to install the Unity 3D software on Fedora 31 Linux distro then you can read my tutorial from this webpage.
To run Unity software you need to have one good hardware.
This install require to upload the license file even you use a free or pro license.

Tuesday, February 18, 2020

Fedora 31 : The Fyne UI toolkit for Go programming language.

Today I will show you how to use a UI toolkit with the Go programming. language. The development team comes with this toolkit at the GitHub official webpage.
Fyne is an easy to use UI toolkit and app API written in Go. It is designed to build applications that run on desktop and mobile devices with a single codebase...
[mythcat@desk ~]$ sudo dnf install golang
[sudo] password for mythcat:
...
Installed:
  golang-1.13.6-1.fc31.x86_64            golang-bin-1.13.6-1.fc31.x86_64       
  golang-src-1.13.6-1.fc31.noarch        mercurial-4.9-2.fc31.x86_64           

Complete! 
First is need to install these packages with DNF tool:
[root@desk mythcat]# dnf install libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel 
mesa-libGL-devel libXi-devel
Last metadata expiration check: 0:04:28 ago on Sun 16 Feb 2020 12:25:04 PM EET.
Package libX11-devel-1.6.9-2.fc31.x86_64 is already installed.
Package mesa-libGL-devel-19.2.8-1.fc31.x86_64 is already installed.
Package libXi-devel-1.7.10-2.fc31.x86_64 is already installed.
Dependencies resolved.
...

Installed:
  libXcursor-devel-1.1.15-6.fc31.x86_64           libXinerama-devel-1.1.4-4.fc31.x86_64           
  libXrandr-devel-1.5.2-2.fc31.x86_64             libXrender-devel-0.9.10-10.fc31.x86_64          

Complete! 
Let's install the fyne toolkit and the demo application:
[mythcat@desk ~]$ go get fyne.io/fyne
[mythcat@desk ~]$ go get fyne.io/fyne/cmd/fyne_demo/
I run the demo with this command and works very well:
[mythcat@desk ~]$ go run /home/mythcat/go/src/fyne.io/fyne/cmd/fyne_demo/main.go  

Sunday, February 16, 2020

Fedora 31 : Can be better? part 006.

I try to use the Selinux MLS with Fedora 31 and I wrote on my last article about Fedora 31 : Can be better? part 005.
After relabeling the files and start the environment I get multiple errors and I ask an answer at fedoraproject lists:
This is an example of the problem of implementing MLS in Fedora and can be remedied because MLS Selinux is old in implementing Selinux.

SELinux is preventing su from open access on the file /var/log/lastlog.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that su should be allowed open access on the lastlog file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'su' --raw | audit2allow -M my-su
# semodule -X 300 -i my-su.pp 
I try to fix it but I got this error:
[root@desk mythcat]# ausearch -c 'su' --raw | audit2allow -M my-su
compilation failed:
my-su.te:36:ERROR 'syntax error' at token 'mlsconstrain' on line 36:
mlsconstrain file { write create setattr relabelfrom append unlink link rename mounton } ((l1 eq l2 -Fail-)  
or (t1 == mlsfilewritetoclr -Fail-)  and (h1 dom l2 -Fail-)  and (l1 domby l2)  or (t2 == 
mlsfilewriteinrange -Fail-)  
and (l1 dom l2 -Fail-)  an
# mlsconstrain file { read getattr execute } ((l1 dom l2 -Fail-)  or (t1 == 
mlsfilereadtoclr -Fail-)  
and (h1 dom l2 -Fail-)  or (t1 == mlsfileread -Fail-)  or (t2 == mlstrustedobject -Fail-) ); Constraint DENIED
/usr/bin/checkmodule:  error(s) encountered while parsing configuration
[root@desk mythcat]# ausearch -c 'su' --raw | audit2allow -M my-su
compilation failed:
my-su.te:36:ERROR 'syntax error' at token 'mlsconstrain' on line 36:
mlsconstrain file { write create setattr relabelfrom append unlink link rename mounton } ((l1 eq l2 -Fail-)  
or (t1 == mlsfilewritetoclr -Fail-)  and (h1 dom l2 -Fail-)  and (l1 domby l2)  or (t2 == 
mlsfilewriteinrange -Fail-)  
and (l1 dom l2 -Fail-)  an
# mlsconstrain file { read getattr execute } ((l1 dom l2 -Fail-)  or (t1 == 
mlsfilereadtoclr -Fail-)  
and (h1 dom l2 -Fail-)  or (t1 == mlsfileread -Fail-)  or (t2 == mlstrustedobject -Fail-) ); Constraint DENIED
/usr/bin/checkmodule:  error(s) encountered while parsing configuration...

Tuesday, February 11, 2020

Fedora 31 : Install the drawing GNOME with DNF and flatpak.

You can use the DNF tool:
[root@desk mythcat]# dnf search gnome | grep drawing 
Last metadata expiration check: 1:53:53 ago on Tue 11 Feb 2020 05:28:15 PM EET.
drawing.noarch : Drawing application for the GNOME desktop
[root@desk mythcat]# dnf install drawing.noarch 
Last metadata expiration check: 1:54:28 ago on Tue 11 Feb 2020 05:28:15 PM EET.
Dependencies resolved.
================================================================================
 Package          Architecture    Version                Repository        Size
================================================================================
Installing:
 drawing          noarch          0.4.9-1.fc31           updates          1.0 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 1.0 M
Installed size: 1.5 M
Is this ok [y/N]: y
Downloading Packages:
drawing-0.4.9-1.fc31.noarch.rpm                 1.4 MB/s | 1.0 MB     00:00    
--------------------------------------------------------------------------------
Total                                           601 kB/s | 1.0 MB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : drawing-0.4.9-1.fc31.noarch                            1/1 
  Running scriptlet: drawing-0.4.9-1.fc31.noarch                            1/1 
  Verifying        : drawing-0.4.9-1.fc31.noarch                            1/1 

Installed:
  drawing-0.4.9-1.fc31.noarch                                                   

Complete!
This install use the flatpak tool:
[root@desk mythcat]# dnf install flatpak
Last metadata expiration check: 1:47:49 ago on Tue 11 Feb 2020 05:28:15 PM EET.
Dependencies resolved.
================================================================================
 Package                     Arch        Version             Repository    Size
================================================================================
Installing:
 flatpak                     x86_64      1.4.3-3.fc31        updates      1.1 M
Installing dependencies:
 flatpak-selinux             noarch      1.4.3-3.fc31        updates       24 k
 flatpak-session-helper      x86_64      1.4.3-3.fc31        updates       72 k
Installing weak dependencies:
 p11-kit-server              x86_64      0.23.20-1.fc31      updates      186 k
 xdg-desktop-portal          x86_64      1.4.2-3.fc31        fedora       386 k
 xdg-desktop-portal-gtk      x86_64      1.4.0-1.fc31        fedora       212 k

Transaction Summary
================================================================================
Install  6 Packages

Total download size: 1.9 M
Installed size: 7.7 M
Is this ok [y/N]: y
...
Installed:
  flatpak-1.4.3-3.fc31.x86_64                                                   
  flatpak-selinux-1.4.3-3.fc31.noarch                                           
  flatpak-session-helper-1.4.3-3.fc31.x86_64                                    
  p11-kit-server-0.23.20-1.fc31.x86_64                                          
  xdg-desktop-portal-1.4.2-3.fc31.x86_64                                        
  xdg-desktop-portal-gtk-1.4.0-1.fc31.x86_64                                    

Complete! 
Let's install the flatpakrepo:
[mythcat@desk ~]$ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Note that the directories 

'/var/lib/flatpak/exports/share'
'/home/mythcat/.local/share/flatpak/exports/share'

are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.
[mythcat@desk ~]$ flatpak install flathub com.github.maoschanz.drawing

Note that the directories 

'/var/lib/flatpak/exports/share'
'/home/mythcat/.local/share/flatpak/exports/share'

are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.

Looking for matches…
Required runtime for com.github.maoschanz.drawing/x86_64/stable (runtime/org.gnome.Platform/x86_64/3.34)
 found in remote flathub
Do you want to install it? [Y/n]: Y

com.github.maoschanz.drawing permissions:
    ipc   wayland   x11



        ID                                   Arch   Branch Remote  Download
 1. [✓] org.gnome.Platform                   x86_64 3.34   flathub 304.2 MB / 318.5 MB
 2. [✓] org.gnome.Platform.Locale            x86_64 3.34   flathub  16.8 kB / 322.0 MB
 3. [✓] org.freedesktop.Platform.GL.default  x86_64 19.08  flathub  92.6 MB / 92.6 MB
 4. [✓] org.freedesktop.Platform.VAAPI.Intel x86_64 19.08  flathub   8.7 MB / 8.7 MB
 5. [✗] org.freedesktop.Platform.openh264    x86_64 19.08  flathub 594.2 kB / 593.4 kB
 6. [✓] com.github.maoschanz.drawing         x86_64 stable flathub   1.0 MB / 1.1 MB
 7. [✓] com.github.maoschanz.drawing.Locale  x86_64 stable flathub   1.7 kB / 86.2 kB

Warning: org.freedesktop.Platform.openh264 not installed
Installation complete.
[mythcat@desk ~]$ flatpak install org.freedesktop.Platform/x86_64/19.08

Note that the directories 

'/var/lib/flatpak/exports/share'
'/home/mythcat/.local/share/flatpak/exports/share'

are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.

Looking for matches…
Found similar ref(s) for ‘org.freedesktop.Platform/x86_64/19.08’ in remote ‘flathub’ (system).
Use this remote? [Y/n]: Y


        ID                                Arch   Branch Remote  Download
 1. [✓] org.freedesktop.Platform          x86_64 19.08  flathub  11.5 MB / 238.1 MB
 2. [✓] org.freedesktop.Platform.Locale   x86_64 19.08  flathub  16.7 kB / 318.2 MB
 3. [✓] org.freedesktop.Platform.openh264 x86_64 19.08  flathub 593.6 kB / 593.4 kB

Installation complete. 
Restart the session and run it with this command:
[mythcat@desk ~]$ flatpak run com.github.maoschanz.drawing

Sunday, February 2, 2020

Fedora 31 : Can be better? part 005.

Today we have once again dealt with this topic on the possibilities of improving the Fedora distro.
This time the adventure turned to the Selinux system switching to SELinux MLS.
Let's test the SELinux Fedora 31 from default targeted to mls.
First let's see the users:
[root@desk mythcat]# semanage user -l

                Labeling   MLS/       MLS/                          
SELinux User    Prefix     MCS Level  MCS Range                      SELinux Roles

guest_u         user       s0         s0                             guest_r
root            user       s0         s0-s0:c0.c1023                 staff_r sysadm_r system_r unconfined_r
staff_u         user       s0         s0-s0:c0.c1023                 staff_r sysadm_r system_r unconfined_r
sysadm_u        user       s0         s0-s0:c0.c1023                 sysadm_r
system_u        user       s0         s0-s0:c0.c1023                 system_r unconfined_r
unconfined_u    user       s0         s0-s0:c0.c1023                 system_r unconfined_r
user_u          user       s0         s0                             user_r
xguest_u        user       s0         s0                             xguest_r
To use the MLS you need to change this file:
[root@desk mythcat]# vim /etc/selinux/config


# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
The changes are:

#SELINUX=enforcing
SELINUX=permissive
...
#SELINUXTYPE=targeted
SELINUXTYPE=mls
Is need to install these packages:
[root@desk mythcat]# dnf search mls | grep selinux
Last metadata expiration check: 2:45:09 ago on Sun 02 Feb 2020 01:28:54 PM EET.
selinux-policy-mls.noarch : SELinux mls base policy
[root@desk mythcat]# dnf install selinux-policy-mls.noarch
...
Installed:
  mcstrans-2.9-2.fc31.x86_64                                                    
  policycoreutils-newrole-2.9-5.fc31.x86_64                                     
  selinux-policy-mls-3.14.4-45.fc31.noarch                                      

Complete!
These commands will relabel and start the MLS.
[mythcat@desk ~]$ setenforce 0
[mythcat@desk ~]$ getenforce
Permissive
...
[root@desk mythcat]# touch /.autorelabel
[root@desk mythcat]# reboot
If you have problems on boot the add selinux=0 on boot kernel.
After I boot and relabel all files I got errors about Gtk-Messages.
I remove my old Cinnamon with this command:
[root@desk mythcat]# dnf groupremove -y "Cinnnamon"
I list all my group with dnf tool:
[root@desk mythcat]# dnf grouplist -v 
I install the MATE environment:
dnf groupinstall -y "MATE Desktop" --allowerasing
After that the only way to start the environement is this command:
[mythcat@desk ~]$ sudo systemctl restart lightdm.service
Another issue comes from SELinux Alert Browser, where I get multiple alerts and these need to fix manually.
First, these alerts are more than 250.
After I fix some of these now I see only 50.
I think this problem with changing the SELinux type can be improved.

Fedora 31 : Using the dmesg command on Linux operating system.

The dmesg command is used to display the kernel-related messages on Unix like systems. Today I will show you how to use this command on the Linux operating system. Simply use the command:
[mythcat@desk ~]$ dmesg 
[    0.000000] microcode: microcode updated early to revision 0x21, date = 2019-02-13
...
Show the latest message that fits on screen:
[mythcat@desk ~]$ dmesg | less
... 
Use it to see infoermation about motherboard:
[mythcat@desk ~]$ dmesg | grep -i memory
...
[mythcat@desk ~]$ dmesg | grep -i dma
...
[mythcat@desk ~]$ dmesg | grep -i usb
...
[mythcat@desk ~]$ dmesg | grep -i tty
...
Same reult with a single command using multiple grep option:
[mythcat@desk ~]$ dmesg | grep -E "memory|dma|usb|tty"
This display logs related to error and warning:
[root@desk mythcat]# dmesg --level=err,warn
The dmesg comes with supported log facilities:
  • kern - kernel messages;
  • user - random user-level messages;
  • mail - mail system;
  • daemon - system daemons;
  • auth - security/authorization messages;
  • syslog - messages generated internally by syslogd;
  • lpr - line printer subsystem;
  • news - network news subsystem;
See output facility only for one:
[mythcat@desk ~]$ dmesg --facility=daemon
Use root user to clear dmesg logs after the reading them:
[root@desk mythcat]# dmesg -C
If you want then you can show the outpout into the colored messages:
# dmesg -L

Tuesday, January 28, 2020

Fedora 31 : Can be better? part 004.

Another issue on Fedora can be linked to the management of transactions to avoid transaction lock. Let's see how can be fixed:
[root@desk mythcat]# rpm --rebuilddb
warning: waiting for transaction lock on /var/lib/rpm/.rpm.lock
^C
[root@desk mythcat]# rm /var/lib/rpm/.rpm.lock
rm: remove regular empty file '/var/lib/rpm/.rpm.lock'? y
[root@desk mythcat]# rpm --rebuilddb
...
[root@desk mythcat]# dnf clean all
...
Waiting for process with pid 2128 to finish.
^CKeyboardInterrupt: Terminated.
[root@desk mythcat]# kill  -9 2128
[root@desk mythcat]# dnf clean all
95 files removed

Friday, January 24, 2020

Fedora 31 : The twa web auditor tool.

This tool comes with a good intro: A tiny web auditor with strong opinions.
The tool named twa takes one domain at a time and use these dependencies: bash 4, curl, dig, jq, and nc, along with the POSIX system.
The project can be found at GitHub repository but I can be install easy on Fedora 31 distro:
[root@desk mythcat]# dnf install twa.noarch 
Last metadata expiration check: 0:06:08 ago on Fri 24 Jan 2020 01:57:53 PM EET.
Dependencies resolved.
================================================================================
 Package       Architecture     Version                  Repository        Size
================================================================================
Installing:
 twa           noarch           1.8.0-3.fc31             fedora            18 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 18 k
Installed size: 30 k
Is this ok [y/N]: y
Downloading Packages:
twa-1.8.0-3.fc31.noarch.rpm                      10 kB/s |  18 kB     00:01    
--------------------------------------------------------------------------------
Total                                           6.7 kB/s |  18 kB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : twa-1.8.0-3.fc31.noarch                                1/1 
  Running scriptlet: twa-1.8.0-3.fc31.noarch                                1/1 
  Verifying        : twa-1.8.0-3.fc31.noarch                                1/1 

Installed:
  twa-1.8.0-3.fc31.noarch                                                       

Complete!
Let's see some examples with google website responses and this tool:
[mythcat@desk ~]$ twa google.com
FAIL(google.com): TWA-0102: HTTP redirects to HTTP (not secure)
FAIL(google.com): TWA-0205: Strict-Transport-Security missing
MEH(google.com): TWA-0206: X-Frame-Options is 'sameorigin', consider 'deny'
FAIL(google.com): TWA-0209: X-Content-Type-Options missing
FAIL(google.com): TWA-0210: X-XSS-Protection is '0'; XSS filtering disabled
FAIL(google.com): TWA-0214: Referrer-Policy missing
FAIL(google.com): TWA-0219: Content-Security-Policy missing
FAIL(google.com): TWA-0220: Feature-Policy missing
PASS(google.com): Site sends 'Server', but probably only a vendor ID: gws
PASS(google.com): Site doesn't send 'X-Powered-By'
PASS(google.com): Site doesn't send 'Via'
PASS(google.com): Site doesn't send 'X-AspNet-Version'
PASS(google.com): Site doesn't send 'X-AspNetMvc-Version'
PASS(google.com): No SCM repository at: http://google.com/.git/HEAD
PASS(google.com): No SCM repository at: http://google.com/.hg/store/00manifest.i
PASS(google.com): No SCM repository at: http://google.com/.svn/entries
PASS(google.com): No environment file at: http://google.com/.env
PASS(google.com): No environment file at: http://google.com/.dockerenv
PASS(google.com): No config file at: http://google.com/config.xml
PASS(google.com): No config file at: http://google.com/config.json
PASS(google.com): No config file at: http://google.com/config.yaml
PASS(google.com): No config file at: http://google.com/config.yml
PASS(google.com): No config file at: http://google.com/config.ini
^C
The output result line looks like this:
TYPE(domain): explanation where TYPE is one of PASS, MEH, FAIL, UNK, SKIP, and FATAL., see the output example:
PASS: The test passed with flying color.
MEH: The test passed, but with one or more things that could be improved.
FAIL: The test failed and should be fixed.
UNK: The server gave us something we didn't understand.
SKIP: The server gave us something we understood, but that we don't handle yet.
FATAL: A really important test failed, and should be fixed immediately.
Another feature is scoring.
The score format is this: npasses nmehs nfailures nunknowns nskips totally_screwed.
Let's see one example:
[mythcat@desk ~]$ twa google.com | tscore
20 37 2 7 0 0 0
The tool can be used with Alpine Docker container.

Tuesday, January 14, 2020

Fedora 31 : Install Yii framework.

Today I will show you how to install the Yii framework:
Yii is a fast, secure, and efficient PHP framework. Flexible yet pragmatic. Works right out of the box. Has reasonable defaults.
First, let's install the PHP , see the official webpage.
Fedora for PHP development.
[mythcat@desk ~]$ sudo dnf install php-cli
...
Is this ok [y/N]: y
Downloading Packages:
(1/2): php-common-7.3.13-1.fc31.x86_64.rpm      794 kB/s | 760 kB     00:00    
(2/2): php-cli-7.3.13-1.fc31.x86_64.rpm         2.2 MB/s | 2.8 MB     00:01    
--------------------------------------------------------------------------------
Total                                           1.6 MB/s | 3.5 MB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : php-common-7.3.13-1.fc31.x86_64                        1/2 
  Installing       : php-cli-7.3.13-1.fc31.x86_64                           2/2 
  Running scriptlet: php-cli-7.3.13-1.fc31.x86_64                           2/2 
  Verifying        : php-cli-7.3.13-1.fc31.x86_64                           1/2 
  Verifying        : php-common-7.3.13-1.fc31.x86_64                        2/2 

Installed:
  php-cli-7.3.13-1.fc31.x86_64          php-common-7.3.13-1.fc31.x86_64         

Complete!
Install these packages: PHPUnit for unit tests or Composer.
[mythcat@desk ~]$ sudo dnf install phpunit composer
...
Complete!
Install mysqli extension:
[mythcat@desk ~]$ sudo dnf install php-mysqli
...
Installed:
  php-mysqlnd-7.3.13-1.fc31.x86_64                                              

Complete!
You can start the server:
[mythcat@desk ~]$ sudo php --server localhost:8080 --docroot  .
PHP 7.3.13 Development Server started at Tue Jan 14 21:58:19 2020
Listening on http://localhost:8080
Document root is /home/mythcat
Press Ctrl-C to quit.
[Tue Jan 14 21:58:40 2020] [::1]:32988 [404]: / - No such file or directory
[Tue Jan 14 21:58:40 2020] [::1]:32990 [404]: / - No such file or directory
[Tue Jan 14 21:58:42 2020] [::1]:33014 [404]: /favicon.ico - No such file or directory
[Tue Jan 14 21:59:48 2020] [::1]:33080 [404]: / - No such file or directory
...
The composer command has these arguments:
[mythcat@desk ~]$ composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.9.1 2019-11-01 17:20:17

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
      --no-cache                 Prevent use of the cache
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output,
 2 for more verbose output and 3 for debug

Available commands:
  about                Shows the short information about Composer.
  archive              Creates an archive of this composer package.
  browse               Opens the package's repository URL or homepage in your browser.
  check-platform-reqs  Check that platform requirements are satisfied.
  clear-cache          Clears composer's internal package cache.
  clearcache           Clears composer's internal package cache.
  config               Sets config options.
  create-project       Creates new project from a package into given directory.
  depends              Shows which packages cause the given package to be installed.
  diagnose             Diagnoses the system to identify common errors.
  dump-autoload        Dumps the autoloader.
  dumpautoload         Dumps the autoloader.
  exec                 Executes a vendored binary/script.
  global               Allows running commands in the global composer dir ($COMPOSER_HOME).
  help                 Displays help for a command
  home                 Opens the package's repository URL or homepage in your browser.
  i                    Installs the project dependencies from the composer.lock file if present,
 or falls back on the composer.json.
  info                 Shows information about packages.
  init                 Creates a basic composer.json file in current directory.
  install              Installs the project dependencies from the composer.lock file if present,
 or falls back on the composer.json.
  licenses             Shows information about licenses of dependencies.
  list                 Lists commands
  outdated             Shows a list of installed packages that have updates available, including
 their latest version.
  prohibits            Shows which packages prevent the given package from being installed.
  remove               Removes a package from the require or require-dev.
  require              Adds required packages to your composer.json and installs them.
  run                  Runs the scripts defined in composer.json.
  run-script           Runs the scripts defined in composer.json.
  search               Searches for packages.
  show                 Shows information about packages.
  status               Shows a list of locally modified packages, for packages installed from source.
  suggests             Shows package suggestions.
  u                    Upgrades your dependencies to the latest version according to composer.json,
 and updates the composer.lock file.
  update               Upgrades your dependencies to the latest version according to composer.json,
 and updates the composer.lock file.
  upgrade              Upgrades your dependencies to the latest version according to composer.json,
 and updates the composer.lock file.
  validate             Validates a composer.json and composer.lock.
  why                  Shows which packages cause the given package to be installed.
  why-not              Shows which packages prevent the given package from being installed.
Let's install the Yii framework:
[mythcat@desk ~]$ composer create-project --prefer-dist yiisoft/yii2-app-basic basic

Installing yiisoft/yii2-app-basic (2.0.31)
  - Installing yiisoft/yii2-app-basic (2.0.31): Downloading (100%)         
Created project in basic
Loading composer repositories with package information
Updating dependencies (including require-dev)
...
Writing lock file
Generating autoload files
> yii\composer\Installer::postCreateProject
chmod('runtime', 0777)...done.
chmod('web/assets', 0777)...done.
chmod('yii', 0755)...done.
> yii\composer\Installer::postInstall 
Let's run it:
[mythcat@desk ~]$ cd basic/
[mythcat@desk basic]$ ./yii serve
Server started on http://localhost:8080/
Document root is "/home/mythcat/basic/web"
Quit the server with CTRL-C or COMMAND-C.
[Tue Jan 14 22:20:22 2020] [::1]:34072 [200]: /
[Tue Jan 14 22:20:22 2020] [::1]:34074 [200]: /assets/dd70c73/css/bootstrap.css
[Tue Jan 14 22:20:22 2020] [::1]:34076 [200]: /css/site.css
[Tue Jan 14 22:20:22 2020] [::1]:34078 [200]: /assets/afa8d426/jquery.js
[Tue Jan 14 22:20:22 2020] [::1]:34080 [200]: /assets/3235fb02/yii.js
[Tue Jan 14 22:20:22 2020] [::1]:34082 [200]: /assets/dd70c73/js/bootstrap.js
[Tue Jan 14 22:20:23 2020] [::1]:34084 [200]: /index.php?r=debug%2Fdefault%2Ftoolbar&tag=5e1e228626c18 

Monday, January 6, 2020

Fedora 31 : Can be better? part 004.

The common question of any Fedora Linux user: Can be better?.
Yes, we can fix some common errors...
This is a common error generated by the GTK on Fedora distro applications:
[mythcat@desk bin]$ ./studio.sh 

(java:12631): Gtk-WARNING **: 11:45:47.061: Unable to locate theme engine in module_path: "murrine",

(java:12631): Gtk-WARNING **: 11:45:47.061: Unable to locate theme engine in module_path: "murrine",

(java:12631): Gtk-WARNING **: 11:45:47.106: Unable to locate theme engine in module_path: "murrine",
...
First, find the running GUI environment from the terminal:
[mythcat@desk ~]$ echo $XDG_CURRENT_DESKTOP
X-Cinnamon
This allows us to know that the issue may be a GTK theme package.
[root@desk bin]# dnf install gtk-murrine-engine.x86_64
Last metadata expiration check: 0:45:00 ago on Mon 06 Jan 2020 11:14:27 AM EET.
Dependencies resolved.
...
Installed:
  gtk-murrine-engine-0.98.2-17.fc31.x86_64                                      

Complete!
Now the Android Studio works well without warning errors:
[mythcat@desk bin]$ ./studio.sh 
Jan 06, 2020 12:00:51 PM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
...

Saturday, January 4, 2020

Fedora 31 : Install MongoDB on Fedora 31 distro.

Today I will show you how to install the MongoDB on Fedora 31 distro. MongoDB is a general-purpose, document-based, distributed database built for modern application developers and for the cloud.
You can see the source code for MongoDb at the GitHub website.
First, you need to create a repository file.
[mythcat@desk ~]$ su
Password: 
[root@desk mythcat]# vi /etc/yum.repos.d/mongodb.repo
Add the code for this repository file.
[mongodb-org-4.2]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/testing/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc
Let's search this Fedora apckage with dnf tool
[root@desk mythcat]# dnf search mongodb-org
MongoDB Repository                                        5.8 kB/s | 6.5 kB     00:01    
=========================== Name Exactly Matched: mongodb-org ============================
mongodb-org.x86_64 : MongoDB open source document-oriented database system (metapackage)
=============================== Name Matched: mongodb-org ================================
mongodb-org-shell.x86_64 : MongoDB shell client
mongodb-org-tools.x86_64 : MongoDB tools
mongodb-org-mongos.x86_64 : MongoDB sharded cluster query router
mongodb-org-server.x86_64 : MongoDB database server
[root@desk mythcat]# dnf install mongodb-org.x86_64 
Last metadata expiration check: 0:01:46 ago on Fri 03 Jan 2020 05:27:49 PM EET.
Dependencies resolved.
==========================================================================================
 Package                 Arch        Version                   Repository            Size
==========================================================================================
Installing:
 mongodb-org             x86_64      4.2.2-0.1.rc1.el8         mongodb-org-4.2       10 k
Installing dependencies:
 mongodb-org-mongos      x86_64      4.2.2-0.1.rc1.el8         mongodb-org-4.2       14 M
 mongodb-org-server      x86_64      4.2.2-0.1.rc1.el8         mongodb-org-4.2       25 M
 mongodb-org-shell       x86_64      4.2.2-0.1.rc1.el8         mongodb-org-4.2       17 M
 mongodb-org-tools       x86_64      4.2.2-0.1.rc1.el8         mongodb-org-4.2       47 M

Transaction Summary
==========================================================================================
Install  5 Packages

Total download size: 103 M
Installed size: 260 M
Is this ok [y/N]: y
...
 From       : https://www.mongodb.org/static/pgp/server-4.2.asc
Is this ok [y/N]: y
Key imported successfully
...
Installed:
  mongodb-org-4.2.2-0.1.rc1.el8.x86_64        mongodb-org-mongos-4.2.2-0.1.rc1.el8.x86_64
  mongodb-org-server-4.2.2-0.1.rc1.el8.x86_64 mongodb-org-shell-4.2.2-0.1.rc1.el8.x86_64 
  mongodb-org-tools-4.2.2-0.1.rc1.el8.x86_64 

Complete!
Start and enable MongoDB service to start on boot.
[root@desk mythcat]# systemctl start mongod
[root@desk mythcat]# sudo systemctl enable mongod
[root@desk mythcat]# systemctl status mongod
● mongod.service - MongoDB Database Server
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabl>
   Active: active (running) since Fri 2020-01-03 17:32:36 EET; 17s ago
     Docs: https://docs.mongodb.org/manual
 Main PID: 9019 (mongod)
   Memory: 71.0M
      CPU: 890ms
   CGroup: /system.slice/mongod.service
           └─9019 /usr/bin/mongod -f /etc/mongod.conf

Jan 03 17:32:34 desk systemd[1]: Starting MongoDB Database Server...
Jan 03 17:32:34 desk mongod[9017]: about to fork child process, waiting until server is r>
Jan 03 17:32:34 desk mongod[9017]: forked process: 9019
Jan 03 17:32:36 desk mongod[9017]: child process started successfully, parent exiting
Jan 03 17:32:36 desk systemd[1]: Started MongoDB Database Server.
Jan 03 17:32:47 desk systemd[1]: /usr/lib/systemd/system/mongod.service:16: PIDFile= refe>
...
Use the netstat utility to confirm that indeed Mongod service is listening.
[root@desk mythcat]# netstat -pnltu | grep mongo
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      9019/mongod
Create an admin user with elevated privileges to perform elevated tasks.
[root@desk mythcat]# mongo
MongoDB shell version v4.2.2-rc1
...
> use admin 
switched to db admin
> db.createUser(
...  {
...  user: "admin",
...  pwd: "123",
...  roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
...  }
...  )
Successfully added user: {
 "user" : "admin",
 "roles" : [
  {
   "role" : "userAdminAnyDatabase",
   "db" : "admin"
  }
 ]
}
Show the users:
> show users
{
 "_id" : "admin.admin",
 "userId" : UUID("5ca3a1c2-6225-4158-b2bc-e32e5e5de58f"),
 "user" : "admin",
 "db" : "admin",
 "roles" : [
  {
   "role" : "userAdminAnyDatabase",
   "db" : "admin"
  }
 ],
 "mechanisms" : [
  "SCRAM-SHA-1",
  "SCRAM-SHA-256"
 ]
}
To enable authentication edit the /lib/systemd/system/mongod.service file, under the [Service] section, locate and edit the Environment parameter as shown.
[root@desk mythcat]# vim /lib/systemd/system/mongod.service
...
[Unit]
Description=MongoDB Database Server
Documentation=https://docs.mongodb.org/manual
After=network.target

[Service]
User=mongod
Group=mongod
Environment="OPTIONS= --auth -f /etc/mongod.conf"
...
Apply the changes to the service mongo unit.
[root@desk mythcat]# systemctl daemon-reload
[root@desk mythcat]# systemctl restart mongod
[root@desk mythcat]# systemctl status mongod
● mongod.service - MongoDB Database Server
   Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disable>
   Active: active (running) since Fri 2020-01-03 17:44:09 EET; 11s ago
     Docs: https://docs.mongodb.org/manual
  Process: 9272 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUC>
  Process: 9273 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, s>
  Process: 9274 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/S>
  Process: 9275 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 9277 (mongod)
   Memory: 168.3M
      CPU: 1.423s
   CGroup: /system.slice/mongod.service
           └─9277 /usr/bin/mongod --auth -f /etc/mongod.conf
...