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

First know the difference between centos7 and centos6 (kernel, command, etc.)

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Differences and characteristics between CentOS7.2 and CentOS6

The startup of the Linux operating system starts from BIOS, then enters bootloader, where bootloader loads the kernel and initializes the kernel. The last step in kernel initialization is to start the init process with pid 1. This process is the first process of the system. It is responsible for generating all other user processes. Init exists as a daemon and is the ancestor of all other processes. The init process is unique in that it can perform tasks that other processes cannot.

Sysvinit is a system V-style init system, and Sysvinit uses the term runlevel to define "booking operation mode". Sysvinit checks to see if there is a 'initdefault' entry in the / etc/inittab' file. This tells the init system whether there is a default mode of operation. Sysvinit uses scripts, file naming rules and soft links to implement different runlevel and start processes and services serially.

Systemd is the latest initialization system (init) in Linux system. Its main design goal is to overcome the inherent shortcomings of sysvinit and improve the startup speed of the system. Systemd and ubuntu's upstart are competitors and are expected to replace UpStart. The goal of Systemd is to start as few processes as possible and start as many processes in parallel as possible.

Centos6.x generally uses the ext3\ ext4 file system format, while centos7 defaults to xfs format:

The largest 16TB file system and the largest 2TB file supported by EXT3 and Ext4 support respectively.

The file system of 1EB (1048576TB, 1EB=1024PB, 1PB=1024TB) and the files of 16TB. Ext3 currently supports only 32000 subdirectories, while Ext4 supports an unlimited number of subdirectories.

EXT4 is the fourth generation extended file system (English: Fourth EXtended filesystem, abbreviated to ext4) is a journaling file system under the Linux system, is the successor version of the ext3 file system.

