Posted
Filed under Computer/Linux
Backup your important data

Clone rocky-tools
# git clone https://github.com/rocky-linux/rocky-tools.git

# cd rocky-tools/migrate2rocky
Run rocky-tool
# chmod +x migrate2rocky.sh
# ./migrate2rocky.sh -r
...

Reboot the system
# reboot 

Select Rocky Linux kernel.
(Boot prompt show all existing kernel and rocky kernel)
2022/06/16 02:14 2022/06/16 02:14
[로그인][오픈아이디란?]
Posted
Filed under Computer/Linux
# yum update
Last metadata expiration check: 0:06:06 ago on Tue 14 Jun 2022 06:27:04 PM PDT.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Error: 
 Problem: package centos-stream-release-8.6-1.el8.noarch requires centos-stream-repos, but none of the providers can be installed
  - package centos-linux-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-2.el8.noarch
  - package centos-stream-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-2.el8.noarch
  - package centos-linux-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-3.el8.noarch
  - package centos-stream-repos-8-3.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-2.el8.noarch
  - package centos-linux-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-4.el8.noarch
  - package centos-stream-repos-8-4.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-2.el8.noarch
  - package centos-linux-repos-8-2.el8.noarch conflicts with centos-repos(8) provided by centos-stream-repos-8-6.el8.noarch
  - package centos-stream-repos-8-6.el8.noarch conflicts with centos-repos(8) provided by centos-linux-repos-8-2.el8.noarch
  - cannot install the best update candidate for package centos-linux-release-8.3-1.2011.el8.noarch
  - problem with installed package centos-linux-repos-8-2.el8.noarch
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)



But can not remove centos-linux-repos-8-2.el8.noarch .
# yum erase --skip-broken --nobest centos-linux-repos-8-2.el8.noarch 
Error: 
 Problem: The operation would result in removing the following protected packages: setup

This time you can upgrade repo then automatically remove that repo.
# dnf swap centos-{linux,stream}-repos
Dependencies resolved.
======================================================================================================================================================================================================================================
 Package                                                         Architecture                                     Version                                               Repository                                               Size
======================================================================================================================================================================================================================================
Installing:
 centos-stream-release                                           noarch                                           8.6-1.el8                                             Stream-BaseOS                                            22 k
     replacing  centos-linux-release.noarch 8.3-1.2011.el8
     replacing  centos-release-stream.x86_64 8.1-1.1911.0.7.el8
 centos-stream-repos                                             noarch                                           8-6.el8                                               Stream-BaseOS                                            20 k
Upgrading:
 centos-gpg-keys                                                 noarch                                           1:8-6.el8                                             Stream-BaseOS                                            14 k
Removing:
 centos-linux-repos                                              noarch                                           8-2.el8                                               @BaseOS                                                  26 k
Transaction Summary
======================================================================================================================================================================================================================================
Install  2 Packages
Upgrade  1 Package
Remove   1 Package
Total download size: 57 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): centos-stream-release-8.6-1.el8.noarch.rpm                                                                                                                                                     118 kB/s |  22 kB     00:00    
(2/3): centos-stream-repos-8-6.el8.noarch.rpm                                                                                                                                                         105 kB/s |  20 kB     00:00    
(3/3): centos-gpg-keys-8-6.el8.noarch.rpm                                                                                                                                                              75 kB/s |  14 kB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                  96 kB/s |  57 kB     00:00     

and everything OK.
2022/06/15 11:11 2022/06/15 11:11
[로그인][오픈아이디란?]
Posted
Filed under Computer/Linux
Install CentOS 7 

Download Raspberry PI OS from 
http://mirror.keystealth.org/centos-altarch/7.9.2009/isos/armhfp/CentOS-Userland-7-armv7hl-RaspberryPI-GNOME-2009-sda.raw.xz

Download Raspberry PI Imager from https://www.raspberrypi.org/blog/raspberry-pi-imager-imaging-utility/

Select "CentOS-Userland-7-armv7hl-RaspberryPI-GNOME-2009-sda.raw.xz" file at Operating System button. ( "Use custom" at the bottom )

Insert SD Card at the USB reader then you can see the SD card at the "SD Card"

Click "Write" button.

This CentOS7 os defined 3.5GB filesystem at the SD Card. (partition 3 : / (3G) , 2: swap(500M), 1:/boot)
So, you can modify the filesystem as fit your own SD Card.

Insert your SD Card on your linux machine

If your SD Card device is /dev/sdb then.....
Make a extra partition at the free space
# fdisk /dev/sdb
n
9406464
wq

