Saturday, December 11, 2021

Increase ubuntu swap

 root@obs-server:/home/obs# swapoff /swap.img

root@obs-server:/home/obs# rm /swap.img

root@obs-server:/home/obs# sudo dd if=/dev/zero of=/swap.img bs=1M count=16384

16384+0 records in

16384+0 records out

17179869184 bytes (17 GB, 16 GiB) copied, 106.527 s, 161 MB/s

root@obs-server:/home/obs# mkswap /swap.img

mkswap: /swap.img: insecure permissions 0644, 0600 suggested.

Setting up swapspace version 1, size = 16 GiB (17179865088 bytes)

no label, UUID=0ebd4780-f6ff-4f33-89f6-5defa0c59484

root@obs-server:/home/obs# swapon  /swap.img

swapon: /swap.img: insecure permissions 0644, 0600 suggested.

root@obs-server:/home/obs# chmod 600 /swapfile

chmod: cannot access '/swapfile': No such file or directory

root@obs-server:/home/obs# ^C

root@obs-server:/home/obs# chmod 600 /swap.img

root@obs-server:/home/obs# swapon  /swap.img

swapon: /swap.img: swapon failed: Device or resource busy

root@obs-server:/home/obs# swapoff  /swap.img

root@obs-server:/home/obs# swapon  /swap.img


Friday, December 10, 2021

Installing OBS on Ubuntu

Faced this issue:

https://obsproject.com/forum/threads/obs-ndi-4-9-1-1-error-dependency-is-not-satisfiable-obs-studio-25-0-7.131703/


Solution:

https://github.com/Palakis/obs-ndi/issues/497

https://obsproject.com/wiki/install-instructions#linux

sudo apt -y remove obs-ndi obs-studio obs-plugins libobs0

 sudo apt install ffmpeg 

sudo apt install v4l2loopback-dkms
 sudo add-apt-repository ppa:obsproject/obs-studio
 sudo apt update
 sudo apt install obs-studio

Installing GUI on ubuntu

 How to Install a Graphical User Interface on Ubuntu Server (servermania.com)

Tuesday, November 30, 2021

Install Link

 Need to install mongodb

Need to install

yum install libnsl


Unset JAVA_HOME before running Link install

Wednesday, November 17, 2021

Setting up multiple tomcat instances

 https://dzone.com/articles/run-configure-multiple-instance-in-a-single-tomcat

Thursday, November 11, 2021

Auto-mount /cdrom

1. In EXSi, make sure cdrom drive is connected


2. Find out the blockid of cdrom device:

 blkid /dev/cdrom

/dev/cdrom: BLOCK_SIZE="2048" UUID="2021-05-03-15-21-56-00" LABEL="RHEL-8-4-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="426eea3b" PTTYPE="dos"


3. Add entry in /etc/fstab


UUID=2021-05-03-15-21-56-00 /cdrom      iso9660 ro,user,auto  0 0


Done (can run "mount /cdrom")


 df -k

Filesystem                             1K-blocks    Used Available Use% Mounted on

devtmpfs                                 8075472       0   8075472   0% /dev

tmpfs                                    8105800       0   8105800   0% /dev/shm

tmpfs                                    8105800    9492   8096308   1% /run

tmpfs                                    8105800       0   8105800   0% /sys/fs/cgroup

/dev/mapper/rhel_database--rhel84-root  31441920 4695768  26746152  15% /

/dev/mapper/rhel_database--rhel84-data 104806400  763756 104042644   1% /data

/dev/sda2                                1038336  242324    796012  24% /boot

/dev/sr0                                 9892300 9892300         0 100% /cdrom

/dev/mapper/rhel_database--rhel84-home  11020288  123784  10896504   2% /home

/dev/sda1                                 613184    5892    607292   1% /boot/efi

tmpfs                                    1621160    1180   1619980   1% /run/user/42

tmpfs                                    1621160       0   1621160   0% /run/user/0


Monday, September 20, 2021

Resize disk - growpart

 This is a very useful tool to resize your disk.

See this: Enlarge a disk and partition of any Linux VM without a reboot - CodeNotary

For Redhat, use this article: https://access.redhat.com/solutions/5540131


