Install Ruby 2.6.1 via RVM on CentOS

Install Prerequisites

yum install -y curl gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make cmake bzip2 autoconf automake libtool bison libssh2-devel libicu-devel

Install RVM

curl -L get.rvm.io | bash -s stable

Setup RVM, install Ruby 2.6.1 and set to default.

source /etc/profile.d/rvm.sh 
rvm install 2.6.1
rvm use --default 2.6.1

You may need to add root or the user your using to the rvm group

sudo usermod -G rvm username

Pulled some of the info from here https://github.com/ytti/oxidized#installing-ruby-212-using-rvm

LibreNMS enable RRDCached on CentOS 7

Commands from https://docs.librenms.org/Extensions/RRDCached/

Create System Service

sudo vi /etc/systemd/system/rrdcached.service
[Unit]
Description=Data caching daemon for rrdtool
After=network.service
[Service]
Type=forking
PIDFile=/run/rrdcached.pid
ExecStart=/usr/bin/rrdcached -w 1800 -z 1800 -f 3600 -s librenms -U librenms -G librenms -B -R -j /var/tmp -l unix:/run/rrdcached.sock -t 4 -F -b /opt/librenms/rrd/
[Install]
WantedBy=default.target

Save with esc + :wq

Enable rrdcached service on boot up and start the service now

systemctl enable --now rrdcached.service

Enable RRDcached in librenms config

vi /opt/librenms/config.php

add/edit the following line. If it is commented out, uncomment it

$config['rrdcached'] = "unix:/run/rrdcached.sock";

Save with esc + :wq

Check the disk IO after a little bit to see if it went down.

Can’t restart auditd with systemctl

The following command

systemctl restart auditd

Returns the following error on CentOS

Failed to restart auditd.service: Operation refused, unit auditd.service may be requested by dependency only (it is configured to refuse manual start/stop).
See system logs and 'systemctl status auditd.service' for details.

Work around is to use service for the restart

service auditd restart

 

Start Minecraft server on RAM disk Linux

Create tmpfs ramdisk.  Note if your Linux user is something other than steve you’ll need to change where appropriate.

mkdir /home/steve/mcdisk

In etc/fstab add the following

tmpfs /home/steve/mcdisk tmpfs defaults,size=4096m 0 0

This creates a 4GB ram disk at /home/steve/mcdisk

To mount it you can either reboot, or run

mount -a

Copy your current Minecraft directory to the ram disk

cp -R /home/steve/Current_MC_Server/ /home/steve/mcdisk

Create a Bash script in “/home/steve” named “ramdisk_save.sh”

Paste the following in.  You may need to install rsync if you do not have it installed

!/bin/bash

RAMDISK="/home/steve/mcram/"
MCDIR="/home/steve/1.13"

rsync -r -t $RAMDISK/ $MCDIR/
rsync -r -t $MCSTORE/ $MCPATH/

Now add the script to crontab

crontab -e

and

 */5 * * * * /home/steve/ramdisk_save.sh

This will now run every 5 minutes and sync any changes on the ram disk to the original directory.

Start the Minecraft server

java -Xmx3072M -Xms3072M -jar server.jar nogui

Repairing Fedora grub from chroot

Notes from repairing a Fedora drive.

Mount system in chroot.

If the system is a raid drive and your not able to access it refer to this post.  May just need to install the raid utilities.

For mounting the chroot environment refer to this post

Repairing grub

yum install grub2-efi-*

Install grub.  Change /sda to your drive, may need to specify the efi partition.

grub2-install /dev/sda

If your boot and efi partitions are mounted.

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

Reboot.

DNF/YUM not working in chroot environment

The reason is probably because the chrooted environment can’t resolve DNS.

Test it with

ping incredigeek.com

If it is not resolving, edit “/etc/resolv.conf” and change/add your nameserver.  Or just replace everything in it with

echo "nameserver 4.2.2.2" > /etc/resolv.conf

It should now be able to resolve and you should be able to use yum, or dnf.

yum update

Delete SNMPv3 User on Linux

Don’t know if this is the recommended way to delete a user, but it seems to work.

sudo service snmpd stop

Open up the snmpd.conf file in /var/lib and find the line with the SNMP user and delete the line

sudo vi /var/lib/snmp/snmpd.conf

The above file may be in the following location on RPM based systems.

sudo vi /var/lib/net-snmp/snmpd.conf

Save, exit, and start snmpd

sudo service snmpd start

These steps work for Ubuntu, but should work for any Debain based distro as well as CentOS, Fedora, RedHat etc.