• 进到系统etc目录下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Last login: Fri Dec 13 22:02:18 2019 from 192.168.124.19
[root@localhost ~]# cd /etc
[root@localhost etc]# ls
adjtime chkconfig.d dbus-1 favicon.png gshadow issue.net login.defs my.cnf pki rc0.d rsyslog.conf skel sysctl.d xinetd.d
aliases chrony.conf default filesystems gshadow- kdump.conf logrotate.conf my.cnf.d plymouth rc1.d rsyslog.d ssh systemd yum
aliases.db chrony.keys depmod.d firewalld gss kernel logrotate.d NetworkManager pm rc2.d rwtab ssl system-release yum.conf
alternatives cron.d dhcp fstab host.conf krb5.conf lvm networks polkit-1 rc3.d rwtab.d statetab system-release-cpe yum.repos.d
anacrontab cron.daily DIR_COLORS gcrypt hostname krb5.conf.d machine-id nsswitch.conf popt.d rc4.d sasl2 statetab.d terminfo
asound.conf cron.deny DIR_COLORS.256color gnupg hosts ld.so.cache magic nsswitch.conf.bak postfix rc5.d securetty subgid tmpfiles.d
audisp cron.hourly DIR_COLORS.lightbgcolor GREP_COLORS hosts.allow ld.so.conf makedumpfile.conf.sample openldap ppp rc6.d security subuid tuned
audit cron.monthly dracut.conf groff hosts.deny ld.so.conf.d man_db.conf opt prelink.conf.d rc.d selinux sudo.conf udev
bash_completion.d crontab dracut.conf.d group init.d libaudit.conf mke2fs.conf os-release printcap rc.local services sudoers vconsole.conf
bashrc cron.weekly e2fsck.conf group- inittab libnl modprobe.d pam.d profile redhat-release sestatus.conf sudoers.d virc
binfmt.d crypttab environment grub2.cfg inputrc libuser.conf modules-load.d passwd profile.d resolv.conf shadow sudo-ldap.conf wpa_supplicant
centos-release csh.cshrc ethertypes grub2-efi.cfg iproute2 locale.conf motd passwd- protocols rpc shadow- sysconfig X11
centos-release-upstream csh.login exports grub.d issue localtime mtab pkcs11 python rpm shells sysctl.conf xdg
  • 修改hostname文件
1
[root@localhost etc]# vim hostname
1
2
3
4
5
6
7
8
9
localhost.localdomain
~
~
~
~
~
~
~
"hostname"

修改为自己的

1
2
3
4
5
6
7
8
9
chobon
~
~
~
~
~
~
~
:wq

wq保存

检查下是否修改成功

1
2
3
[root@localhost etc]# cat hostname
chobon
[root@localhost etc]#
  • 重启系统
1
[root@localhost etc]# reboot

等系统重启后

1
2
Last login: Fri Dec 13 22:49:08 2019 from 192.168.124.19
[root@chobon ~]#