Posts

Showing posts from 2021

Mongorestore error - Failed: error connecting to db server: no reachable servers

Mongorestore error - Failed: error connecting to db server: no reachable servers   Before run mongorestore check if there is replSet in config file. or you run mongo in replica set, i.e., mongod --replSet rs0 ? If yes, please remember to run in your mongo shell the command: rs.initiate() Then you can use cmd mongorestore to restore your db.

How to clone CentOS server to another one

Image
 How to clone CentOS server to another one   Step 1: Installing the Rsync Tool in CentOS For cloning to be successful the rsync command-line tool needs to be present on both servers. This will be used for mirroring the source server to the destination server and syncing all the differences between the two systems. Thankfully, modern systems come with rsync already pre-installed. To check the version of rsync installed run: $ rsync --version If you want to view additional information about rsync, execute the following rpm command : $ rpm -qi rsync Check Rsync Version in CentOS If rsync is missing, run the following command to install it in RHEL / CentOS / Fedora systems. $ sudo yum install rsync Step 2: Configure the Source Server There are directories and files that you may want to exclude from cloning because they are either already available in the destination server or are autogenerated. These include the /boot , /tmp and /dev directories. Therefore, create

Change grub2 default kernel

 Change grub2 default kernel 0. Check if grub_default is setup to saved # cat /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="rd.lvm.lv=cl/root vconsole.font=latarcyrheb-sun16 crashkernel=auto  vconsole.keymap=us rd.lvm.lv=cl/swap rhgb quiet" GRUB_DISABLE_RECOVERY="true" 1. make copy of grub # cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak 2. generata new grub .config # grub2-mkconfig -o /boot/grub2/grub.cfg   3. Check what kernels are available. # grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2 4. Select kernel by name and setup as default  #grub2-set-default "Oracle Linux Server 7.9, with Linux 3.10.0-1160.31.1.el7.x86_64   5. Check what is saved entry # grub2-editenv list  

Recreate initramfs with realtek.ko for kernel 5.4.x

  Recreate initramfs with realtek.ko for kernel 5.4.x   1. Edit dracut.conf # mcedit /etc/dracut.conf add_drivers+=" realtek r8169 "   2. Backup initramfs # cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.$(date +%m-%d-%H%M%S).bak 3. Rebuild initramfs with multipath >CentOS/RHEL 6 # dracut -v -f -a multipath --include /etc/multipath /etc/multipath >CentOS/RHEL 7 # dracut --force --add multipath --include /etc/multipath 4. Verify # ls -lrt /boot/initramfs-$(uname -r).img 5.  Check if realtek is included # lsinitrd /boot/initramfs-5.4.17-2102.202.5.el7uek.x86_64.img |grep realtek -rw-r--r--   1 root root 33784 May 23 08:24 usr/lib/modules/5.4.17-2102.202.5.el7uek.x86_64/kernel/drivers/net/ethernet/realtek/r8169.ko.xz -rw-r--r--   1 root root   4732 May 23 08:24 usr/lib/modules/5.4.17-2102.202.5.el7uek.x86_64/kernel/drivers/net/phy/realtek.ko.xz  6. Reboot # reboot

How to remove old kernels from Centos

How to remove old kernels from Centos  There is command that is part of yum-utilities: package-cleanup count=1 means leave 1 the newest kernel untouched.  # package-cleanup --oldkernels --count=1 Loaded plugins: fastestmirror --> Running transaction check ---> Package kernel.x86_64 0:3.10.0-327.36.3.el7 will be erased ---> Package kernel.x86_64 0:3.10.0-514.2.2.el7 will be erased --> Finished Dependency Resolution Dependencies Resolved =================================== Package =================================== Removing: kernel kernel Transaction Summary ==================================== Remove 2 Packages Installed size: 284 M Is this ok [y/N]: