Redhat 7 的新功能 (centos7)

最後更新: 2017-05-31

Installation:

* Installer: Kickstart (a single file is created, containing the answers to all the questions)
* Boot Loader: GRUB2 (GPT, NTFS)

Storage:

* iSCSI: LIO kernel Target Subsystem
* /tmp directory can now be used as a temporary file storage system (tmpfs)
* LVM Cache
* Default file system: XFS
  (XFS file system can also be defragmented and expanded while mounted and active. )
* pNFS (NFS v4.1)(layouts: files, objects, and blocks. )

Kernel:

* kernel version 3.10
* Dynamic kernel Patching (kpatch), AMD64 and Intel 64 architectures only
* swap memory compression
* includes the Open vSwitch kernel module
  https://access.redhat.com/knowledge/articles/270223

KVM:

* virtio-blk-data-plane (dedicated thread that is optimized for I/O performance. )
* virtio_net
* virtio_scsi
  (each virtual CPU can have a separate transmit or receive queue and separate interrupts)
* live migration: Page Delta Compression
* Live Migration Thread
* virtio-rng
* Bridge Zero Copy Transmit (disabled by default. )
* QCOW2 version 3 Image Format

VPS:

 - Docker Format
 - lxc
    = net_cls — tags network packets with a class identifier (classid)
    = hugetlb — allows to use virtual memory pages of large sizes

Network:

 * bond2team (Network Teaming has been introduced as an alternative to bonding for link aggregation.)
 * firewalld (Dynamic Firewall Daemon)
 * DNSSEC
 * SYNPROXY (filters out false SYN-ACK and ACK packets before the socket enters the "listen" state lock)
 * Network Hardware Offload (Mellanox ConnectX3-pro Ethernet NIC card)

Services:

 * Init: systemd
 - On-demand starting of daemons
 - Managing of control groups

Introducing:

- Apache 2.4 ( "Event" processing module )
 - MariaDB 5.5
 - Samba 4.1
    = SMB3 transport enables encrypted transport
    = server-side copy operations
 
Clustering:

 - Pacemaker (pcs)
 - HAProxy (TCP/HTTP reverse proxy)
    = add, modify, and delete HTTP headers
    = persistence through the use of HTTP cookies
    = block requests matching particular patterns
 - Keepalived (Layer-4 load balancing.)[Virtual Router Redundancy Protocol (VRRPv2)]

 

DOC:

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/index.html
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7...
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Li...
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7...

 

 



Centos7

 

安裝 net-tools

# 找不到 ifconfig 及 netstat

yum install net-tools

/bin/netstat
/sbin/arp
/sbin/ether-wake
/sbin/ifconfig
/sbin/ipmaddr
/sbin/iptunnel
/sbin/mii-diag
/sbin/mii-tool
/sbin/nameif
/sbin/plipconfig
/sbin/route
/sbin/slattach

iptables

# 不想用 firewalld

yum install iptables-services

 

systemctl

systemctl stop avahi-daemon

systemctl disable avahi-daemon

service --status-all

nic name

CentOS7 has a default nic name as "en????"

修改 /etc/default/grub

GRUB_CMDLINE_LINUX="... net.ifnames=0 biosdevname=0 ..."

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

 

# Disable the NetworkManager service

ifcfg-eth0

NM_CONTROLLED='no'

systemctl stop NetworkManager

systemctl disable NetworkManager

 

Timezone

timedatectl list-timezones

timedatectl set-timezone region/timezone

i.e.

timedatectl set-timezone  Asia/Hong_Kong

Swap

fallocate -l 4G /swapfile

chmod 600 /swapfile

mkswap /swapfile

swapon /swapfile

sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'

 

set hostname

新的 Centos 一共有以下 hostname 類型

 (1) static,
 (2) transient, and
 (3) pretty.
 
The "static" hostname is also known as kernel hostname, which is initialized from /etc/hostname automatically at boot time.

The "transient" hostname is a temporary hostname assigned at run time, for example, by a DHCP or mDNS server.

"pretty" hostname is allowed to have a free-form

# 查看

hostnamectl status

   Static hostname: localhost.localdomain
Transient hostname: x.y.z
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 80a476a9db4d449b8928ea7cf47ced6d
           Boot ID: a4742856ccb94c3ba247f2af1f0a239d
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.13.2.el7.x86_64
      Architecture: x86_64

# To change all three hostnames

hostnamectl set-hostname <host-name>

/etc/hostname

OR

/etc/sysconfig/network

HOSTNAME=x.y.z

systemctl restart systemd-hostnamed

# Other CMD: 

hostname <-- transient

rc.local 沒有執行

In CentOS 7, the /etc/rc.local not enabled by default,

ls -l /etc/rc.local

lrwxrwxrwx 1 root root 13 Jul 21 22:57 /etc/rc.local -> rc.d/rc.local

ls -l /etc/rc.d/rc.local

-rw-r--r--. 1 root root 474 Jul 21 22:57 /etc/rc.d/rc.local

解決:

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

Environment

It is executed as root.

lt run as separate processes, which means they have no way to modify their parent's environment.

It runs before the operating system is fully booted but has not yet started the login shell,

so the environment variables we configured in /etc/profiles or bashrc are not executed.

Service

systemctl start rc-local

systemctl enable rc-local

systemctl status rc-local

cat /usr/lib/systemd/system/rc-local.service

Service start on boot

systemctl status mariadb

Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)

enabled => will start on boot

 


CentOS 7 NetInstall

 

Step0:

http://ftp.cuhk.edu.hk/pub/Linux/centos/7.0.1406/isos/x86_64/ 下載 ISO

# 362M
CentOS-7.0-1406-x86_64-NetInstall.iso

Step1: Setup Network and Hostname

 

NetInstall URL

http://ftp.cuhk.edu.hk/pub/Linux/centos/7/os/x86_64/

OR

http://mirror.centos.org/centos/7/os/x86_64/

website 的 root directory 有

CentOS_BuildTag
Packages/
repodata/

 


Grub boot menu

 

 * Do not attempt to manually edit the boot menu ("/boot/grub2/grub.cfg")

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

設定

/etc/default/grub

/etc/grub.d/40_custom

grub2-editenv list

saved_entry=CentOS Linux (3.10.0-514.16.1.el7.x86_64) 7 (Core) with debugging

# 由 1 開始

grub2-set-default 1

# To list all the menu entries that will be displayed at system boot

grep "^menuentry" /boot/grub2/grub.cfg | cut -d "'" -f2