Linux 操做系統的啓動首先從 BIOS 開始,接下來進入 boot loader,由 bootloader 載入內核,進行內核初始化。內核初始化的最後一步就是啓動 pid 爲 1 的 init 進程。這個進程是系統的第一個進程。它負責產生其餘全部用戶進程。init 以守護進程方式存在,是全部其餘進程的祖先。init 進程很是獨特,可以完成其餘進程沒法完成的任務。sql
Sysvinit就是 system V 風格的 init 系統,Sysvinit 用術語 runlevel 來定義"預訂的運行模式"。Sysvinit 檢查 '/etc/inittab' 文件中是否含有 'initdefault' 項。 這告訴 init 系統是否有一個默認運行模式。Sysvinit 使用腳本,文件命名規則和軟連接來實現不一樣的 runlevel,串行啓動各個進程及服務。數據庫
Systemd 是 Linux 系統中最新的初始化系統(init),它主要的設計目標是克服 sysvinit 固有的缺點,提升系統的啓動速度。systemd 和 ubuntu 的 upstart 是競爭對手,預計會取代 UpStart。Systemd的目標就是儘量啓動更少的進程,儘量將更多進程並行啓動。ubuntu
EXT4是第四代文件系統,是Linux下的日誌文件系統。centos
xfs是一個64位文件系統,對於一個32位Linuix系統,文件和文件系統的大小被限制在16TB。bash
[root@centos7 ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) 已經關閉 Active: inactive (dead) 開機不啓動 Docs: man:firewalld(1)
[root@centos7 ~]# systemctl stop firewalld #關閉firewalld [root@centos7 ~]# systemctl disable firewalld.service #關閉開機啓動
安裝iptables服務並配置tcp
[root@centos7 ~]# yum install iptables-services -y [root@centos7 ~]# systemctl status iptables ● iptables.service - IPv4 firewall with iptables Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled; vendor preset: disabled) Active: inactive (dead) [root@centos7 ~]# systemctl start iptables [root@centos7 ~]# systemctl enable iptables.service Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service. [root@centos7 ~]# systemctl status iptables.service ● iptables.service - IPv4 firewall with iptables Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled) Active: active (exited) since Sun 2018-03-25 14:07:03 CST; 44s ago Main PID: 9727 (code=exited, status=0/SUCCESS) Mar 25 14:07:03 centos7 systemd[1]: Starting IPv4 firewall with iptables... Mar 25 14:07:03 centos7 iptables.init[9727]: iptables: Applying firewall rules: [ OK ] Mar 25 14:07:03 centos7 systemd[1]: Started IPv4 firewall with iptables. [root@centos7 ~]# systemctl restart iptables.service [root@centos7 ~]# iptables -L -n Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination
[root@centos7 ~]# cat /etc/sysconfig/iptables #iptables配置文件 # sample configuration for iptables service # you can edit this manually or use system-config-firewall # please do not ask us to add additional ports/services to this default configuration *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT