-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dddc9ee
commit 59a84d0
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 服务器基础环境配置 | ||
|
||
## 主机名 | ||
|
||
能具体描述一台主机的名字叫主机名(hostname),一般是由本地主机名+.+域名组成的,例如www.baidu.com这个FQDN就是一个主机名,www是本地主机的名字,baidu.com是域名。 | ||
|
||
linux查看域名的方式: | ||
|
||
```shell | ||
# hostname | ||
localhost.localdomain | ||
``` | ||
|
||
linux修改域名的方式 | ||
|
||
```shell | ||
例如本地主机是web服务器,域名是eagle.lab,那就应该将主机名设置为www.eagle.lab,设置方法有两种: | ||
第一种,用命令行修改,立即生效且永久生效 | ||
# hostnamectl set-hostname www.eagle.lab | ||
|
||
第二种,分两步 | ||
第一步先临时让主机名生效 | ||
# hostname www.eagle.lab | ||
第二步修改/etc/hostname文件,将文件内原先内容删除后,更改为www.eagle.lab,如果不做上一步操作,那就要重启后生效 | ||
# vim /etc/hostname | ||
www.eagle.lab | ||
``` |