The file system capacity of Ext4 reaches 1EB, while the single file capacity reaches 16TB, which is a very large number. This may not be important for general desktops and servers, but it is very important for users of large disk arrays; (disk structure reason Ext4's inode limit (32 digits) can only have a maximum of more than 4 billion files, and the single file size of Ext4 can only support a maximum of 16T (4K block size).

XFS is a 64-bit file system that supports a single file system with a maximum of 8EB minus 1 byte, depending on the maximum block limit of the host operating system. For a 32-bit Linux system, the size of files and file systems is limited to 16TB.

2.4Linux network configuration management

Familiar with the commonly used commands and Linux permissions, then how to get your Linux system online? What are the commands for managing the linux server network?

The default network card configuration file of Linux server is under / etc/sysconfig/network-scripts/, which is generally named ifcfg-eth0 ifcfg-eth2, eth0 represents the first network card, eth2 represents the second network card, and so on. Generally speaking, the DELL R720 is equipped with 4 gigabit network cards.

A preliminary understanding of the difference between centos7 and centos6

Command centos6centos7

Remarks

Ifconfig has yum install-y net-tools.

Rouet has yum install-y net-tools.

Ntpd services and ntpdate commands have yum install ntp ntpdate

Cat / etc/issue has version number but no information. You can only view cat / etc/redhat-release.

Setup

Ability to change network configuration

Setup removes firewall and network configuration by installing

Yum install NetworkManager-tui-y

The nmtui command replaces the network configuration in setup

Files such as time zone and time settings / etc/sysconfig/clock

Timedatectl set-timezone Asia/Shanghai

Timedatectl status

Language and other settings locale-a

Localectl status

Service management

Chkconfig

/ etc/init.d/ service

Systemctl

Python2.6

2.7

Kernel2.63.10

The network card eth0 has become the naming rule of predictability.

File system

Ext4xfs

Dig nslookup command

Yes

Yes

Yum install bind-utils-y

Hostnam

Cat / etc/sysconfig/networkcat / etc/hostname

Management and control of services

Sysvinit

System

Systemctl is the main tool. It merges.

The functions of service and chkconfig are integrated.

Firewalls

Iptables was replaced by firewalld

Startup level

/ etc/inittab is no longer in use

Boot execution file / etc/rc.local can place the script file to be executed when boot

By default, this file does not have execute permission x

It is officially recommended not to use this file (write your own service), but you can continue to use it by adding + x.

Kernel parameter profile

/ etc/sysctl.conf

/ usr/lib/sysctl.d/00-system.conf

And

/ etc/sysctl.d/.conf

Init shutdown restart command

Init 0 shutdown init 0 shutdown does not change the switching level

Switch back to single user mode init 0

Init 0

Systemctl emergency

Systemctl isolate runlevel1.target

Pay attention to this individual attempt. Single-user mode can only be connected by terminal, but not ssh.

Install the basic management tools for the system:

Yum install tree net-tools bind-utils tree sysstat vim-en* lrzsz NetworkManager-tui ntp ntpdate iftop tcpdump telnet traceroute-y

The name of the network card of ens330 will be found in centos7. How to change it to eth0?

Reference: http://jingyan.baidu.com/album/7f41ecec1b022e593d095c1e.html?picindex=5

Vim / etc/sysconfig/network-scripts/ifcfg-ens33 cd / etc/sysconfig/network-scripts/mv ifcfg-ens33 ifcfg-eth0

Disable the predictable naming convention and disable firmware discovery of the Nic name. / etc/default/grub and add "net.ifnames=0 biosdevname=0"

Vim / etc/default/grub

# run the command grub2-mkconfig-o / boot/grub2/grub.cfg to regenerate the GRUB configuration and update kernel parameters.

Grub2-mkconfig-o / boot/grub2/grub.cfg # grug2-mkconfig commands that are only used by centos, not in 6.

Reboot

The system is optimized.

One: close the ipv6 provided by sshd

Vim / etc/ssh/sshd_config#AddressFamily anyAddressFamily inet

Note: (inet is ipv4 only; inet6 is ipv6 only)

Two: turn off fire protection and setlinux

Systemctl stop firewalld setenforce 0sed-I's setting SELINUXFORCING'/ etc/selinux/config

Note: you can study the reasons why centos6 is replaced by firewalld in centos7.

Firewalld should be the Premium version of iptable (but both of the write rule management commands provided are iptables)

FirewallD provides dynamic firewall management tools that support network / firewall zone (zone) definition of network links and interface security levels. It supports IPv4, IPv6 firewall settings and Ethernet bridging, and has run-time configuration and permanent configuration options. It also supports interfaces that allow services or applications to add firewall rules directly. The previous system-config-firewall/lokkit firewall model was static, and each modification required a full reboot of the firewall. This process includes unloading the kernel netfilter firewall module and loading the modules needed for the new configuration. The uninstallation of the module will destroy the stateful firewall and the established connection.

In contrast, firewall daemon dynamically manages the firewall and can apply changes without rebooting the entire firewall. Therefore, it is not necessary to reload all kernel firewall modules. However, to use firewall daemon requires that all changes to the firewall are implemented through the daemon to ensure that the state in the daemon is consistent with the firewall in the kernel. In addition, firewall daemon cannot parse firewall rules added by ip*tables and ebtables command line tools.

The daemon provides information about the currently active firewall settings through D-BUS, and also accepts changes made using PolicyKit authentication through D-BUS.

Iptables is not installed by default. If you are accustomed to using iptables, you can turn off firewalld and replace it with iptables.

Install the iptable service

# yum-y install iptables-services

If you want to save the firewall rules, use the following command

# iptables-save > iptables-rules.txt

These rules can be added to the / etc/sysconfig/iptables file, but I often modify them according to my preferences

# systemctl enable iptables

# systemctl enable ip6tables

Stop firewalld

# systemctl stop firewalld

Disable firewalld

# systemctl disable firewalld

Enable the iptable service

# systemctl start iptables

# systemctl start ip6tables

Four: about network services

Old network scripts (service) and ifcfg files

At the beginning of Centos7, the network is managed by the NetworkManager service. Compared to the old / etc/init.d/network script, NetworkManager is a dynamic, event-driven network management service. The old / etc/init.d/network and ifup,ifdown still exist, but they are in a standby state, that is, when NetworkManager is running, most of these scripts call NetworkManager to complete the network configuration task; when NetworkManager is not running, these scripts manage the network according to the old tradition.

It is important to note that:

1) systemctl disable NetworkManager.service is not recommended

