修改hostname
方法1. 通过yast2管理工具进行配置
在console中运行yast2工具修改主机名(hostname)
# yast2 network
对于配置未经配置的网卡
"Network cards configuration"中"Network cards configuration"中“Configure...”
对于修改已配置网卡的设置
"Network cards configuration"中"Network cards configuration"中“Changev...”

“Network address setup”中“Detailed settings”单击“Host name and name server”
在“Host name”输入框中输入主机名,在“Domain name”中数入域名,如果没有域名,接受缺省的
“local”
 

方法2. 通过修改配置文件的方式并运行命令修改主机名
修改/etc/HOSTNAME文件,在此文件中保存主机名,例如:
linuxserv1

然后运行命令设置主机名
# /etc/rc.d/boot.localnet start

方法3. 运行 sysctl 动态改变主机名
# sysctl -w kernel.hostname=linuxserv1


1). 网络配置工具配置:yast lan   --   配置接口IP 地址,主机名及路由
手工配置:
网络相关的系统配置文档如下:
1. 网卡接口配置文档
/etc/sysconfig/network/ifcfg-eth*
参见:/etc/sysconfig/network/ifcfg.template
2. 路由文档
/etc/sysconfig/network/routes
参见: man routes
3. 主机名
/etc/HOSTNAME
4. ip地址和主机对应关系
/etc/hosts
5. dns 客户端配置文档
/etc/resolv.conf
6. nsswitch.conf
/etc/nsswitch.conf
7. 网络服务(ip addr and route)
/etc/init.d/network
8. inetd 服务(telnet and ftp)
/etc/init.d/xinetd

2). 百兆全双工
一般需要在网络接口已启动的基础上,使用ethtool 工具进行配置
我写了一个脚本,脚本及其配置文档如下
服务脚本:/etc/init.d/setethlink
#! /bin/sh
# Copyright (c) 1995-2001 SuSE GmbH Nuernberg, Germany.
# Author: Wang Jun
# /etc/init.d/setethlink
# and symbolic its link
# /usr/sbin/rcsetethlink
### BEGIN INIT INFO
# Provides:    setethlink
# Required-Start: $network
# Required-Stop:
# Default-Start:   2 3 5
# Default-Stop: 0 1 6
# Description: raw-devices
### END INIT INFO
. /etc/rc.status
CONFIG=/etc/ethlink
ETHTOOL_BIN=/usr/sbin/ethtool
test -x $ETHTOOL_BIN || exit 5
if [ ! -f $CONFIG ];then
echo "file: $CONFIG not found"
exit 6
fi
rc_reset
case "$1" in
start)
line=`cat $CONFIG | grep -v ^#`
cat $CONFIG | awk -F":" ’{print $1" "$2" "$3" "$4}’ | while read ethdev ethautoneg ethspeed ethduplex;do
grep -q $ethdev /proc/net/dev
if [ $? -ne 0 ]; then
echo "interface $ethdev does not existed ..."
rc_failed 3
rc_status -v
else
if [ x$ethautoneg == "xon" ]; then
echo -n "set interface $ethdev autoneg on ..."
$ETHTOOL_BIN -s $ethdev autoneg $ethautoneg > /dev/null 2>&1
rc_status -v
else
echo -n "set interface $ethdev autoneg off speed $ethspeed duplex $ethduplex ..."
$ETHTOOL_BIN -s $ethdev autoneg off >/dev/null 2>&1 && $ETHTOOL_BIN -s $ethdev speed $ethspeed >/dev/null 2>&1 && $ETHTOOL_BIN -s $ethdev duplex $ethduplex >/dev/null 2>&1
rc_status -v
fi
fi
done
;;
stop)
echo -n "this service does not need stop..."
rc_failed 3
rc_status -v
;;
status)
line=`cat $CONFIG | grep -v ^#`
for i in $line;do
ethdev=`cat $CONFIG | cut -f1 -d:`
grep -q $ethdev /proc/net/dev
if [ $? -ne 0 ]; then
echo "interface $ethdev does not existed ..."
rc_failed 3
rc_status -v
else
$ETHTOOL_BIN $ethdev
rc_status -v
fi
done
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac
rc_exit
配置文档:/etc/ethlink
eth0:off:100:full
拷贝脚本到系统/etc/init.d 目录下
拷贝配置文档到/etc 目录下,文档内容根据实际需要修改
配置文档/etc/ethlink 语法:
#:::
eth0:off:100:full  
# chown root:root /etc/init.d/setethlink
# chmod 755 /etc/init.d/setethlink
# chown root:root /etc/ethlink
# chmod 644 /etc/ethlink
# insserv setethlink

