Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to compare common settings between CentOS 6 and CentOS 7

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces how to compare the common settings of CentOS 6 and CentOS 7, the content is very detailed, interested friends can refer to, I hope it can be helpful to you.

Centos7 and centos6 are different from initialization technology, service startup, boot file, etc. This article shares with you the comparison of common settings between centos7 and centos6.

1. Character set

CentOS 6

Method: / etc/sysconfig/i18n

CentOS 7

Method 1: localectl set-locale.utf8

Method 2: / LANG= in etc/locale.conf

two。 Hostnam

CentOS 6

Effective online: hostname

Restart takes effect: HOSTNAME= in / etc/sysconfig/network

CentOS 7

Online + restart takes effect: hostnamectl set-hostname

3. Time zone

CentOS 6

Method: ln-sf / usr/share/zoneinfo/Asia/Shanghai / etc/localtime

CentOS 7

Method 1: same as CentOS 6

Method 2: timedatectl set-timezone Asia/Shanghai

4. Time synchronization

CentOS 6

Step by step: ntpd or ntpdate

Direct: ntpdate-b (usually added to crontab)

CentOS 7

Method 1: systemctl start chronyd

Method 2: timedatectl set-ntp yes (same as systemctl start chronyd)

You can determine whether the current time is synchronized by timedatectl | grep "NTP synchronized"

Ntpd and ntpdate,RedHat are not recommended and chrony is highly recommended. It can be used in an unstable network environment.

Key parameters of chrony.conf makestep 1.0-1

The difference between ntpd and chronyd

5. Manually change the time

CentOS 6

Methods: date-s "2018-07-08 11:11:11"

CentOS 7

Method 1: same as CentOS 6

Method 2: timedatectl set-time "2018-07-08 11:11:12" (if timedatectl set-ntp false)

6. Single user changes password

CentOS 6: type e in the grub interface, add 1 at the end of the kernel line, type b to start into single-user mode, and then enter passwd to change the password

CentOS 7: type e in the grub interface, change ro to rw on line 16, add init=/bin/sh at the end of the current line, type ctrl-x to enter, and then enter passwd to change the password

If selinux is enabled, you need to execute touch / .autorelabel after changing the password and before restarting.

After the passwd is executed, it is best to execute sync to prevent forced restart from causing the password to be changed without landing.

7. Add parameters to grub

CentOS 6:

Add the parameters to be added to the kernel of / boot/grub/grub.conf

CentOS 7:

Add the parameters to be added in the GRUB_CMDLINE_LINUX of step 1:/etc/default/grub

Step 2:grub2-mkconfig-o / boot/grub2/grub.cfg

8. Check the boot record

CentOS 6: last

CentOS 7: journalctl-list-boots or last

9. Modify the boot kernel

View the current boot kernel

CentOS 6: default in cat / boot/grub/grub.conf

CentOS 7: grub2-editenv list

Check which kernels are available.

CentOS 6: cat / boot/grub/grub.conf | sed-n'/ ^ title/s/ ^ title / / p'

CentOS 7: cat / boot/grub2/grub.cfg | grep'^ menuentry' | awk-F "'{print $2}'

Set up the boot kernel

Step 1: make sure the GRUB_DEFAULT in / etc/default/grub is saved

Step 2:grub2-set-default 'CentOS Linux (3.10.0-693.el7.x86_64) 7 (Core)'

Modify default in / boot/grub/grub.conf

CentOS 6:

CentOS 7:

10. Rc.local

Execution sequence

CentOS 6: the last execution of the serial

CentOS 7: execute in parallel with other services

Executable permission

CentOS 6: executable permissions are available by default

CentOS 7: there is no executable permission by default (rc.local is not recommended) and needs to be added by itself (chmod + x / etc/rc.d/rc.local)

Considerations for CentOS 7

Rc.local is executed by rc-local.service and executed in parallel, which can only be started after network. Therefore, it is recommended that sleep 10 be added to rc.local to execute at the end as far as possible.

You need to add exit 0 to the last line of rc.local, otherwise it may cause the started process to be shut down (echo 'exit 0' > > / etc/rc.d/rc.local)

It is recommended that you try to use systemd to configure services, not rc.local

11. Limit configuration

CentOS 6:

Global settings: there is no global setting method (/ etc/security/limits.conf is only for processes that use pam, and there is a module to load pam_limits.so, because limits.conf is a configuration file for pam_limits.so)

Service settings: ulimit can only be set before service startup to see the effect after startup.

CentOS 7:

Global setting: / DefaultLimitNOFILE=65535 in etc/systemd/system.conf

Service settings: add LimitNOFILE=65535 to [Service]

12. Yum uses ipv4 only

CentOS 6: yum has no built-in method

CentOS 7: add ip_resolve=4 to yum.conf

13. Completely disable ipv6

CentOS 6 is the same as CentOS 7

Add ipv6.disable=1 to grub

Check to see if it is completely closed

Sysctl-a | grep-I ipv6. If there is no output, it is completely closed.

14. Firewalls

CentOS 6

The iptables service is enabled by default, but there is no entry by default

CentOS 7

Install and enable the firewalld service by default

The iptables service (yum install iptables-services) is not installed by default

15. NetworkManager

CentOS 6: not installed by default

CentOS 7: install and start by default

16. Name of the network card

CentOS 6:

After the system is installed, the default is em1, which is actually a binding made in udev when the installation is completed.

If the / etc/udev/rules.d/70-persistent-net.rules content is cleared, it will be restored to the eth0 starting number

CentOS 7:

The network card name is no longer bound through udev. The default is em1, and some names include eno, enp, ens, etc.

If you want to restore eth0, add net.ifnames=0 biosdevname=0 to / etc/default/grub

If you want the Nic name of CentOS 6 not to be affected by udev and achieve the effect of CentOS 7, you can delete 3 files.

Rm-f / etc/udev/rules.d/70-persistent-net.rules rm-f / lib/udev/write_net_rules rm-f / lib/udev/rules.d/75-persistent-net-generator.rules

Network card name rule

Eno: network card on motherboard

Enp: independent network card (PCI network card)

Ens: hot-swappable network card (usb, etc.)

Reference: https://www.linuxidc.com/Linux/2019-10/161096.htm

17. CPU Frequency (performance)

CentOS 6

Always: 2.1GHz

CentOS 7:

Idle: 1.2GHz

Sysbench 1 thread stress test: the frequency of all cores of a physical cpu increases instantly, with the highest hit to 2.6GHz

Sysbench 42 thread stress test: the frequency of all cpu cores reaches 2.4GHz.

To maintain the same frequency as 6, add intel_pstate=disable to / etc/default/grub (not recommended, as there is no improvement in performance and degradation in some cases

So much for sharing on how to compare the common settings of CentOS 6 and CentOS 7. I hope the above content can be of some help and learn more. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report