Format the new device (/dev/sdb4)
# mkfs.ext4 /dev/sdb4

Mount partitions
# mkdir /mnt/boot
# mkdir /mnt/root
# mkdir /mnt/new_root
# mount /dev/sdb1 /mnt/boot
# mount /dev/sdb3 /mnt/root
# mount /dev/sdb4 /mnt/new_root

Copy whole filesystems to new partition
# cd /mnt/root
# rsync -a --progress . /mnt/new_root

Modify the root device definition at the kernel parameter
# vi /mnt/boot/cmdline.txt
-----------------------------------------------------
console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 rootfstype=ext4 elevator=deadline rootwait
---------------Change to below-------------------
console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p4 rootfstype=ext4 elevator=deadline rootwait
------------------------------------------------------

Modify the root partition at the fstab
# vi /mnt/new_root/etc/fstab
-----------------------------------------------------
UUID=125a472a-16a7-4c65-af22-ca19632sc8fa  / ext4    defaults,noatime 0 0
UUID=F10D-3C64  /boot vfat    defaults,noatime 0 0
UUID=2fd27705-271d-4059-ae11-247ac8f2efde  swap swap    defaults,noatime 0 0
---------------Change to below-------------------
/dev/mmcblk0p4  / ext4    defaults,noatime 0 0
UUID=F10D-3C64  /boot vfat    defaults,noatime 0 0
UUID=2fd27705-271d-4059-ae11-247ac8f2efde  swap swap    defaults,noatime 0 0
-----------------------------------------------------

Disable selinux
# vi /mnt/new_root/etc/selinux/config
Change from enforcing to disabled

Unmount 
# umount /mnt/boot /mnt/new_root /mnt/root

Insert the SD Card to Raspberry PI.

You can now use the big root filesystem on your SD Card.

If you want increase the swap partition then change the old root partition to swap partition

Make a swap partition at the old root device
$ sudo fdisk /dev/mmcblk0

3
82
wq
$ sudo mkswap /dev/mmcblk0p3

Add a line at the /etc/fstab file with UUID information
$ sudo vi /etc/fstab
UUID=1251472a-16a7-4c25-af22-ca1964ac8fd0  swap swap    defaults,noatime 0 0

$ sudo swapon /dev/mmcblk0p3

Now you can use big swap and big filesystem.
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       113G  3.2G  104G   3% /
devtmpfs        430M     0  430M   0% /dev
tmpfs           463M     0  463M   0% /dev/shm
tmpfs           463M   13M  451M   3% /run
tmpfs           463M     0  463M   0% /sys/fs/cgroup
/dev/mmcblk0p1  286M   55M  231M  20% /boot
tmpfs            93M   12K   93M   1% /run/user/42
tmpfs            93M     0   93M   0% /run/user/1000
tmpfs            93M     0   93M   0% /run/user/1001

$ cat /proc/swaps
Filename Type Size Used Priority
/dev/mmcblk0p2                          partition 499708 4352 -2
/dev/mmcblk0p3                          partition 3906556 0 -3

I tested many OS. but mine case, CentOS 7 is better than others.
2021/01/06 10:15 2021/01/06 10:15
[로그인][오픈아이디란?]
Posted
Filed under Computer/Linux
Already installed shellinabox and setup Google authenticator for your account.

Setup virtual network interface on your system.
(for example: tun0, kvm network)
(example ip : 10.0.0.2)

setup google authenticator access list file.
# vi /etc/security/access-local.conf
------------------------------------------------------------
+ : ALL : xxx.xxx.xxx.0/24  # your inside network
+ : ALL : LOCAL    # Local host 
- : ALL : ALL   # all other's IP need google Auth.
------------------------------------------------------------

Add above rule at the pam file.
# vi /etc/pam.d/sshd
------------------------------------------------------------
auth [success=1 default=ignore] pam_access.so accessfile=/etc/security/access-local.conf
auth required pam_google_authenticator.so
------------------------------------------------------------

Change shellinabox configuration using SSH at OPTS (virtual device ip: 10.0.0.2)
# vi /etc/sysconfig/shellinaboxd
-------------------------------------------------------------
OPTS="-s /:SSH:10.0.0.2"
-------------------------------------------------------------


restart daemon
# systemctl restart shellinaboxd

if you login with web then you can see asking google Auth. before password.
2020/12/11 03:53 2020/12/11 03:53
[로그인][오픈아이디란?]
Posted
Filed under Computer/Linux

##################################

## <OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h> => OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h: No such file or directory

##################################

