---
title: "CentOS5.5 修改主机名"
author: "uu4u"
date: "2011-06-18T18:50:56Z"
tags: []
categories: ["操作系统"]
slug: "centos5-5"
draft: false
lastmod: "2012-04-05T22:48:44Z"
id: 1097504
url: "https://uu4u.iteye.com/blog/1097504"
---

怎样更改Centos主机名



第一步：


         shell 命令 #hostname yourhostname 


第二步：


修改/etc/sysconfig/network中的hostname



# vim /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

#HOSTNAME=localhost.localdomain

HOSTNAME=yourhostname~



第三步：


修改/etc/hosts文件


# vim /etc/hosts


# Do not remove the following line, or various programs


# that require network functionality will fail.


127.0.0.1 localhost.localdomain localhost yourhostname
::1 localhost6.localdomain6 localhost6



----问鼎清云--专注IDC--主机托管--服务器托管

----因为专注，所以专业

<http://www.chingcloud.com>