Linux入门——基础系统设置命令

以下为centos7实验环境

  1.网卡管理工具命令——nmcli

    参考http://www.iteye.com/topic/1141839

  2.主机名称设置——hostnamectl

[root@study ~]# hostnamectl [set-hostname 你的主机名]
# 1\. 显示目前的主机名称与相关信息
[root@study ~]# hostnamectl
Static hostname: study.centos.vbird # 这就是主机名称
Icon name: computer
Chassis: n/a
Machine ID: 309eb890d09f440681f596543d95ec7a
Boot ID: b2de392ff1f74e568829c716a7166ecd
Virtualization: kvm
Operating System: CentOS Linux 7 (Core) # 操作系统名称!
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-229.el7.x86_64 # 核心版本也提供!
Architecture: x86_64 # 硬件等级也提供!
# 2\. 尝试修改主机名称为 www.centos.vbird 之后再改回来~
[root@study ~]# hostnamectl set-hostname www.centos.vbird
[root@study ~]# cat /etc/hostname
www.centos.vbird
[root@study ~]# hostnamectl set-hostname study.centos.vbird

    关于单纯主机名查看与设置命令——hostname,参考http://linux.51yip.com/search/hostname

    修改主机名与hostname,参考http://blog.csdn.net/brady74/article/details/60407134

    (windows主机最好也进行修改一下hosts,这样以后直接通过主机名就可以进行连接了!)

    可以设置为192.168.137.128 mini1 zk01 kafka01,这样以后可以多个主机名都映射这个IP了,方便见名知意!

  3.日期时间设置工具——timedatectl

[root@study ~]# timedatectl [commamd]
选项与参数:
list-timezones :列出系统上所有支持的时区名称
set-timezone :设置时区位置
set-time :设置时间
set-ntp :设置网络校时系统
# 1\. 显示目前的时区与时间等信息
[root@study ~]# timedatectl
Local time: Tue 2015-09-01 19:50:09 CST # 本地时间
Universal time: Tue 2015-09-01 11:50:09 UTC # UTC 时间,可称为格林威治标准时间
RTC time: Tue 2015-09-01 11:50:12
Timezone: Asia/Taipei (CST, +0800) # 就是时区啰!
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
# 2\. 显示出是否有 New_York 时区?若有,则请将目前的时区更新一下
[root@study ~]# timedatectl list-timezones | grep -i new
America/New_York
America/North_Dakota/New_Salem
[root@study ~]# timedatectl set-timezone "America/New_York"
[root@study ~]# timedatectl
Local time: Tue 2015-09-01 07:53:24 EDT
Universal time: Tue 2015-09-01 11:53:24 UTC
RTC time: Tue 2015-09-01 11:53:28
Timezone: America/New_York (EDT, -0400)
[root@study ~]# timedatectl set-timezone "Asia/Taipei"
# 最后还是要记得改回来台湾时区喔!不要忘记了!

    关于更多日期时间设置命令date,参考http://linux.51yip.com/search/date

  4.语系设置工具——localectl

[root@study ~]# localectl set-locale LANG=en_US.utf8

  5.简单防火墙设置

systemctl stop firewalld.service
systemctl start iptables.service

   6.查看发行版本信息

cat /etc/redhat-release 

  内核信息:

uname -r
uname -a

 

posted @ 2017-12-27 19:31  ---江北  阅读(357)  评论(0编辑  收藏  举报
TOP