CentOS 7 Basic OS Tuning

CentOS7 Basic OS Tuning

1) Timezone/UTC Setting
#tzselect -> or #rm /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
1) Africa
2) Americas
3) Antarctica
4) Arctic Ocean
5) Asia
6) Atlantic Ocean
7) Australia
8) Europe
9) Indian Ocean
10) Pacific Ocean
11) none – I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
1) Afghanistan 18) Israel 35) Palestine
2) Armenia 19) Japan 36) Philippines
3) Azerbaijan 20) Jordan 37) Qatar
4) Bahrain 21) Kazakhstan 38) Russia
5) Bangladesh 22) Korea (North) 39) Saudi Arabia
6) Bhutan 23) Korea (South) 40) Singapore
7) Brunei 24) Kuwait 41) Sri Lanka
8) Cambodia 25) Kyrgyzstan 42) Syria
9) China 26) Laos 43) Taiwan
10) Cyprus 27) Lebanon 44) Tajikistan
11) East Timor 28) Macau 45) Thailand
12) Georgia 29) Malaysia 46) Turkmenistan
13) Hong Kong 30) Mongolia 47) United Arab Emirates
14) India 31) Myanmar (Burma) 48) Uzbekistan
15) Indonesia 32) Nepal 49) Vietnam
16) Iran 33) Oman 50) Yemen
17) Iraq 34) Pakistan
#? 43
The following information has been given:
Taiwan
Therefore TZ=’Asia/Taipei’ will be used.
Local time is now: Sat Oct 4 21:56:30 CST 2014.
Universal Time is now: Sat Oct 4 13:56:30 UTC 2014.
Is the above information OK?
1) Yes
2) No
#? 1
You can make this change permanent for yourself by appending the line
TZ=’Asia/Taipei’; export TZ
to the file ‘.profile’ in your home directory; then log out and log in again.
Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Taipei
#timedatectl set-local-rtc 1
#cat /etc/adjtime | grep -i LOCAL | wc -l
1

2) Network的Setting(EX:Static IP & Close Firewall)
#service NetworkManager stop
#systemctl disable !!:1
#vi /etc/sysconfig/network-scripts/ifcfg-eno1
TYPE=Ethernet
BOOTPROTO=static
NAME=eno1
DEVICE=eno1
ONBOOT=yes
IPADDR=192.168.1.1
NETMASK=255.255.255.0
#systemctl restart network
#service firewalld stop
#chkconfig !!:1 off
#yum install iptables-services

3) Change NIC Device to ethN(Need extra Parameter in Kernel Line[Disable CDNN])

cat /etc/sysconfig/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=”crashkernel=auto vconsole.font=latarcyrheb-sun16 vconsole.keymap=us biosdevname=0 rhgb quiet”
GRUB_DISABLE_RECOVERY=”true”

Modify

GRUB_CMDLINE_LINUX=”crashkernel=auto vconsole.font=latarcyrheb-sun16 vconsole.keymap=us biosdevname=0 rhgb quiet”

to

GRUB_CMDLINE_LINUX=”crashkernel=auto vconsole.font=latarcyrheb-sun16 vconsole.keymap=us biosdevname=0 rhgb quiet net.ifnames=0 biosdevname=0″

Use grub2-mkconfig rebuild GRUB config:

# grub2-mkconfig -o /boot/grub2/grub.cfg

Modify Enp config name to by mv:

# mv /etc/sysconfig/network-scripts/ifcfg-eno16777736 /etc/sysconfig/network-scripts/ifcfg-eth0

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

modify

Name=enp

to

NAME=eth0

reboot

4) Modify Hostname & Disable SELinux(RHEL 6.x:/etc/sysconfig/network/HOSTNAME)
#vi /etc/hostname
unsvr.sit.com
#vi /etc/sysconfig/selinux -> #setenforce 0(Temp)
SELINUX=disabled

5) NTP
#yum install chrony
#vi /etc/chrony.conf
# server 0.centos.pool.ntp.org iburst
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
server tick.stdtime.gov.tw iburst
server watch.stdtime.gov.tw iburst
#systemctl start chronyd
#systemctl enable chronyd
#chronyc -a
chronyc> tracking -> Check Time
chronyc> sources -> NTP Server Status
chronyc> makestep -> Manual Time Correct
chronyc> exit

