028-86922220

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

Linux修改主机名(hostname)

在以前的Linux版本中,要是修改主机名,先需要先用命令hostname设置,然后再修改/etc/hostname文件,有点麻烦,从Linux7开始可用一条命令搞定,如下:


  1. [root@ip-172-31-29-22 ~]# hostname
  2. ip-172-31-29-22.ap-northeast-1.compute.internal
  3. [root@ip-172-31-29-22 ~]#
  4. [root@ip-172-31-29-22~]# hostnamectlset-hostname aws
  5. [root@ip-172-31-29-22 ~]# hostname
  6. aws
  7. [root@ip-172-31-29-22~]# cat/etc/hostname
  8. aws


文章标题:Linux修改主机名(hostname)
浏览路径:http://www.tsicrk.com/article/piphos.html

其他资讯

让你的专属顾问为你服务

2.2612s