If fixing videoio.h, png.h and FFMPEG then it will be fixed

 

##################################

## videoio.h DBG (videodev2.h comes from kernel-headers)

##################################

$ cd /usr/include/sys/

$ sudo ln -s /usr/include/linux/videodev2.h videoio.h

 

##################################

## make sure the OPENCV_EXTRA_MODULES_PATH correct path for cl.h

##################################

 -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_build/opencv_contrib/modules \

 

##################################

## png.h DBG

##################################

# rpm -ql libpng-devel | grep png.h

/usr/include/libpng16/png.h

/usr/include/png.h

# mkdir /usr/include/libpng

# cd /usr/include/libpng

# ln -s ../png*.h .

 

## videoio.h DBG

$ yum whatprovides videoio.h

$ yum whatprovides avformat.h

 

##################################

## FFMPEG Issue

##################################

## CentOS 7 Install from Source)

$ sudo yum install epel-release

$ sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

$ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm

$ sudo yum install ffmpeg ffmpeg-devel

 

##################################

##CentOS8 (RPM Download if you want rpm)

# https://pkgs.dyn.su/el8/multimedia/x86_64/ffmpeg-4.2.2-2.el8.x86_64.rpm

# https://pkgs.dyn.su/el8/multimedia/x86_64/ffmpeg-libs-4.2.2-2.el8.x86_64.rpm

# https://pkgs.dyn.su/el8/multimedia/x86_64/ffmpeg-devel-4.2.2-2.el8.x86_64.rpm

# https://pkgs.dyn.su/el8/multimedia/SRPMS/ffmpeg-4.2.2-2.el8.src.rpm 

 

##or CentOS8 (Install)

## FFMPEG Requirements on CentOS8

$ sudo yum install --enablerepo=PowerTools SDL2 SDL2-devel

## Install FFMPEG

$ sudo yum install --enablerepo=raven-multimedia https://pkgs.dyn.su/el8/base/x86_64/raven-release-1.0-1.el8.noarch.rpm

# install --enablerepo=raven-multimedia ffmpeg-devel ffmpeg

 

##################################

## or Install from source

$ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

$ cd ffmpeg

$ ./configure

## or

$ ./configure --disable-x86asm  # Disable nasm dependency

$ make

$ sudo make install

 

##################################

## Base requirements

##################################

## CentOS 7

$ sudo yum install cmake cmake3 gcc gcc-c++ qt5-qtbase-devel libpng-devel gtk2-devel jasper-devel openxr-devel libwebp-devel libjpeg-turbo-devel libtiff-devel tbb-devel libv41-devel eigen3-devel freeglut-devel mesa-libGL mesa-libGL-devel boost boost-thread boost-devel gstreamer1-plugins-base libpng-devel libjpeg-turbo-devel jasper-devel openexr-devel libtiff-devel libwebp-devel python-devel python2-numpy numpy python34-numpy libdc1394-devel

##################################

## CentOS8

$ sudo yum install cmake cmake3 gcc gcc-c++ qt5-qtbase-devel libpng-devel gtk2-devel libwebp-devel libjpeg-turbo-devel libtiff-devel tbb-devel freeglut-devel mesa-libGL mesa-libGL-devel boost boost-thread boost-devel gstreamer1-plugins-base libpng-devel libjpeg-turbo-devel libtiff-devel libwebp-devel python2-numpy

 

##################################

## Install OpenCV

##################################

$ cd /tmp
$ mkdir opencv_build

$ cd opencv_build

$ git clone https://github.com/opencv/opencv.git

$ git clone https://github.com/opencv/opencv_contrib.git
$ cd opencv

$ mkdir build

$ cd build

$ cmake3 -D CMAKE_BUILD_TYPE=RELEASE \

 -D CMAKE_INSTALL_PREFIX=/usr/local \

 -D INSTALL_C_EXAMPLES=ON \

 -D INSTALL_PYTHON_EXAMPLES=ON \

 -D OPENCV_GENERATE_PKGCONFIG=ON \

 -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_build/opencv_contrib/modules \

 -D BUILD_OPENCV_PYTHON2=ON \

 -D BUILD_EXAMPLES=ON ..

 

$ make -j8

 

$ sudo make install

Check OpenCV version

$ python3
>>> import cv2
>>> cv2.__version__
'4.4.0-dev'

>>> (major, minor, _) = cv2.__version__.split(".")

>>> major

'4'

>>> minor

'4'

>>> _

 

'0-dev'

2020/09/07 03:08 2020/09/07 03:08
[로그인][오픈아이디란?]