2) because the old network script is not compatible with the new configuration item name IPADDR0/PREFIX0/GATEWAY0 in the ifcfg-* file

3) unless the latter 0 is removed, the network card cannot be started.

Differences between CentOS 6 and CentOS 7 commands

(1) Desktop system

[CentOS6] GNOME 2.x

[CentOS7] GNOME 3.x (GNOME Shell)

(2) File system

[CentOS6] ext4

[CentOS7] xfs

(3) Kernel version

[CentOS6] 2.6.x-x

[CentOS7] 3.10.x-x

(4) start the loader

[CentOS6] GRUB Legacy (+ efibootmgr)

[CentOS7] GRUB2

(5) Firewall

[CentOS6] iptables

[CentOS7] firewalld

(6) default database

[CentOS6] MySQL

[CentOS7] MariaDB

(7) File structure

[CentOS6] / bin, / sbin, / lib, and / lib64 under /

[CentOS7] / bin, / sbin, / lib, and / lib64 move to / usr

(8) Hostname

[CentOS6] / etc/sysconfig/network

[CentOS7] / etc/hostname

(9) time synchronization

[CentOS6]

$ntp

$ntpq-p

[CentOS7]

$chrony

$chronyc sources

(10) modification time

[CentOS6]

$vim / etc/sysconfig/clock

ZONE= "Asia/Tokyo"

UTC=fales

$sudo ln-s / usr/share/zoneinfo/Asia/Tokyo / etc/localtime

[CentOS7]

$timedatectl set-timezone Asia/Tokyo

$timedatectl status

(11) modify the area

[CentOS6]

$vim / etc/sysconfig/i18n

LANG= "ja_JP.utf8"

$/ etc/sysconfig/i18n

$locale

[CentOS7]

$localectl set-locale LANG=ja_JP.utf8

$localectl status

(12) Service related

1) start and stop

[CentOS6]

$service service_name start

$service service_name stop

$service sshd restart/status/reload

[CentOS7]

$systemctl start service_name

$systemctl stop service_name

$systemctl restart/status/reload sshd

Self-starting

[CentOS6]

$chkconfig service_name on/off

[CentOS7]

$systemctl enable service_name

$systemctl disable service_name

Service list

[CentOS6]

$chkconfig-list

[CentOS7]

$systemctl list-unit-files

$systemctl-type service

Forced stop

[CentOS6]

$kill-9

[CentOS7]

$systemctl kill-signal=9 sshd

(13) Network

1) Network information

[CentOS6]

$netstat

$netstat-I

$netstat-n

[CentOS7]

$ip n

$ip-s l

$ss

2) IP address MAC address

[CentOS6]

$ifconfig-a

[CentOS7]

$ip address show

3) routin

[CentOS6]

$route-n

$route-An inet6-n

[CentOS7]

$ip route show

$ip-6 route show

(14) restart and shutdown

1) close

[CentOS6]

$shutdown-h now

[CentOS7]

$poweroff

$systemctl poweroff

2) restart

[CentOS6]

$reboot

$shutdown-r now

[CentOS7]

$reboot

$systemctl reboot

3) single user mode

[CentOS6]

$init S

[CentOS7]

$systemctl rescue

4) Startup mode

[CentOS6]

[GUICUI]

$vim / etc/inittab

Id:3:initdefault:

[CUIGUI]

$startx

[CentOS7]

[GUICUI]

$systemctl isolate multi-user.target

[CUIGUI]

$systemctl isolate graphical.target

Default

$systemctl set-default graphical.target

$systemctl set-default multi-user.target

Current

$systemctl get-default

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

Servers

Wechat

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

12
Report