Difference between revisions of "CentOS: Fixes Hints Tweaks and Tips"

From Indie IT Wiki
imported>Plittlefield
 
 
Line 8: Line 8:
  
 
https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/supported-centos-and-red-hat-enterprise-linux-virtual-machines-on-hyper-v
 
https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/supported-centos-and-red-hat-enterprise-linux-virtual-machines-on-hyper-v
 +
 +
== HOWTO: Run Script On System Boot in Centos 7 ==
 +
 +
Set the execute bit on the file ...
 +
 +
sudo chmod +x /etc/rc.d/rc.local
 +
 +
Edit the file adding your script at the end ...
 +
 +
sudo nano /etc/rc.local
 +
 +
Test the file ...
 +
 +
sudo systemctl start rc-local
 +
 +
https://nixcp.com/automatically-run-scripts-boot-time-centos-7/
  
 
== HOWTO: Set Time and Date and TimeZone in Centos 7 ==
 
== HOWTO: Set Time and Date and TimeZone in Centos 7 ==

Latest revision as of 12:42, 20 September 2022

Install Hyper-V Integration Tools

sudo yum install hyperv-daemons
sudo reboot
systemctl | grep hyperv

https://www.musingitoutloud.com/centos-hyper-v-integration-tools/

https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/supported-centos-and-red-hat-enterprise-linux-virtual-machines-on-hyper-v

HOWTO: Run Script On System Boot in Centos 7

Set the execute bit on the file ...

sudo chmod +x /etc/rc.d/rc.local

Edit the file adding your script at the end ...

sudo nano /etc/rc.local

Test the file ...

sudo systemctl start rc-local

https://nixcp.com/automatically-run-scripts-boot-time-centos-7/

HOWTO: Set Time and Date and TimeZone in Centos 7

sudo timedatectl list-timezones
sudo timedatectl set-timezone Europe/London
sudo timedatectl set-ntp yes
sudo reboot
sudo timedatectl

https://www.thegeekdiary.com/centos-rhel-7-how-to-set-datetime-ntp-and-timezone-using-timedatectl/

HOWTO: Security and Protection

yum install yum-security
yum list-security

http://www.cyberciti.biz/faq/redhat-fedora-centos-linux-yum-installs-security-updates/

http://wiki.centos.org/HowTos/OS_Protection

http://www.cyberciti.biz/faq/rhel-centos-yum-check-update-security-plugin/

HOWTO: FIX: Rootkit Hunter False Positives

http://forums.cpanel.net/f185/help-rkhunter-output-239141.html

http://www.atomicorp.com/forums/viewtopic.php?f=3&t=5934

HOWTO: INSTALL:

HOWTO: Install ClamAV

For Centos 6+...

su - root
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm
yum search clamav
yum install clamav
freshclam

List of available packages...

http://pkgs.repoforge.org/clamav/?C=M;O=D

LATEST ROOKIT HUNTER

http://www.woktron.com/secure/knowledgebase/79/Installation-Rootkit-Hunter-rkhunter-on-CentOS-5-and-6.html

http://sourceforge.net/projects/rkhunter/files/rkhunter/1.4.2/

SYSTEM UPDATES - MANUAL

su - root
yum update

SYSTEM UPDATES - AUTOMATIC DAILY

Centos has a built-in but by default inactive, to activate it:

su -c '/sbin/chkconfig --level 345 yum on; /sbin/service yum start'

Thanks to CentOS and more information here.

HOWTO: FIX:

MISSING NTFS TOOLS fsck.ntfs

yum install ntfs-3g
ln -s /usr/bin/ntfsfix /usr/sbin/fsck.ntfs
ln -s /usr/bin/ntfsfix /usr/sbin/fsck.ntfs-3g

fsck.ntfs -h

ntfsfix v2013.1.13 (libntfs-3g)
Usage: ntfsfix [options] device
   Attempt to fix an NTFS partition.
   -b, --clear-bad-sectors Clear the bad sector list
   -d, --clear-dirty       Clear the volume dirty flag
   -h, --help              Display this help
   -n, --no-action         Do not write anything
   -V, --version           Display version information

fsck.ntfs /dev/sdb1

Mounting volume... OK
Processing of $MFT and $MFTMirr completed successfully.
Checking the alternate boot sector... OK
NTFS volume version is 1.2.
NTFS partition /dev/sdb1 was processed successfully.

Thanks - http://pclosmag.com/html/Issues/201205/page06.html

HOWTO: Check CentOS Version Number

cat /etc/centos-release

Or

cat /etc/redhat-release

Thanks - http://www.rackaid.com/blog/check-your-centos-version-number/

HOWTO: Add Extra Repositories

http://wiki.centos.org/AdditionalResources/Repositories

HOWTO: Search For A Package

yum list packagename

HOWTO: List All Installed Packages By Date

rpm -qa --last |less

HOWTO: List All Installed Packages

yum list installed

HOWTO: See What Files Are In A Package

yum install -s yum-utils
repoquery -q -l packagename

HOWTO: See Which Package A File Belongs To

rpm -qf /usr/sbin/.sshd.hmac

HOWTO: Check System Updates

yum list updates

Command Line Aliases: How To Add/Edit

Open a terminal and edit the .bashrc file

nano ~/.bashrc

Add the following line under the last line starting with 'alias'

alias ping='ping -c3'

CTRL+O then enter to save changes, then CTRL+X to exit

To reload the alias file

source ~/.bashrc

To check...

alias

Keyboard Mapping: How To Change

If you have cause to change the keyboard mapping this is how it is done, in a terminal type:

/etc/sysconfig/keyboard

You will be presented with something similar to the following:

KEYBOARDTYPE='pc'
KEYTABLE='us'

You will need to edit the 'KEYTABLE' line to your requirement, for instance:

KEYTABLE='uk'

Network Card - Change From DHCP to Fixed IP Address

NEW

sudo -i
nano /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.215
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
/etc/init.d/network restart

OLD

In the terminal type:

system-config-network

Select 'Edit Devices' by pressing 'Enter' on your keyboard

Select the network card you wish to edit by pressing 'Enter' on your keyboard. If you system only has one wired network card the name will most likely be 'eth0'.

Use the arrow key to move the cursor do to 'Use DHCP' section; then press the 'space' to clear the asterix

Arrow down to 'Static IP' and input the address you want to use

Arrow down to 'Netmask' and fill in

Arrow down to 'Default gateway IP' and fill in

Tab to 'OK' and press 'Enter' on your keyboard

Tab to 'Save'

NOTE: At this point you can also edit any DNS settings

Tab to 'Save&Quit' and press 'Enter' on your keyboard

Reboot the system

After rebooting confirm that the settings are correct, in a terminal type:

nano /etc/sysconfig/network-scripts/ifcfg-eth0

If correct use CTRL+X to close