基本原理及概念:
一、配服务器的IP地址:
二、yum 的配置如下:
1.[root@localhost ~]# mount /dev/cdrom /mnt/cdrom
2.[root@localhost ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-server] //描述目录
name=Red Hat Enterprise Linux server //名称(不受影响)
baseurl=file:///mnt/cdrom/Server //准确目录
enabled=1 // 启用该功能
gpgcheck=1 //签名检测
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release //钥匙文件
[rhel-vt]
name=Red Hat Enterprise Linux vt
baseurl=file:///mnt/cdrom/VT
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[rhel-cluster]
name=Red Hat Enterprise Linux cluster
baseurl=file:///mnt/cdrom/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[rhel-clusterstorage]
name=Red Hat Enterprise Linux clusterstorage
baseurl=file:///mnt/cdrom/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
3.[root@localhost ~]# yum repolist // 查看Yum的配置信息
三、kickstart的图形界面配置如下:
1.[root@localhost ~]# yum list all |grep kickstart
This system is not registered with RHN.
RHN support will be disabled.
pykickstart.noarch 0.43.5-1.el5 rhel-server
system-config-kickstart.noarch 2.6.19.8-2.el5 rhel-server
2.[root@localhost ~]# yum install -y system-config-kickstart
3.[root@localhost ~]#system-config-kickstart
配时区 ROOT Password Reboot install text
FTP服务器 IP 文件存放的默认目录pub
内核参数: rhgb(以图形的方式引导) quiet (与用户无关的信息不显示)
分区时注意 swap是文件系统类型
清楚MBR 移除所有已存在的分区 初始化磁盘及具体分区
IP 地址通过eth0动态获取
防火墙 SELinux 都关闭
开发包 GNOME
应用程序按需选择(为了启动快,尽量不要选声音与视频)
开发库及开发工具
管理工具及系统工具
安装时携带执行的shell脚本(按需编写,可不写)
脚本命令如下:
A=`ifconfig |grep -i bcast | awk '{ print $2 }'`// 获取addr:ip地址
sed -i "s/HOSTNAME.*/HOSTNAME=gjp${A##*.}.baidu.com / " /etc/sysconfig/network //红色字体(IP 地址的最后一段作为主机的标识)
sed -i "s/127.0.0.1.*/127.0.0.1 localhost.localdomain localhost / " /etc/hosts //把红色的一行用蓝色的内容代替
B=${A#*:} //获取IP地址
M=`ifconfig |grep -i Mask |awk '{print $4}'` //获取Mask:255.255.255.0
L=${M#*:} //获取子网掩码
sed -i "s/dhcp$/none/" /etc/sysconfig/network-scripts/ifcfg-eth0
//把以dhcp结尾的改为none
echo "NETMASK=$L">> /etc/sysconfig/network-scripts/ifcfg-eth0
//把子网掩码追加到ifcfg-eth0文件里
echo "IPADDR=$B">> /etc/sysconfig/network-scripts/ifcfg-eth0
//把IP地址追加到ifcfg-eth0文件里
单击“文件”--“保存文件” 可重命名,在这里命名为k.cfg
显示文件基本信息
4.[root@localhost ~]# vim /root/k.cfg
增加
4 key –skip //遇到key的跳过
5 services --disable sendmail //禁止sengmail服务
四、FTP服务器的配置如下:
3.[root@localhost ~]# ftp 192.168.10.100
Connected to 192.168.10.100.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (192.168.10.100:root): anonymous //用匿名登录
331 Please specify the password.
Password: //密码为空,直接回车即可
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls //显示存在的文件
227 Entering Passive Mode (192,168,10,100,32,213)
150 Here comes the directory listing.
drwxr-xr-x 2 0 0 4096 Aug 02 05:40 pub
ftp> cd pub
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,10,100,252,253)
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 5 Aug 02 05:40 index.html
4.[root@localhost ~]# cd /var/ftp/pub
[root@localhost pub]# ls
[root@localhost pub]# touch index.html //创建一个文件
[root@localhost pub]# echo "123 ">index.html // 写入内容
5.测试:
6.挂载光盘cd /dev/cdrom /mnt/cdrom //把RED HAT 5.4的iso加载过来
[root@localhost cdrom]# cp -r . /var/ftp/pub //把镜像文件拷进去,用于安装时查找并安装
[root@localhost ftp]# du -sh // 显示ISO的大小,与实际对比,证明已经拷贝完成
2.9G
[root@localhost ~]# cp /root/k.cfg /var/ftp/pub
[root@localhost ~]# cd /var/ftp/pub //确保拷贝成功
[root@localhost pub]# ll -d k.cfg
-rw-r--r-- 1 root root 1914 Aug 2 20:17 k.cfg
五.DHCP 服务器的配置如下:
1.[root@localhost Server]# yum install -y dhcp (-y 表示安装时无需交互,)
2.[root@localhost ~]# vim /etc/dhcpd.conf
底行模式输入
:-r /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample 回车
subnet 192.168.10.0 netmask 255.255.255.0 {
7 # --- default gateway
8 option routers 192.168.10.254; //网关
9 option subnet-mask 255.255.255.0; //Mask
option domain-name-servers 222.88.88.88; //DNS
22 range dynamic-bootp 192.168.10.11 192.168.10.99; //可分配IP范围
3.[root@localhost ~]# service dhcpd restart //服务重启
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
六.TFTP服务器的配置:
1.[root@localhost ~]# rpm -qa |grep tftp-server //查询该服务是否已安装
tftp-server-0.49-2
2.[root@localhost ~]# rpm -ql tftp-server // 定位tftp-server所在的路径
/etc/xinetd.d/tftp //依赖于超级守护进程
/tftpboot
/usr/sbin/in.tftpd
/usr/share/man/man8/in.tftpd.8.gz
/usr/share/man/man8/tftpd.8.gz
3.[root@localhost ~]# vim /etc/xinetd.d/tftp //编写超级守护进程
6 service tftp (注意:第一列为行号)
7 {
8 socket_type = dgram
9 protocol = udp //69号端口
10 wait = yes //单线程
11 user = root
12 server = /usr/sbin/in.tftpd //真正的进程
13 server_args = -s /tftpboot
14 disable = no //必须开启
15 per_source = 11
16 cps = 100 2
17 flags = IPv4
18 }
4.[root@localhost ~]# grep tftp /etc/services 可查看服务类型、服务号
tftp 69/tcp
tftp 69/udp
tftp-mcast 1758/tcp
tftp-mcast 1758/udp
mtftp 1759/udp
subntbcst_tftp 247/tcp # SUBNTBCST_TFTP
subntbcst_tftp 247/udp # SUBNTBCST_TFTP
etftp 1818/tcp # Enhanced Trivial File Transfer Protocol
etftp 1818/udp # Enhanced Trivial File Transfer Protocol
tftps 3713/tcp # TFTP over TLS
tftps 3713/udp # TFTP over TLS
5.[root@localhost ~]# service xinetd restart //必须启用真正的进程
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
6.[root@localhost ~]# cd /tftpboot/
[root@localhost tftpboot]# cp /usr/lib/syslinux/pxelinux.0 ./
[root@localhost tftpboot]# cp /mnt/cdrom/images/pxeboot/vmlinuz ./
[root@localhost tftpboot]# cp /mnt/cdrom/images/pxeboot/initrd.img ./
[root@localhost tftpboot]# mkdir -pv pxelinux.cfg //创建目录
mkdir: created directory `pxelinux.cfg'
[root@localhost tftpboot]# cp /mnt/cdrom/isolinux/isolinux.cfg pxelinux.cfg/default //拷贝文件到pxelinux.cfg目录下,并重命名default文件
7.[root@localhost tftpboot]# vim ./pxelinux.cfg/default //编辑default文件
3 timeout 6
12 append ks=ftp://192.168.10.100/pub/k.cfg ksdevice=eth0 initrd=initrd.img
8.[root@localhost ~]# vim /etc/dhcpd.conf
12 option domain-name "domain.org";
13 option domain-name-servers 222.88.88.88;
14 next-server 192.168.10.100 // tftp服务器地址
15 filename "pxelinux.0" //文件名
七.安装成功后的界面与测试:
登录显示
2.关于SHELL的测试:
2.1 查看sendmail的状态
2.2 查看HOSTNAME
2.3 查看动态获取ip 和追加的子网掩码及IP 地址
3.用startx
本文转自 gjp0731 51CTO博客,原文链接:http://blog.51cto.com/guojiping/951797