################################################################################ #Version 2018.06.01.0001 ################################################################################ #run the setup program for authentication, network, firewall, services, etc /usr/sbin/setup LD_LIBRARY_PATH in RedHat is LD_LIBRARY cat /proc/cpuinfo #get speed/size/type cpu getconf WORD_BIT #returns 32 or 64 for bit proc type Virtual Interface ifconfig ifconfig eth0:1 192.168.76.24 netmask 255.255.252.0 \ broadcast 192.168.79.255 up Virtual Interface Or using the iproute2 utility ip, for example: ip addr add 192.168.76.24/24 dev eth0 #ip addr del 192.168.76.24/24 dev eth0 ####################################### sed -e \ 's/.*release[[:blank:]]*\([[:digit:]][[:graph:]]*\).*/\1/' \ /etc/redhat-release ####################################### Send gather grab snap of system: sosreport yum install sos sosreport # <= rhel 6 /tmp # >= rhel 7 /var/tmp ####################################### #Get "not signed" for a pkg yum -y --nogpgcheck install PKGNAME #ignores signature ################################################################################ truss - strace ################################################################################ #Setup Bonding or etherchannel/teaming for redhat Server ethtool eth0 ethtool eth1 modprobe --list | grep bonding /lib/modules/2.6.*/kernel/drivers/net/bonding/bonding.ko modprobe --list | grep mii /lib/modules/2.6.*/kernel/drivers/net/mii.ko #EITHER vi /etc/modprobe.d/bonding.conf alias bond0 bonding #or vi /etc/modprobe.conf alias bond0 bonding modinfo bonding #older way, but the options should be in the ifcfg-bondX file vi /etc/modprobe.conf options bond0 mode=1 arp_ip_target=x.x.x.x arp_interval=200 primary=eth0 #This configuration use arp resquest on the primary interface each 200ms #Now the kernel module is configure and we have to load thoses modules : modprobe bonding modprobe mii vi /etc/sysconfig/network-script/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=no vi /etc/sysconfig/network-script/ifcfg-eth1 DEVICE=eth1 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=no #Configuration of bond0 vi /etc/sysconfig/network-script/ifcfg-bond0 DEVICE=bond0 BOOTPROTO=none ONBOOT=yes NETMASK=255.255.255.0 IPADDR=x.x.x.x USERCTL=no #> RHEL 7 service network restart #<= RHEL 7 systemclt restart network cat /proc/net/bonding/bond0 ################################################################################ #record a DVD (mkisofs and DVD recording in once command) growisofs -dvd-compat -Z /dev/dvd=image_file.iso ################################################################################ watch -nX cmd # where X is an integer of seconds to sleep ################################################################################ mdadm #disk mirroring - like disksuite ################################################################################ partprobe ## OR echo 1 > /sys/block/sdX/device/rescan ####################################### lvm.conf ####################################### pvscan vgscan vi /etc/lvm/lvm.conf filter = [...] #Once a filter has been configured and lvm.conf saved, check the output of #these commands to ensure that no physical volumes or volume groups are #missing: pvscan vgscan #Once the desired filter is configured, it is recommended to rebuild #the initrd with mkinitrd (RHEL4 and 5) or dracut (RHEL 6) so that #only the necessary devices are scanned upon reboot. ############################################################################## #The following command moves all allocated space off the physical volume #/dev/sdc to other free physical volumes in the volume group: pvmove /dev/sdc #The following command moves just the extents of the logical volume MyLV. pvmove -n MyLV /dev/sdc pvmove -n MyLV OLDDISK NEWDISK # The following command moves all extents allocated to the physical #volume /dev/sdc over to /dev/sdf in the background. pvmove -b /dev/sdc /dev/sdf #The following command reports the progress of the move as a percentage at #five second intervals. pvmove -i5 /dev/sdd ############################################################################# #Move a LV out of one VG into another VG #it must not have shared segements on disk lvdisplay -v --maps LV lvdisplay --maps -v /dev/mapper/vgorabd001d112base-lvorab005 pvmove -n lvorab005 /dev/mapper/mpathr /dev/mapper/mpathdz lvdisplay --maps -v /dev/mapper/vgorabd001d112base-lvorab005 #the LV must be inactive umount /odcld001/exp lvchange -an /dev/mapper/vgorabd001d112base-lvorab005 #vgsplit EXISTINGVG NEWVG -n LV vgsplit vgorabd001d112base vgorax0010001d -n lvorab005 lvchange -ay /dev/mapper/vgorax0010001d-lvorab005 mount -t ext4 /dev/mapper/vgorax0010001d-lvorab005 /odcld001/exp ############################################################################## #If you did a "vgchange -c y VG" and didn't mean to, but cannot undo it # with a "vgchange -c n VG", then do the following ***IF you know it isn't # being used*** vgchange -cn vgname --config 'global {locking_type = 0}' ############################################################################## Significant startup file for disks: /etc/rc.sysinit ############################################################################## sar -B 5 #see swap and paging stats numactl --hardware lscpu lstopo numastat numastat -c numastat -mczs numastat -c qemu ps -eo min_flt,maj_flt,cmd,args,uid,gid #maj/min page faults per process ############################################################################## #list the top processes w/ a 5 second delay top -d 5 F or O p = swap sorting ############################################################################## #Grow a VMDC then get the OS to see it Resize the vmdk using VMware's management tools. Rescan the scsi bus on the guest so that it sees the new size. MYDEV=sdba echo 1 > /sys/block/$MYDEV/device/rescan for HOST in $(cd /sys/class/scsi_host; ls -d host*) do echo $HOST echo "- - -" > /sys/class/scsi_host/$HOST/scan done fdisk -l /dev/$MYDEV pvresize /dev/$MYDEV pvscan; pvs #lvextend ... #resize2fs ... ############################################################################## #Fix a RPM database corruption #Mount the iso file with –o loop to a mountpoint mount -o loop myfile.iso /mnt/loop/ zgrep Packages filelist.* #Create a tmp folder e.g. under /tmp/… go into this new tmp folder #And run the command afio -i -y var/adm/backup/rpmdb/SOMEFILE.gz /mnt/loop/archives/###.afio.bz2 #You get a extracted folder - in this case a #/var/adm/backup/rpmdb/Packa…. #Copy the Package..gz file to the a300s741 and unzip the packages – #remove / rename the original one under /var/lib/rpm/backup/ #And run a rpm -rebuilddb ############################################################################## #rhel 7 #======================================================================= #system state #======================================================================= #Boot targets are: #System supports multiple users, graphical and textbased logins graphical.target #System supports multiple users, text-based logins multi-user.target #sulogin prompt, basic system initialization rescue.target #sulogin prompt, initramfs pivot complete and system # root mounted read-only on / emergency.target systemctl systemctl list-unit-files #like service --status-all systemctl --type=TYPE systemctl status UNIT -l systemctl list-units --type=TYPE systemctl list-unit-files --type=TYPE systemctl poweroff systemctl reboot #change the current target on a booted system systemctl isolate TARGET #Change current status of a unit systemctl start UNIT systemctl stop UNIT systemctl restart UNIT systemctl reload UNIT #Change the boot-time status of a unit systemctl enable UNIT systemctl disable UNIT #Mask a unit (so you don't have NetworkManager and network both running) systemctl mask UNIT systemctl unmask UNIT #what is my default? systemctl get-default ls -l /etc/systemd/system/default.target #Change my default systemctl set-default multi-user.target #Booting The following steps are taken when the system boots – Power on (UEFI or BIOS performs POST, identifies boot device) Configured with a BIOS key combination (often F2) – Loads the boot loader from disk (grub2 for RHEL7) Configured with grub-install – Boot loader loads its configuration and presents a menu /etc/grub.d/*, /etc/default/grub, and /boot/grub2/grub.conf – Boot loader loads the selected kernel and initial RAM disk image /etc/dracut.conf Boot loader passes control over to the kernel – /etc/grub.d/*, /etc/default/grub, and /boot/grub2/grub.conf Kernel initializes hardware, then runs /sbin/init from the initramfs (which is systemd in RHEL7) – Configured using init= kernel parameter Initramfs systemd executes all units in initrd.target target – Mounts actual root file system as /sysroot (/etc/fstab) /sysroot becomes / and installed systemd executed systemd looks for a default target – Either configured on system or passed as kernel parameter – /etc/systemd/system/default.target #different target for a bootup (override the link) vi /boot/grub/grub.conf systemd.unit=TARGET #or reboot, interrupt boot, edit kernel line linux16 systemd.unit=rescue.target systemd.unit=emergency.target #recover root password #systemd targets still require a password to access the system #Instead of appending systemd.unit=TARGET, append rd.break #This option stops the boot process before the initramfs # switches to the actual system linux16 rd.break #append to kernel line mount -o remount,/w /sysroot chroot /sysroot passwd root touch /.autorelabel #======================================================================= #Network #======================================================================= ip addr show NIC ip -s link show NIC ip route #command "ss" replaces netstat ss -ta ss -tl #network config - replace ifconfig? nmcli con show nmcli con show --active nmcli con show NAME nmcli dev status nmcli con add-name "static" ifname eth0 ... nmcli con up "static" nmcli con up "default" nmcli con add help nmcli con reload nmcli con down NAME nmcli con up NAME hostnamectl nmcli device status nmcli con s nmcli con s --active nmcli -f name,autoconnect con s nmcli -p con s "System eth0" nmcli -f active con s "System eth0" nmcli -f profile con s "System eth0" #======================================================================= #Install #======================================================================= #Virtual console functions – Ctrl-Alt-F1 – main installer console with debugging info – Ctrl-Alt-F2 – shell prompt with root access – Ctrl-Alt-F3 – installation log – Ctrl-Alt-F4 – storage log – Ctrl-Alt-F5 – program log from other utilities – Ctrl-Alt-F6 – spare shell prompt? – Ctrl-Alt-F7 – default console with GUI installation #Red Hat Enterprise Linux 7.1 – All programs are in tmux panes on first virtual console #======================================================================= OLD: /etc/sysconfig/network hostnamectl status hostnamectl set-hostname FQDN ############################################################################## Performance systemtap PCP - performance co-pilot dmstat ############################################################################## SAP sapconf ############################################################################## Puppet and chef both ruby based ############################################################################## Docker - compete is rocket opensift - compete is vmware openshift.com webforms ############################################################################## collectl -p file1 [file2 ...] /var/log/collectl ############################################################################## #Tuning #To install tuned: yum -y install tuned #Now start the services provided by tuned: systemctl start ktune systemctl enable ktune service tuned start chkconfig tuned on #To find the current active profile and state of service: tuned-adm active #Current active profile: default #Service tuned: enabled, running #Service ktune: enabled, running #To list all the available profiles: tuned-adm list #Available profiles: #- default #- throughput-performance #- laptop-ac-powersave #- spindown-disk #- desktop-powersave #- laptop-battery-powersave #- latency-performance #- server-powersave #- enterprise-storage #Current active profile: default #To switch to a different profile: tuned-adm profile enterprise-storage #Each profile has 4 configuration file under #/etc/tune-profiles/. If you want to create a profile of your #own, simply copy one of the profile directory with a different name, change #the config files inside it according to your own requirement and activate it. # ktune.sh ktune.sysconfig sysctl.ktune tuned.conf #In case if you want to disable all tuning, then run: tuned-adm off ############################################################################## #initial RH setup: wget -qO- \ http://satellite/pub/bootstrap/bootstrap-rhel6-released-virtual.sh \ | bash ############################################################################## date: timedatectl ############################################################################## #2016.09.08 IF you use the nmcli to setup things, it will manage/overwrite the /etc/resolv.conf on each restart of the network (systemctl restart network || reboot). The nmcli doesn't manage ALL the possible options that it should. need nmcli command to do options in resolv.conf What problem/issue/behavior are you having trouble with? What do you expect to see? nmcli overwrites the following in /etc/resolv.conf (though we have the other values setup via nmcli commands) options rotate attempts:5 timeout:1 Is there a nmcli command for this? We currently have chattr +i /etc/resolv.conf setup to keep anything from overwriting it (from another knowledgebase article) Using static, not DHCP (so PeerDNS=no doesn'... What problem/issue/behavior are you having trouble with? What do you expect to see? nmcli overwrites the following in /etc/resolv.conf (though we have the other values setup via nmcli commands) options rotate attempts:5 timeout:1 Is there a nmcli command for this? We currently have chattr +i /etc/resolv.conf setup to keep anything from overwriting it (from another knowledgebase article) Using static, not DHCP (so PeerDNS=no doesn't apply) Where are you experiencing the behavior? What environment? all rhel 7 systems When does the behavior occur? Frequently? Repeatedly? At certain times? whenever NetworkManager restarts What information can you provide around timeframes and urgency? needed for our Oracle RAC settings The response by Redhat, is that it is a known bug, and may be handled in the future: My name is Nilesh Parmar. I will be assisting you on this case. Currently there is no such option for setting "dns-options" with nmcli. We already have the RFE filed for this request: ------ Bug 1264410 - Cannot set DNS options [internal bugzilla] https://bugzilla.redhat.com/show_bug.cgi?id=1264410 ------ So, the fix around this, is to setup the /etc/resolv.conf the way you want/need, and set it to non-writeable by ANYTHING chattr +i /etc/resolv.conf #to edit it at anytime: chattr -i /etc/resolv.conf, edit, then chattr +i /etc/resolv.conf Bad work-around, but the way it is now. ############################################################################## #Usually the /etc/udev/rules.d/70-persistent-net.rules file can simply be #deleted and it'll be regenerated upon reboot. But sometimes it's not or not #fully regenerated. In these cases you can try either of these: udevadm trigger #udevadm trigger --action=add ############################################################################## #use: _netdev as an option to the san&nas mounts #/etc/fstab, add option: _netdev #netdev says to delay/wait until SAN drivers are loaded before mounting example: /dev/mapper/mpath0 /mymount ext3 defaults,_netdev 1 2 ############################################################################## #dynamic, not persistent after reboot ethtool -s eth0 speed 100 duplex full autoneg off #persistent after reboot vi /etc/sysconfig/network-scripts/ifcfg-eth0 ETHTOOL_OPTS="speed 100 duplex full autoneg off" #Restart the interface to apply changes : ifdown eth0 && ifup eth0 ############################################################################## #ethtool like - different/better: yum -y install biosdevname biosdevname -d #give MACs ############################################################################## #change the NIC names /usr/sbin/system-config-network /usr/sbin/system-config-network-gui /usr/sbin/system-config-network-tui #/usr/sbin/system-config-network -e > /tmp/network.config #Replace each occurrence of the #ethN name in /tmp/network.config with the #corresponding #emX or pXpY name as provided by the map. #Import the modified network configuration . #/usr/sbin/system-config-network –i < /tmp/network.config ############################################################################## #get packages by repo yum repolist #disable all, then only enable the one you want, google in this example yum --disablerepo="*" --enablerepo="google" list available ############################################################################## #yum history yum history list yum history list all yum history summary yum history summary 1..5 yum history package-list subscription-manager\* yum history package-list \* ############################################################################## #Pem - product subscriptions #cd /etc/pki/product #restorecon -Rv /etc/pki/product #chown root.root /etc/pki/product/69.pem #chmod 644 /etc/pki/product/69.pem # #/etc/pki/product-default #old #/etc/pki/product #/etc/pki/consumer #/etc/pki/entitlement rct cat-cert /etc/pki/product/69.pem subscription-manager config --list #/etc/rhsm/rhsm.conf ############################################################################## ############################################################################## ##############################################################################