login as: root

root@192.168.0.52's password:

Last login: Mon Sep 20 17:50:45 2021 from gateway

[root@database-rhel79 ~]# df -k

Filesystem                             1K-blocks     Used Available Use% Mounted on

devtmpfs                                49301728        0  49301728   0% /dev

tmpfs                                   49318592        0  49318592   0% /dev/shm

tmpfs                                   49318592     9524  49309068   1% /run

tmpfs                                   49318592        0  49318592   0% /sys/fs/cgroup

/dev/mapper/rhel_database--rhel79-root  46110724 44819440   1291284  98% /

/dev/sda1                                1038336   242192    796144  24% /boot

/dev/sdb1                               50442784 31384040  16473352  66% /data

tmpfs                                    9863720        8   9863712   1% /run/user/42

tmpfs                                    9863720        0   9863720   0% /run/user/0

[root@database-rhel79 ~]# fdisk -l


Disk /dev/sdb: 161.1 GB, 161061273600 bytes, 314572800 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x2551332d


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048   102762495    51380224   83  Linux


Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000bbcfa


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200   104857599    51379200   8e  Linux LVM


Disk /dev/mapper/rhel_database--rhel79-root: 47.2 GB, 47240445952 bytes, 92266496 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/mapper/rhel_database--rhel79-swap: 5368 MB, 5368709120 bytes, 10485760 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes


[root@database-rhel79 ~]# growpart /dev/sdb 1

bash: growpart: command not found...

[root@database-rhel79 ~]# resize2fs /dev/sdb1

resize2fs 1.42.9 (28-Dec-2013)

The filesystem is already 12845056 blocks long.  Nothing to do!


[root@database-rhel79 ~]# cat /sys/class/block/sdb/device/rescan

cat: /sys/class/block/sdb/device/rescan: Permission denied

[root@database-rhel79 ~]# id

uid=0(root) gid=0(root) groups=0(root)

[root@database-rhel79 ~]# ls -l /sys/class/block/sdb/device/rescan

--w------- 1 root root 4096 Sep 20 17:59 /sys/class/block/sdb/device/rescan

[root@database-rhel79 ~]# yum install cloud-utils

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager


No package cloud-utils available.

Error: Nothing to do

[root@database-rhel79 ~]#

[root@database-rhel79 ~]# yum install cloud-utils-growpart

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager

Resolving Dependencies

--> Running transaction check

---> Package cloud-utils-growpart.noarch 0:0.29-5.el7 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


=======================================================================================================================================================================

 Package                                       Arch                            Version                               Repository                                   Size

=======================================================================================================================================================================

Installing:

 cloud-utils-growpart                          noarch                          0.29-5.el7                            rhel-7-server-rpms                           27 k


Transaction Summary

=======================================================================================================================================================================

Install  1 Package


Total download size: 27 k

Installed size: 61 k

Is this ok [y/d/N]: y

Downloading packages:

cloud-utils-growpart-0.29-5.el7.noarch.rpm                                                                                                      |  27 kB  00:00:06

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : cloud-utils-growpart-0.29-5.el7.noarch                                                                                                              1/1

  Verifying  : cloud-utils-growpart-0.29-5.el7.noarch                                                                                                              1/1


Installed:

  cloud-utils-growpart.noarch 0:0.29-5.el7


Complete!

[root@database-rhel79 ~]# growpart /dev/sdb 1

CHANGED: partition=1 start=2048 old: size=102760448 end=102762496 new: size=314570719 end=314572767

[root@database-rhel79 ~]# df -k

Filesystem                             1K-blocks     Used Available Use% Mounted on

devtmpfs                                49301728        0  49301728   0% /dev

tmpfs                                   49318592        0  49318592   0% /dev/shm

tmpfs                                   49318592     9496  49309096   1% /run

tmpfs                                   49318592        0  49318592   0% /sys/fs/cgroup

/dev/mapper/rhel_database--rhel79-root  46110724 44821624   1289100  98% /

/dev/sda1                                1038336   242192    796144  24% /boot

/dev/sdb1                               50442784 31384040  16473352  66% /data

tmpfs                                    9863720       12   9863708   1% /run/user/42

