镜像下载
CentOS 7.6 DVD版 4G
http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-DVD-1810.iso
CentOS 7.6 最小化版 918M
http://mirrors.163.com/centos/7.6.1810/isos/x86_64/CentOS-7-x86_64-Minimal-1810.iso
CentOS 7.5 DVD版 4G
http://mirrors.163.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-DVD-1804.iso
CentOS 7.5 最小化版 918M
http://mirrors.163.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-Minimal-1804.iso
查看系统版本
# cat /etc/system-release
# cat /etc/redhat-release
# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
软件管理
使用rpm命令
rpm -qa:查询所有已安装的包。
-q, --query
-a, --all
rpm -ivh xxx:安装软件
-i, --install
-v:打印详细信息
-h, --hash:解压软件包时打印50个哈希标记
使用yum命令
yum makecache:就是把服务器的包信息下载到本地电脑缓存起来,配合yum -C search xxx
使用不用上网检索就能查找软件信息。
yum list installed:查询已安装软件包。
yum install xxx:安装软件包。比如yum install wget
yum update:升级软件包。
yum remove xxx:卸载软件包及其依赖。比如yum remove mariadb-libs-5.5.68-1.el7.x86_64
-C, --cacheonly:只运行在缓存数据
[root@localhost ~]# rpm -qa | grep zlib
zlib-1.2.7-21.el7_9.x86_64
[root@localhost ~]# yum list installed | grep zlib
zlib.x86_64 1.2.7-21.el7_9 @updates
安装EPEL软件源
安装Docker:
https://www.cnblogs.com/wang-yaz/p/10429899.html
网络
重启网络:systemctl restart network
防火墙
CentOS 7之后默认使用Firewalld作为防火墙。
Firewalld中使用区域(Zone)的概念,区域是预定义的规则集。默认情况下,所有网络接口/网卡都分配有默认区域,且public区域被设置为默认区域。
[root@localhost ~]$ firewall-cmd --get-zones # 查看预定义的区域
block dmz drop external home internal public trusted work
[root@localhost ~]$ firewall-cmd --get-active-zones # 查看网络接口关联了哪些区域
public
interfaces: enp0s3 enp0s8
[root@localhost ~]$ firewall-cmd --list-all # 列出默认区域关联的服务
public (active)
target: default
icmp-block-inversion: no
interfaces: enp0s3 enp0s8
sources:
services: dhcpv6-client ssh
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
在修改防火墙配置的命令中,如果没有--permanent
参数,规则即时生效,但重启后规则失效,加上了--permanent
参数,规则不会即时生效,需要重启防火墙服务才能生效。
在查询防火墙配置的命令中,如果没有--permanent
参数,列出的是所有的规则(包括运行时规则和永久规则),加上了--permanent
参数,列出的是永久规则。
# 开放端口
[root@localhost ~]$ firewall-cmd --zone=public --add-port=80/tcp --permanent
# 重启防火墙服务
[root@localhost ~]$ firewall-cmd --reload