User Tools

Site Tools


distros:centos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

distros:centos [2016/06/24 16:55]
Sean Rhone created
distros:centos [2016/06/24 17:03] (current)
Sean Rhone
Line 1: Line 1:
 +====== Information ======
  
 +  * CentOS 7
 +
 +====== Download ======
 +
 +  * https://www.centos.org/download
 +
 +====== Software ======
 +
 +===== Update =====
 +
 +****
 +
 +  sudo yum clean 'all' && sudo yum update -y && sync
 +
 +===== General =====
 +
 +****
 +
 +  sudo yum install htop p7zip unar aria2 hdparm nano unzip
 +
 +====== Settings ======
 +
 +==== Nano as default editor ====
 +
 +  sudo nano '/etc/sudoers.d/nano'
 +
 +  Defaults editor = /usr/bin/nano
 +
 +==== Secure Shell ====
 +
 +=== Change Listen Port ===
 +
 +  * Connect with ssh 'user@IP' -p 'x'
 +
 +  sudo -e '/etc/ssh/sshd_config'
 +
 +  Port x
 +
 +=== Firewall ===
 +
 +== New Port ==
 +
 +****
 +
 +  sudo firewall-cmd --permanent --add-port='x/tcp' && sudo firewall-cmd --reload
 +
 +== Remove Old ==
 +
 +****
 +
 +  sudo firewall-cmd --permanent --remove-service='ssh' && sudo systemctl reboot
 +
 +====== Kernel Settings ======
 +
 +===== Security =====
 +
 +  sudo -e '/etc/sysctl.d/harden.conf'
 +
 +  kernel.dmesg_restrict = 1
 +  kernel.kptr_restrict = 1
 +
 +====== GRUB ======
 +
 +===== Timeout =====
 +
 +  sudo -e '/etc/default/grub'
 +
 +  GRUB_TIMEOUT=3
 +  
 +===== BIOS Update =====
 +
 +  sudo grub2-mkconfig -o '/boot/grub2/grub.cfg'
 +
 +====== Automatic Updates ======
 +
 +===== Service =====
 +
 +  sudo -e '/etc/systemd/system/centos-up.service'
 +
 +  [Service]
 +  Type=oneshot
 +  ExecStart='/usr/bin/yum' clean 'all'
 +  ExecStart='/usr/bin/yum' update -y
 +  ExecStart='/usr/bin/sync'
 +  ExecStart='/usr/bin/systemctl' reboot
 +
 +===== Timer =====
 +
 +  sudo -e '/etc/systemd/system/centos-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'centos-up.timer' --now && sudo systemctl start 'centos-up' && sudo systemctl status 'centos-up' -l
 +
 +  [Unit]
 +  Description=Software Package Maintenance and Updater
 +  Wants=network-online.target
 +  
 +  [Timer]
 +  OnCalendar=*-*-* 06:00:00
 +  Persistent=true
 +  
 +  [Install]
 +  WantedBy=timers.target
 +
 +====== Steven Black's Unified Hosts File ======
 +
 +===== Service =====
 +
 +  sudo -e '/etc/systemd/system/hosts-up.service'
 +
 +  [Service]
 +  Type=oneshot
 +  ExecStart='/usr/bin/wget' 'https://github.com/StevenBlack/hosts/archive/master.zip' -O '/tmp/master.zip'
 +  ExecStart='/usr/bin/unzip' '/tmp/master.zip' -d '/tmp'
 +  ExecStart='/usr/bin/python' '/tmp/hosts-master/updateHostsFile.py' --auto --replace
 +  ExecStart='/usr/bin/rm' -R '/tmp/master.zip' '/tmp/hosts-master'
 +  ExecStart='/usr/bin/sync'
 +
 +===== Timer =====
 +
 +  sudo -e '/etc/systemd/system/hosts-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'hosts-up.timer' --now && sudo systemctl start 'hosts-up' && sudo systemctl status 'hosts-up' -l
 +
 +  [Unit]
 +  Description=Hosts File Protection Updater
 +  Wants=network-online.target
 +  
 +  [Timer]
 +  OnCalendar=weekly
 +  Persistent=true
 +  
 +  [Install]
 +  WantedBy=timers.target
 +
 +====== Notable Folders and Commands ======
 +
 +===== Show CPU Frequency =====
 +
 +  grep 'MHz' '/proc/cpuinfo'
 +
 +  watch -n 0.1 grep \'cpu MHz\' '/proc/cpuinfo'
 +
 +===== Partition Information =====
 +
 +****
 +
 +  df -hT
 +
 +===== Optimal GCC compiler flags =====
 +
 +****
 +
 +  gcc -v -E -x c -march=native -mtune=native - < /dev/null 2>&1 | grep cc1 | perl -pe 's/ -mno-\S+//g; s/^.* - //g;'
 +
 +===== Remove EXIF data =====
 +
 +****
 +
 +  exiftool -all= *.* -overwrite_original
 +
 +===== FirewallD =====
 +
 +==== List Active Rules ====
 +
 +****
 +
 +  sudo firewall-cmd --list-all
 +
 +==== List Available Services ====
 +
 +****
 +
 +  sudo firewall-cmd --get-service
 +
 +==== Reload ====
 +
 +****
 +
 +  sudo firewall-cmd --reload
 +
 +==== Add/Remove Service ====
 +
 +  * Add ''--permanent'' as-needed to allow the rule to persist
 +
 +  sudo firewall-cmd --add-service=x
 +
 +  sudo firewall-cmd --remove-service=x
 +
 +==== Add/Remove Service ====
 +
 +  * Add ''--permanent'' as-needed to allow the rule to persist
 +  * Change ''tcp'' to ''udp'' as-needed
 +
 +  sudo firewall-cmd --add-port=x/tcp
 +
 +  sudo firewall-cmd --remove-port=x/tcp
distros/centos.txt ยท Last modified: 2016/06/24 17:03 by Sean Rhone