How to Change the Hostname of a Linux System

How to Change the Hostname of a Linux System

refer from : http://www.ducea.com/2006/08/07/how-to-change-the-hostname-of-a-linux-system/

Normally we will set the hostname of a system during the installation process. Many peoples don’t care about this, and don’t change the hostname even if for example this was set to something really stupid by the datacenter that installed the system (most likely they will set this to “debian” on any debian installation, etc). For me, it is important to see on each one of the ssh screens I will have open at any time a different hostname that is relevant and will give me quickly the information on what system I am logged in.

Change the hostname on a running system

On any Linux system you can change its hostname with the command ’hostname’ (surprised?)… Here are some quick usages of the command line hostname:

hostname

without any parameter it will output the current hostname of the system.

hostname –fqd

it will output the fully qualified domain name (or FQDN) of the system.

hostname NEW_NAME

will set the hostname of the system to NEW_NAME. This is active right away and will remain like that until the system will be rebooted (because at system boot it will set this from some particular file configurations – see bellow how to set this permanently). You will most probably need to exit the current shell in order to see the change in your shell prompt.

Permanent hostname change on Debian based systems

Debian based systems use the file /etc/hostname to read the hostname of the system at boot time and set it up using the init script /etc/init.d/hostname.sh

/etc/hostname

server

So on a Debian based system we can edit the file /etc/hostname and change the name of the system and then run:

/etc/init.d/hostname.sh start

to make the change active. The hostname saved in this file (/etc/hostname) will be preserved on system reboot (and will be set using the same script we used hostname.sh).

Permanent hostname change on RedHat based systems

RedHat based system use the file /etc/sysconfig/network to read the saved hostname at system boot. This is set using the init script /etc/rc.d/rc.sysinit

/etc/sysconfig/network

NETWORKING=yes

HOSTNAME=”plain.domainname.com”

GATEWAY=”192.168.0.1″

GATEWAYDEV=”eth0″

FORWARD_IPV4=”yes”

So in order to preserve your change on system reboot edit this file and enter the appropriate name using the HOSTNAME variable.

Use sysctl to change the hostname

Why would someone need a different method of doing the same thing as above? No idea, but here is anyway: use sysctl to change the variable kernel.hostname: Use:

sysctl kernel.hostname

to read the current hostname, and

sysctl kernel.hostname=NEW_HOSTNAME

to change it.

 

No manual entry for printf in section 3

No manual entry for printf in section 3

Fedora && Ubuntu 安装manual

clip_image001

Fedora

用虚拟机装好fedora 19之后,竟然查阅不到,

直接yum install man-pages即可解决。

Ubuntu

网上看到说是安装manpages-dev即可。

亮点

clip_image002

现在fedora19grouplist多了好几个比较好的包,比如:

GNOME Desktop

   KDE Plasma Workspaces

   Xfce Desktop

   LXDE Desktop

   Cinnamon Desktop

   MATE Desktop

   Sugar Desktop Environment

   Development and Creative Workstation

   Web Server

   Infrastructure Server

   Basic Desktop

   Minimal Install

   C Development Tools and Libraries

   Development Tools

   LibreOffice

   RPM Development Tools

   System Tools

   3D Printing

   Administration Tools

   Authoring and Publishing

   Books and Guides

   Cloud Infrastructure

   Design Suite

   Editors

   Educational Software

   Electronic Lab

   Engineering and Scientific

   Fedora Eclipse

   Games and Entertainment

   Medical Applications

   Milkymist

   Network Servers

   Office/Productivity

   Robotics

   Security Lab

   Sound and Video

   Text-based Internet

   Window Managers

特别是上面的C开发和开发工具,偶觉得都是亮点。

 

 

 

 

linux distribution

Linux发行版

Linux系统所需要的4个主要组件结合到一起就就形成了一个Linux系统。各种Linux发行版一般可以分为3种类型:

l  核心Linux发行版

l  特定发行版

l  LiveCD测试发行版

1.1.1          核心Linux发行版

核心Linux发行版包括内核、一个或多个图形桌面环境,以及几乎所有的Linux应用程序,它针对内核进行了预编译。只需要该发行版即可安装完整的Linux。例如:

Slackware

clip_image002

Red Hat

clip_image004

Fedora

clip_image006

Gentoo

clip_image008

Mandriva

clip_image009

OpenSUSE

clip_image011

Debian

clip_image012

等。

这个版本的缺点在于安装过程中可能会比较麻烦,会问很多关于如何配置硬件及默认加载的应用程序。

1.1.2          特定Linux发行版

该版本通常以一个主要的发行版为基础,但是只包含对特定领域有用的应用程序子集。

除了提供专门的软件,定制的Linux发行版还试图为Linux初级用户提供帮助自动检测和自动配置常用的硬件设备,这使得安装Linux的过程变得更加轻松。例如:

Linspire

clip_image013

Xandros

clip_image014

SimplyMEPIS

clip_image015

Ubuntu

clip_image017

PCLinuxOS

clip_image018

dyne:bolic

clip_image019

Puppy Linux

clip_image021

等。

许多特定Linux发行版以Debian Linux发行版为基础,它们使用的安装文件与Debian相同,但是软件包只是完整Debian系统的一小部分。

1.1.3          Linux LiveCD

LiveCD是最近才出现的东东,无需安装即可了解Linux系统的全貌。除了标准的硬盘启动之外,现在的大部分PC都可以从CD启动,利用这一点,很多Linux发行版创建了可引导的CD,其中包含一个示例Linux系统即为LiveCD

这是测试各种Linux发行版的很好方法,它丝毫不会弄乱你的PC。只需要放入CD然后启动就可以体验该系统,当然有个缺点,因为是在CD上,所以你做的任何更改在重启后都会丢失。另外由于在CD运行,速度可能会运行的较慢,但是现在也加入了一些新的技术来改进,比如:

l  Linux系统文件从CD复制到内存;

l  将系统文件复制到硬盘中;

l  USB记忆棒中存储系统设置;

l  USB记忆棒中存储用户设置;

 

比如下面的一些发型版:

Knoppix

clip_image022

SimplyMEPIS

clip_image024

PCLinuxOS

clip_image026

Ubuntu

clip_image027

Slax

clip_image029

Puppy Linux

clip_image030