tmpfs                                    9863720        0   9863720   0% /run/user/0

[root@database-rhel79 ~]# resize2fs /dev/sdb1

resize2fs 1.42.9 (28-Dec-2013)

Filesystem at /dev/sdb1 is mounted on /data; on-line resizing required

old_desc_blocks = 7, new_desc_blocks = 19

The filesystem on /dev/sdb1 is now 39321339 blocks long.


[root@database-rhel79 ~]# df -k

Filesystem                             1K-blocks     Used Available Use% Mounted on

devtmpfs                                49301728        0  49301728   0% /dev

tmpfs                                   49318592        0  49318592   0% /dev/shm

tmpfs                                   49318592     9496  49309096   1% /run

tmpfs                                   49318592        0  49318592   0% /sys/fs/cgroup

/dev/mapper/rhel_database--rhel79-root  46110724 44821568   1289156  98% /

/dev/sda1                                1038336   242192    796144  24% /boot

/dev/sdb1                              154685884 31391512 116472880  22% /data

tmpfs                                    9863720       12   9863708   1% /run/user/42

tmpfs                                    9863720        0   9863720   0% /run/user/0


Tuesday, September 14, 2021

Tomcat error: because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

See: https://stackoverflow.com/questions/58591273/what-is-the-correct-cache-size-to-prevent-tomcat-log-from-getting-flooded-with-c



 I am running Apache Tomcat/9.0.19 and recently I have noticed a lot of warning messages on the catalina.out log.

WARNING [main] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/WEB-INF/classes/static/maps/scripts/app-72be477367.js.map] to the cache for web application [##01] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

WARNING [main] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at [/WEB-INF/classes/static/maps/scripts/app-f223be6846.js.map] to the cache for web application [##01] because there was insufficient free space available after evicting expired cache entries - consider increasing the maximum size of the cache

Adding the following line to the conf/context.xml solves this problem and my log is no longer flooded.

 <Resources cachingAllowed="true" cacheMaxSize="100000" />

Saturday, September 11, 2021

Add new disk to redhat

reference: https://www.tecmint.com/add-new-disk-to-an-existing-linux/


 [root@database-rhel79 ~]# df -k

Filesystem                             1K-blocks     Used Available Use% Mounted on

devtmpfs                                16372740        0  16372740   0% /dev

tmpfs                                   16389744        0  16389744   0% /dev/shm

tmpfs                                   16389744    25812  16363932   1% /run

tmpfs                                   16389744        0  16389744   0% /sys/fs/cgroup

/dev/mapper/rhel_database--rhel79-root  46110724 40634232   5476492  89% /

/dev/sda1                                1038336   228548    809788  23% /boot

tmpfs                                    3270168       12   3270156   1% /run/user/42

tmpfs                                    3270168        0   3270168   0% /run/user/0

[root@database-rhel79 ~]# fdisk -l


Disk /dev/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000bbcfa


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200   104857599    51379200   8e  Linux LVM


Disk /dev/mapper/rhel_database--rhel79-root: 47.2 GB, 47240445952 bytes, 92266496 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/mapper/rhel_database--rhel79-swap: 5368 MB, 5368709120 bytes, 10485760 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes


[root@database-rhel79 ~]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.23.2).


Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.


Device does not contain a recognized partition table

Building a new DOS disklabel with disk identifier 0x2551332d.


Command (m for help): n

Partition type:

   p   primary (0 primary, 0 extended, 4 free)

   e   extended

Select (default p): p

Partition number (1-4, default 1): 1

First sector (2048-104857599, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +50G

Value out of range.

Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +52G

Value out of range.

Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +49G

Partition 1 of type Linux and of size 49 GiB is set


Command (m for help): w

The partition table has been altered!


Calling ioctl() to re-read partition table.

Syncing disks.

[root@database-rhel79 ~]#

[root@database-rhel79 ~]# mkfs.ext4 /dev/sdb1

mke2fs 1.42.9 (28-Dec-2013)

Discarding device blocks: done

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

Stride=0 blocks, Stripe width=0 blocks

3211264 inodes, 12845056 blocks

642252 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=2162163712

392 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000, 7962624, 11239424


Allocating group tables: done

Writing inode tables: done

Creating journal (32768 blocks): done

Writing superblocks and filesystem accounting information: done


[root@database-rhel79 ~]# mount /dev/sdb1 '^C

[root@database-rhel79 ~]# mkdir /data

[root@database-rhel79 ~]# mount /dev/sdb1 /data

[root@database-rhel79 ~]# df -k

Filesystem                             1K-blocks     Used Available Use% Mounted on

devtmpfs                                16372740        0  16372740   0% /dev

tmpfs                                   16389744        0  16389744   0% /dev/shm

tmpfs                                   16389744    26032  16363712   1% /run

tmpfs                                   16389744        0  16389744   0% /sys/fs/cgroup

/dev/mapper/rhel_database--rhel79-root  46110724 40600652   5510072  89% /

/dev/sda1                                1038336   228548    809788  23% /boot

tmpfs                                    3270168       32   3270136   1% /run/user/0

/dev/sr0                                 4420474  4420474         0 100% /run/media/root/RHEL-7.9 Server.x86_64

/dev/sdb1                               50442784    53272  47804120   1% /data

[root@database-rhel79 ~]# chmod 777 /data


Make an entry in /etc/fstab file for permanent mount at boot time.

/dev/xvdc1	/data	ext4	defaults     0   0




Thursday, June 24, 2021

Disabling redhat subscription manager

 





two solutions

in the plugin configuration file disable plugin

vim /etc/yum/pluginconf.d/subscription-manager.conf

enabled=0


or register to the satellite

Friday, June 11, 2021

SSH and Dockers

 https://stackoverflow.com/questions/34932490/inject-hosts-ssh-keys-into-docker-machine-with-docker-compose

https://github.com/avsm/docker-ssh-agent-forward

https://stackoverflow.com/questions/27504187/ssh-key-generation-using-dockerfile

Wednesday, June 2, 2021

Slow SSH

 I tried this:

RHEL7:
Symptom: 34 seconds to prompt password ssh login
Solution (my case):
- vi /etc/ssh/sshd_config
- GSSAPIAuthentication no
- service sshd restart

Other Linux versión:
vi /etc/ssh/sshd_config
UseDNS no

vi /etc/resolv.conf
options single-request-reopen ;in the last line. No network restart required


but none worked... in the end, the solution is to put my gateway into /etc/hosts


Solved!!!

Wednesday, May 5, 2021

How to increase XFS root filesystem

 Reference: 

linux - How to resize root partition online , on xfs filesystem? - Stack Overflow

Expanding (resize) persistent & mounted Centos 7 disk size in Custom Google Compute Image. · GitHub


[root@okd4-services ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

devtmpfs        7.8G     0  7.8G   0% /dev

tmpfs           7.8G     0  7.8G   0% /dev/shm

tmpfs           7.8G   18M  7.8G   1% /run

tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup

/dev/sda4        91G   91G   26M 100% /

/dev/sda2       976M  258M  651M  29% /boot

/dev/sda1       599M  6.9M  592M   2% /boot/efi

tmpfs           1.6G  1.2M  1.6G   1% /run/user/42

overlay          91G   91G   26M 100% /var/lib/docker/overlay2/6848dec23c5ea31afdcc552cf8a2d44ad792b75d2e62fd4185a0274f72afa6ab/merged

tmpfs           1.6G  4.0K  1.6G   1% /run/user/1001

tmpfs           1.6G  6.8M  1.6G   1% /run/user/1000

/dev/sr0        7.7G  7.7G     0 100% /run/media/unica/CentOS-8-2-2004-x86_64-dvd

tmpfs           1.6G  4.0K  1.6G   1% /run/user/0

[root@okd4-services ~]#  xfs_growfs -d ^C

[root@okd4-services ~]# growpart

bash: growpart: command not found...

Install package 'cloud-utils-growpart' to provide command 'growpart'? [N/y] y



 * Waiting in queue...

 * Loading list of packages....

The following packages have to be installed:

 cloud-utils-growpart-0.31-1.el8.noarch Script for growing a partition

Proceed with changes? [N/y] y



 * Waiting in queue...

 * Waiting for authentication...

 * Waiting in queue...

 * Loading list of packages....

 * Downloading packages...

 * Requesting data...

 * Testing changes...

 * Installing packages...

growpart disk partition

   rewrite partition table so that partition takes up all the space it can

   options:

    -h | --help       print Usage and exit

         --fudge F    if part could be resized, but change would be

                      less than 'F' bytes, do not resize (default: 1048576)

    -N | --dry-run    only report what would be done, show new 'sfdisk -d'

    -v | --verbose    increase verbosity / debug

    -u | --update  R  update the the kernel partition table info after growing

                      this requires kernel support and 'partx --update'

                      R is one of:

                       - 'auto'  : [default] update partition if possible

                       - 'force' : try despite sanity checks (fail on failure)

                       - 'off'   : do not attempt

                       - 'on'    : fail if sanity checks indicate no support


   Example:

    - growpart /dev/sda 1

      Resize partition 1 on /dev/sda

must supply disk and partition-number


[root@okd4-services ~]# growpart /dev/sda 4

CHANGED: partition=4 start=20105216 old: size=189607936 end=209713152 new: size=231552991 end=251658207

[root@okd4-services ~]# xfs_growfs -d /dev/sda4

meta-data=/dev/sda4              isize=512    agcount=4, agsize=5925248 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=1, sparse=1, rmapbt=0

         =                       reflink=1

data     =                       bsize=4096   blocks=23700992, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1

log      =internal log           bsize=4096   blocks=11572, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

data blocks changed from 23700992 to 28944123

[root@okd4-services ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

devtmpfs        7.8G     0  7.8G   0% /dev

tmpfs           7.8G     0  7.8G   0% /dev/shm

tmpfs           7.8G   18M  7.8G   1% /run

tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup

/dev/sda4       111G   91G   20G  82% /

/dev/sda2       976M  258M  651M  29% /boot

/dev/sda1       599M  6.9M  592M   2% /boot/efi

tmpfs           1.6G  1.2M  1.6G   1% /run/user/42

overlay         111G   91G   20G  82% /var/lib/docker/overlay2/6848dec23c5ea31afdcc552cf8a2d44ad792b75d2e62fd4185a0274f72afa6ab/merged

tmpfs           1.6G  4.0K  1.6G   1% /run/user/1001

tmpfs           1.6G  6.8M  1.6G   1% /run/user/1000

/dev/sr0        7.7G  7.7G     0 100% /run/media/unica/CentOS-8-2-2004-x86_64-dvd

tmpfs           1.6G  4.0K  1.6G   1% /run/user/0


Tuesday, April 27, 2021

Enable EPEL on RHEL 8

Reference: https://linuxconfig.org/redhat-8-epel-install-guide


 [root@rhel83 ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Updating Subscription Management repositories.

Unable to read consumer identity


This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.


Last metadata expiration check: 1:00:26 ago on Wed 28 Apr 2021 10:06:22 AM +08.

epel-release-latest-8.noarch.rpm                                                                                             18 kB/s |  22 kB     00:01

Dependencies resolved.

============================================================================================================================================================

 Package                                Architecture                     Version                               Repository                              Size

============================================================================================================================================================

Installing:

 epel-release                           noarch                           8-10.el8                              @commandline                            22 k


Transaction Summary

============================================================================================================================================================

Install  1 Package


Total size: 22 k

Installed size: 32 k

Is this ok [y/N]: y

Downloading Packages:

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                    1/1

  Installing       : epel-release-8-10.el8.noarch                                                                                                       1/1

  Running scriptlet: epel-release-8-10.el8.noarch                                                                                                       1/1

  Verifying        : epel-release-8-10.el8.noarch                                                                                                       1/1

Installed products updated.


Installed:

  epel-release-8-10.el8.noarch


Complete!

[root@rhel83 ~]# rpm -ql epel-release

/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8

/etc/yum.repos.d/epel-modular.repo

/etc/yum.repos.d/epel-playground.repo

/etc/yum.repos.d/epel-testing-modular.repo

/etc/yum.repos.d/epel-testing.repo

/etc/yum.repos.d/epel.repo

/usr/lib/systemd/system-preset/90-epel.preset

/usr/share/doc/epel-release

/usr/share/doc/epel-release/GPL

/usr/share/doc/epel-release/README-epel-8-packaging.md

[root@rhel83 ~]# dnf repolist -v

Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile

Updating Subscription Management repositories.

Unable to read consumer identity


This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.


DNF version: 4.2.23

cachedir: /var/cache/dnf

Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                                                                                                       386 kB/s | 557 kB     00:01

Extra Packages for Enterprise Linux 8 - x86_64                                                                                                                                                               1.0 MB/s | 9.3 MB     00:09

Repo-id            : LocalRepo_AppStream

Repo-name          : LocalRepository_AppStream

Repo-revision      : 1602239687

Repo-updated       : Fri 09 Oct 2020 06:34:17 PM +08

Repo-pkgs          : 5,802

Repo-available-pkgs: 5,072

Repo-size          : 7.1 G

Repo-baseurl       : file:///run/media/mars/RHEL-8-3-0-BaseOS-x86_64/AppStream

Repo-expire        : 172,800 second(s) (last: Wed 28 Apr 2021 10:06:22 AM +08)

Repo-filename      : /etc/yum.repos.d/local.repo


Repo-id            : LocalRepo_BaseOS

Repo-name          : LocalRepository_BaseOS

Repo-revision      : 1602239724

Repo-updated       : Fri 09 Oct 2020 06:34:52 PM +08

Repo-pkgs          : 1,696

Repo-available-pkgs: 1,694

Repo-size          : 1.1 G

Repo-baseurl       : file:///run/media/mars/RHEL-8-3-0-BaseOS-x86_64/BaseOS

Repo-expire        : 172,800 second(s) (last: Wed 28 Apr 2021 10:06:22 AM +08)

Repo-filename      : /etc/yum.repos.d/local.repo


Repo-id            : epel

Repo-name          : Extra Packages for Enterprise Linux 8 - x86_64

Repo-revision      : 1619485425

Repo-updated       : Tue 27 Apr 2021 09:04:16 AM +08

Repo-pkgs          : 7,300

Repo-available-pkgs: 7,297

Repo-size          : 10 G

Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=$infra&content=$contentdir

  Updated          : Wed 28 Apr 2021 11:09:09 AM +08

Repo-baseurl       : http://mirror.earthlink.iq/epel/8/Everything/x86_64/ (27 more)

Repo-expire        : 172,800 second(s) (last: Wed 28 Apr 2021 11:09:09 AM +08)

Repo-filename      : /etc/yum.repos.d/epel.repo


Repo-id            : epel-modular

Repo-name          : Extra Packages for Enterprise Linux Modular 8 - x86_64

Repo-revision      : 1617810544

Repo-updated       : Wed 07 Apr 2021 11:49:16 PM +08

Repo-pkgs          : 120

Repo-available-pkgs: 0

Repo-size          : 412 M

Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=epel-modular-8&arch=x86_64&infra=$infra&content=$contentdir

  Updated          : Wed 28 Apr 2021 11:09:04 AM +08

Repo-baseurl       : rsync://download.nus.edu.sg/epel/8/Modular/x86_64/ (60 more)

Repo-expire        : 172,800 second(s) (last: Wed 28 Apr 2021 11:09:04 AM +08)

Repo-filename      : /etc/yum.repos.d/epel-modular.repo

Total packages: 14,918

[root@rhel83 ~]#


Enable repository on RHEL8

 Reference: https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-create-local-yum-repository-on-rhel-8-using-dvd.html


New Repository in RHEL 8

Red Hat Enterprise Linux 8 is split across two repositories,

  1. BaseOS
  2. Application Stream (AppStream)

Packages in BaseOS is intended to provide the core set of the underlying OS functionality that provides the foundation for all type installations.

Packages in Application Stream includes user space applications, runtime languages, and databases in support of the varied workloads and use cases.

Create Source

Repository’s source can be created either using the createrepo package or mounting the DVD on the directory. Mounting the DVD/CD ROM will help you save the space on HDD used by being copied to HDD.

Here, mount the DVD ROM on any directory of your wish. For testing, I will mount it on /cdrom.

mkdir /cdrom
mount /dev/cdrom /cdrom

Create a .repo file

Before creating a <name>.repo file, move the existing files present in /etc/yum.repos.d/directory to/tmp, if no longer required.

mv /etc/yum.repos.d/*.repo /tmp/

Create a repo file called local.repo under /etc/yum.repos.d directory.

vi /etc/yum.repos.d/local.repo

Base OS

[LocalRepo_BaseOS]
name=LocalRepository_BaseOS
baseurl=file:///cdrom/BaseOS
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

App Stream

[LocalRepo_AppStream]
name=LocalRepository_AppStream
baseurl=file:///cdrom/AppStream
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Details:

[LocalRepo]Name of the Section
nameName of the repository
baseurlLocation of the package
EnabledEnable repository
gpgcheckEnable secure installation (gpgcheck is optional (If you set gpgcheck=0, there is no need to mention gpgkey)
gpgkeyLocation of the key

Install Packages from Local YUM repository

Clear the repository cache by running the following command.
yum clean all

Let’s install the telnet package from the local repository.

yum install vsftpd

The output will be like below.

When you give yes to download the package, it will prompt you to accept gpg signing key.

LocalRepository_AppStream                       3.1 MB/s | 3.2 kB     00:00
LocalRepository_BaseOS                          2.7 MB/s | 2.7 kB     00:00
Dependencies resolved.
================================================================================
 Package      Arch         Version              Repository                 Size
================================================================================
Installing:
 vsftpd       x86_64       3.0.3-28.el8         LocalRepo_AppStream       180 k

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

Total size: 180 k
Installed size: 356 k
Is this ok [y/N]: y
Downloading Packages:
warning: /cdrom/AppStream/Packages/vsftpd-3.0.3-28.el8.x86_64.rpm: Header V3 RSA                                                                                                             /SHA256 Signature, key ID fd431d51: NOKEY
LocalRepository_AppStream                       177 kB/s | 5.0 kB     00:00
Importing GPG key 0xFD431D51:
 Userid     : "Red Hat, Inc. (release key 2) <security@redhat.com>"
 Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 0xD4082792:
 Userid     : "Red Hat, Inc. (auxiliary key) <security@redhat.com>"
 Fingerprint: 6A6A A7C9 7C88 90AE C6AE BFE2 F76F 66C3 D408 2792
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : vsftpd-3.0.3-28.el8.x86_64                             1/1
  Running scriptlet: vsftpd-3.0.3-28.el8.x86_64                             1/1
  Verifying        : vsftpd-3.0.3-28.el8.x86_64                             1/1
Installed products updated.

Installed:
  vsftpd-3.0.3-28.el8.x86_64

Complete!

Conclusion

Wednesday, February 24, 2021

Add Disk on ubuntu

 root@mars-ubuntu:~# fdisk -l

Disk /dev/loop0: 97.9 MiB, 102637568 bytes, 200464 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop1: 98.36 MiB, 103129088 bytes, 201424 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop2: 55.39 MiB, 58073088 bytes, 113424 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop3: 125.87 MiB, 131960832 bytes, 257736 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop4: 55.48 MiB, 58159104 bytes, 113592 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop5: 69.78 MiB, 73150464 bytes, 142872 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop6: 131.61 MiB, 137990144 bytes, 269512 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop7: 65.32 MiB, 68489216 bytes, 133768 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/sda: 50 GiB, 53687091200 bytes, 104857600 sectors

Disk model: QEMU HARDDISK

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: gpt

Disk identifier: 99B3632F-7AE4-464E-85EE-481926392CD0


Device       Start       End   Sectors Size Type

/dev/sda1     2048      4095      2048   1M BIOS boot

/dev/sda2     4096   2101247   2097152   1G Linux filesystem

/dev/sda3  2101248 104855551 102754304  49G Linux filesystem



Disk /dev/mapper/ubuntu--vg-ubuntu--lv: 24.51 GiB, 26306674688 bytes, 51380224 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop8: 65.32 MiB, 68485120 bytes, 133760 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop9: 69.9 MiB, 73277440 bytes, 143120 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop10: 31.9 MiB, 32595968 bytes, 63664 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/loop11: 31.9 MiB, 32600064 bytes, 63672 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/sdb: 100 GiB, 107374182400 bytes, 209715200 sectors

Disk model: QEMU HARDDISK

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

root@mars-ubuntu:~# fdisk /dev/sdb


Welcome to fdisk (util-linux 2.34).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.


Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0x23fb8269.


Command (m for help): n

Partition type

   p   primary (0 primary, 0 extended, 4 free)

   e   extended (container for logical partitions)

Select (default p):


Using default response p.

Partition number (1-4, default 1):

First sector (2048-209715199, default 2048):

Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-209715199, default 209715199): +100G

Value out of range.

Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-209715199, default 209715199):


Created a new partition 1 of type 'Linux' and of size 100 GiB.


Command (m for help): w

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.


root@mars-ubuntu:~# mkfs.ext4 /dev/sdb

mke2fs 1.45.5 (07-Jan-2020)

Found a dos partition table in /dev/sdb

Proceed anyway? (y,N) y

Discarding device blocks: done

Creating filesystem with 26214400 4k blocks and 6553600 inodes

Filesystem UUID: 25403f3a-42ec-4d88-b4f1-0b06df7972cb

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

        4096000, 7962624, 11239424, 20480000, 23887872


Allocating group tables: done

Writing inode tables: done

Creating journal (131072 blocks): done

Writing superblocks and filesystem accounting information: done


root@mars-ubuntu:~# mkdir /data

root@mars-ubuntu:~# mount /dev/sdb /data

root@mars-ubuntu:~# df -k

Filesystem                        1K-blocks     Used Available Use% Mounted on

udev                               24810680        0  24810680   0% /dev

tmpfs                               4971412     1560   4969852   1% /run

/dev/mapper/ubuntu--vg-ubuntu--lv  25155844 13155264  10699692  56% /

tmpfs                              24857044        8  24857036   1% /dev/shm

tmpfs                                  5120        0      5120   0% /run/lock

tmpfs                              24857044        0  24857044   0% /sys/fs/cgroup

/dev/sda2                            999320   313520    616988  34% /boot

/dev/loop0                           100352   100352         0 100% /snap/core/10583

/dev/loop1                           100736   100736         0 100% /snap/core/10823

/dev/loop2                            56832    56832         0 100% /snap/core18/1944

/dev/loop4                            56832    56832         0 100% /snap/core18/1988

/dev/loop5                            71552    71552         0 100% /snap/lxd/19032

/dev/loop3                           128896   128896         0 100% /snap/docker/471

/dev/loop6                           134784   134784         0 100% /snap/docker/796

/dev/loop7                            66944    66944         0 100% /snap/powershell/158

/dev/loop8                            66944    66944         0 100% /snap/powershell/154

/dev/loop9                            71680    71680         0 100% /snap/lxd/19188

/dev/loop10                           31872    31872         0 100% /snap/snapd/11036

/dev/loop11                           31872    31872         0 100% /snap/snapd/10707

tmpfs                               4971408       40   4971368   1% /run/user/1001

/dev/sr0                             935936   935936         0 100% /media/minecraft/Ubuntu-Server 20.04.1 LTS amd64

/dev/sdb                          102687672    61464  97366944   1% /data

root@mars-ubuntu:~# vi /etc/fstab


 sudo apt-get update

sudo apt-get install virtualbox-6.1

https://www.virtualbox.org/manual/ch02.html#install-linux-prereq



https://askubuntu.com/questions/777308/virtualbox-problem-kernel-module-is-not-loaded



sudo apt-get install dkms build-essential linux-headers-`uname -r`


apt-get install --reinstall virtualbox

https://askubuntu.com/questions/777308/virtualbox-problem-kernel-module-is-not-loaded

https://askubuntu.com/questions/760671/could-not-load-vboxdrv-after-upgrade-to-ubuntu-16-04-and-i-want-to-keep-secur/768310#768310

Tuesday, February 2, 2021

I hate redhat subscription-manager

 https://access.redhat.com/discussions/4603661


https://www.tecmint.com/enable-redhat-subscription-reposiories-and-updates-for-rhel-7/


https://www.linuxunit.com/how-to-subscribe-to-rhel7-optional-channel/

Saturday, January 23, 2021