以前是搞Centos的,无赖现公司生产环境使用的是Ubuntu,记录下常见使用情况下的一些不同点.....:
- 软件安装管理:
Centos使用yum install,Ubuntu使用apt-get install
Centos搜索已安装软件使用rpm -q,Ubuntu使用dpkg -l
Ubuntu默认文本编辑器为nano,使用系统管理工具可修改默认编辑器update-alternatives --config editor(或select-editor)
Ubuntu查找命令或文件属于哪个包使用apt-file search,查找源上软件版本信息使用apt-cache madison docker-ce ,搜索源上软件使用aptitude search;cenots使用yum provides
Ubuntu默认sh软链接的是dash环境,并不是bash,请习惯sh xxx.sh运行脚本的老铁们注意。
- 网卡配置文件:
Centos网卡配置文件目录在/etc/sysconfig/network-scripts/网卡名
Ubuntu 16网卡配置文件目录在/etc/network/interfaces
配置示例:
Centos
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=9936589f-50ac-4e23-b64a-a8a31abfdd91 DEVICE=ens33 ONBOOT=yes IPADDR=192.168.254.129 PREFIX=255.255.255.0 GATEWAY=192.168.254.2 ZONE= |
Ubuntu 16版本(重启网络服务sudo systemctl restart networking)
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens33 iface ens33 inet static address 192.168.254.128 netmask 255.255.255.0 gateway 192.168.254.2 dns-nameservers 114.114.114.114 |
ubuntu 18版本为/etc/netplan/目录下面的yaml文件:
network:
ethernets:
eno1:
addresses:
- 172.16.3.175/24
gateway4: 172.16.3.1
nameservers:
addresses:
- 202.96.134.133
dhcp4: false
version: 2
netplan apply 应用网络配置。
- Ubuntu使用国内163源:
以下部分加入/etc/apt/source.list文件最前端,注意备份。
deb http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse |
- 系统相关日志(默认)
系统默认日志路径配置文件:/etc/rsyslog.d/50-default.conf
/var/log/syslog 系统日志
/var/log/auth.log 所有和用户认证相关的日志
/var/log/kern.log 系统内核日志