6) Own/use rc.local & install ipmitool(Default Setting need extra authority set)
#chmod a+x /etc/rc.d/rc.local
#rpm -ivh OpenIPMI-modalias-2.0.19-11.el7.x86_64.rpm
#rpm -ivh OpenIPMI-libs-2.0.19-11.el7.x86_64.rpm
#rpm -ivh OpenIPMI-2.0.19-11.el7.x86_64.rpm
#rpm -ivh ipmitool-1.8.13-7.el7.x86_64.rpm
#service ipmi start
#chkconfig !!:1 on
#ipmitool mc info

7) Reset/Recovery the password about root

#mount -o remount,rw /
#passwd -> Directly change root’s password
#touch /.autorelabel -> If System has SELinux=enforcing
#exec /sbin/init

8) Format and Record the DVD or CD
#dvd+rw-format -force=full /dev/sr0 -> Format Data for DVD type
#growisofs -Z /dev/sr0=/root/example.iso -> Record Data for DVD type
#umount /run/media/root/CDROM
#wodim -v dev=/dev/sr0 blank=fast -> Format Data for CD type
#wodim -v -sao dev=/dev/sr0 /root/example.iso -> Record Data for CD type

9) Disable auto logout and screensaver

10) Modify and query the current runlevel(poweroff.target[0]、rescue.target[1]和reboot.target[6])
#systemctl get-default -> Check current RunLevel
#systemctl set-default graphical.target -> set next boot Runlevel
#systemctl isolate multi-user.target -> Similar to #init 3

11) Setup the func of VNC through vino
#gsettings set org.gnome.Vino require-encryption false -> Solve VNC Client沒支援Type 18 TLS
#gnome-control-center sharing -> Similar to executing on RHEL6#vino-preferences

12) Through the command of getconf to get the Arch
#getconf -a -> List all env about this system
#getconf LONG_BIT
64

13) Modify the behavior about the physical power button(Default value is blank)
#gsettings range org.gnome.settings-daemon.plugins.power button-power
enum
‘blank’
‘suspend’
‘shutdown’
‘hibernate’
‘interactive’
‘nothing’
#gsettings set org.gnome.settings-daemon.plugins.power button-power shutdown

14) Modify the repo from the DVD or Mirror from the CentOS7
#mount /dev/sr0 /mnt
#cat >> /etc/yum.repos.d/rhel70.repo
[rhel70]
baseurl = file:///mnt
gpgcheck = 0 -> Crtl-D
#yum clean
#yum list -> The part of following is about using the mirror of CentOS7
#rpm -qa | grep yum | xargs rpm -e –nodeps
#wget http://mirror01.idc.hinet.net/CentOS/7/os/x86_64/Packages/yum-3.4.3-118.el7.centos.noarch.rpm
#wget http://mirror01.idc.hinet.net/CentOS/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-24.el7.noarch.rpm
#wget http://mirror01.idc.hinet.net/CentOS/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
#rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
#rpm -ivh –nodeps yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
#rpm -ivh yum-3.4.3-118.el7.centos.noarch.rpm
#wget http://iori.tw/CentOS_7_Mirror_Hinet.tar.gz
#tar zxvf CentOS_7_Mirror_Hinet.tar.gz
#mv ~/CentOS_7_Mirror_Hinet/CentOS-Base.repo /etc/yum.repos.d/
#yum list
#mkdir -p /var/cache/yum/{base,extras,updates}/
#cp ~/CentOS_7_Mirror_Hinet/mirrorlist.txt /var/cache/yum/base/
#cp ~/CentOS_7_Mirror_Hinet/mirrorlist.txt /var/cache/yum/extras/
#cp ~/CentOS_7_Mirror_Hinet/mirrorlist.txt /var/cache/yum/updates/
#mv ~/CentOS_7_Mirror_Hinet/RPM-GPG-KEY-CentOS-7 /etc/pki/rpm-gpg/
#yum list
#rpm -ivh ~/CentOS_7_Mirror_Hinet/epel-release-7-2.noarch.rpm
#yum list

15) Modify the boot order with the Grub2(EX:Set second as default)
#vi /etc/default/grub -> or #grub2-set-default 2
GRUB_DEFAULT=1
#grub2-mkconfig -o /boot/grub2/grub.cfg -> For Legacy mode

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *