linux配置host:如何在Linux系统中配置主机(Host)

Linux配置host的步骤如下:打开终端,使用root用户登录;

Linux配置host的步骤如下:

1. 打开终端,使用root用户登录;

2. 使用vi编辑器打开/etc/hosts文件,添加要配置的host信息;

3. 保存/etc/hosts文件,并退出vi编辑器;

4. 使用命令“sudo service network restart”重启网络服务,使配置生效。

以下是具体代码:


# login as root
su root
# open /etc/hosts file with vi editor
vi /etc/hosts
# add host info in the file
127.0.0.1 localhost
192.168.1.100 www.example.com
# save and exit
:wq
# restart network service
sudo service network restart

本站系公益性非盈利分享网址,本文来自用户投稿,不代表边看边学立场,如若转载,请注明出处

(441)
linux 公社:Linux系统管理员如何进行有效的日常维护
上一篇
linux批量创建用户脚本:批量创建 Linux 用户脚本
下一篇

相关推荐

发表评论

登录 后才能评论

评论列表(47条)