admin管理员组文章数量:1656604
2024年5月8日发(作者:)
安装好虚拟机后进入终端时是:[root@localhost ~]#
也就是主机名为:localhost
那么如何改成自己想要的主机名呢
1.修改/etc/host内容
未修改前状态是:
[root@localhost ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 omain localhost
[root@localhost ~]#
在末尾加上自己想要的主机名和ip地址(用ifconfig命令即可看到本机的ip地址了):
用vi /etc/hosts命令修改hosts文件的内容,修改后如下:
[root@localhost ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 omain localhost
192.168.211.130 life
[root@localhost ~]#
2.修改/etc/sysconfig/network文件:
修改前如下:
[root@localhost ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=omain
[root@localhost ~]#
版权声明:本文标题:虚拟机中linux系统修改主机名和ip地址 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/xitong/1715106572a435453.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论