3). 用户及组管理
=========================================================================================================  
添加用户:# useradd -m test
删除用户:# userdel -r test
添加组:# groupadd test
删除组:# groupdel test
名字文档搜索顺序:/etc/nsswitch.conf
口令文档:/etc/passwd
/etc/shadow
组文档:/etc/group
4).文档系统检查
创建文档系统# mkfs.ext3
e.g.: # mkfs.ext3 /dev/sdc6
参见:man mkfs.ext3
加载文档系统# mount
e.g.: # mount /dev/sdc6 /mnt/sdc6
参见:man mount         
卸载文档系统# umount
e.g.: # umount /mnt/sdc6
参见:man umount
将文档系统条目加如/etc/fstab
参见:man fstab
创建swap分区:# mkswap
参见:man mkswap
激活swap设备:# swapon -a
参见:man swapon
去激活swap设备:# swapoff -a
参见:man swapoff
 
5). 系统环境检查
在SLES 下能够使用env 命令检查session 的环境变量列表。
假如希望了解时区的配置,能够运行yast timezone 来查看和修改,相关的配置信息保存在/etc/sysconfig/clock 中,但是只修改这个文档不会产生效力。
检查系统开启了哪些服务能够运行以下命令:
# chkconfig | grep on$
启用某个服务# insserv ,例如:# insserv apache2  
禁用某个服务# insserv -r ,例如:# insserv -r apache2
系统运行级信息$ /sbin/runlevel  
系统运行级配置/etc/inittab 文档  
网络服务监听端口状态# netstat -anl
工具开启及禁用网络服务# yast2 inetd
手工开启及禁用网络服务1. 编辑/etc/xinetd.d 目录下的服务配置文档2. 重启xinetd 服务rcxinetd restart

6). 系统安全配置
工具配置系统安全相关配置(口令加密算法,最短口令长度,发出口令修改警告的最小天数和最大天数,口令过期前几天开始警告):yast2 security
命令行修改系统安全相关配置的相关文档:
/etc/login.def -- 发出口令修改警告的最小天数和最大天数,口令过期前几天开始警告
/etc/default/passwd -- 口令加密算法
/etc/security/pam_pwcheck.conf -- 最小口令长度
工具配置防火墙:yast2 firewall
手工配置防火墙: 配置文档/etc/sysconfig/SuSEfirewall2,服务rcSuSEfirewall

7). 时间同步配置
在SuSE Linux下怎样修改日期和时间
Q: 在SuSE Linux下怎样修改日期和时间
A: 能够运行yast2 timezone修改日期和时间,也能够运行命令修改日期和时间
运行命令修改日期和时间的命令是:
例如: 将日期和时间改为2004年11月27日22时20分
# date -s "2004/11/27 22:20:00" ; hwclock --systohc
工具配置时间服务器:yast2 ntp-client
手工配置时间服务器:配置文档/etc/ntp.conf ; 服务/etc/init.d/xntpd
参见:/usr/share/doc/packages/xntp-doc 下的文档

8). 配置工具
 在SLES 系统中的字符下和图像界面的配置工具都是YaST2。YaST2 支持多种界面前端,字符界面下使用基于ncurses 的字符菜单界面,在图像环境下使用基于qt 的图像界面。
周详内容参见’SLES 管理员手册- 第一部分 安装- YaST 部分’
字符界面启动方式:
# yast
图像界面启动方式:
$ sux
# yast2
查看yast 配置模块的命令
# yast -l
快速启动某个配置项目
# yast
常用yast 模块
user       用户及口令管理
group     组管理
security   安全相关配置
firewall   防火墙配置
lan       网络配置
host    /etc/hosts 文档配置
inetd    xinetd 网络服务配置
runlevel   运行级别及sysv启动服务配置
timezone   时间及时区配置
ntp-client 时间服务配置
disk       分区及文档系统配置
lvm       逻辑卷及文档系统配置
 
在多台Linux 主机之间,可以使用NFS 共享文件。 在提供文件的Linux 机器上安装NFS Server 并设置共享:安装NFS Server,Debian 上可安装nfs-kernel-server·  在/etc/exports 中设置共享规则,详见exports(5)重新加载共享规则,在Debian 上可用/etc/init.d/nfs-kernel-server reload,其他Linux 要访问NFS Server 共享的文件直接mount 其共享的目录即可(文件系统类型选nfs, 即-t nfs)。注意,若NFS Server 以只读方式共享一目录,那么在mount 时也应使用只读方式(-r 选项)。在字符命令格式下输入yast回车就可以配置SUSE系统