4.软件包选择,要全选上也没关系,只要你有空间,若是空间有限有话,不妨定制一下软件包,下面是我的选择,仅供参考:
Printing Support
Network Support
Dialup Support
SMB:windows file server
WWW:web server
DNSNS name server
Software Development
1]配置/etc/named.conf文件。此文件是dns引导文件,named进程在启动时要读取它。
vi /etc/named.conf
// generated by named-bootconf.pl
options {
directory "/var/named";
// query-source address * port 53;
};
zone "." IN {
type hint;
file "named.ca";
};
//----------------------手工添加如下两节------------------------------
zone "cx.com" IN {
type master;
file "named.hosts";
};
zone "10.10.in-addr.arpa" IN {
type master;
file "named.10.10";
};
//------------------------------------------------------------------------------
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
// include "/etc/rndc.key";
以下的三个文件是DNS数据库文件,具体参数不作详解,请参考相关资料。
2]vi /var/named/named.local
$TTL 86400
@ IN SOA ns.cx.com. root.ns.cx.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS ns.cx.com.
1 IN PTR localhost.
3]vi /var/named/named.hosts
@ IN SOA ns.cx.com. root.ns.cx.com. (
2002042302; serial
28800; refresh
14400; retry
3600000; expire
86400; minimu
)
IN NS ns.cx.com.
cx IN A 10.10.1.1
cx1 IN A 10.10.1.223
www IN CNAME ns.cx.com.
ftp IN CNAME cx
4]vi /var/named/named.10.10
@ IN SOA ns.cx.com. root.ns.cx.com. (
2002042302; serial
28800; refresh
14400; retry
3600000; expire
86400; minimu
)
IN NS ns.cx.com.
1 IN PTR ns.cx.com.
2 IN PTR ns1.cx.com.
5]编辑/etc/resolv.conf文件
vi /etc/resolv.conf
domain cx.com
nameserver 10.10.1.1
好,让我们来启动服务吧:
/etc/rc.d/init.d/named start
chkconfig –level 3 named on #将dns服务设置成系统服务,开机自启动
测试:ping cx.cx.com
ping www.cx.com
ping ftp.cx.com
或用nslookup,用法请参考nslookup –help。
五、 DHCP服务器配置
1]安装dhcp。
放入光盘1或是光盘2
mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom/RedHat/RPMS
rpm –ivh dhcp-2.0p15-8.i386.rpm
请用setup/system services或是chkconfig –levlel 3 linuxconf on将linuxconf设置为系统自启动服务。
2]安装软件:
tar zxvf rp-pppoe-3.5.tar.gz
cd rp-pppoe-3.5
./go #开始安装软件
3]软件安装好后,会运行设置程序adsl-setup
USER NAME
>>> Enter your PPPoE user name (XXX):________ #此处填写ADSL用户帐号
INTERFACE
(default eth0):_____ #以太接口,eth0或者eth1
>>> Enter the demand value (default no): #可以不填
DNS
>>> Enter the DNS information here: 202.96.134.133 #本地电信提供的主域名服务器
>>> Enter the secondary DNS server address here: #本地电信提供的辅助域名服务器
PASSWORD
>>> Please enter your PPPoE password:
>>> Please re-enter your PPPoE password: #密码
FIREWALLING
0 - NONE: This script will not set any firewall rules. You are responsible
for ensuring the security of your machine. You are STRONGLY
recommended to use some kind of firewall rules.
1 - STANDALONE: Appropriate for a basic stand-alone web-surfing workstation
2 - MASQUERADE: Appropriate for a machine acting as an Internet gateway
for a LAN
>>> Choose a type of firewall (0-2): 0
防火墙设置,选择2可使主机设成局域网的internet网关,将客户机网关设为本机IP,DNS设为电信提供的DNS服务器IP即可上网了,它是由ipchains之ip伪装实现的,而rh7.2中的ipchains已经没有了ip_masq_ftp模块,所以客户机无法使用FTP服务,因此我们在这里不用防火墙,选择0。在rh72中已经有了iptables,它是ipchains的替代品,功能也更为强大了,呆会儿我们写一个脚本,用它来实现ADSL共享。
>>> Accept these settings and adjust configuration files (y/n)? y #保存设置
3]在/etc/rc.d/rc.local文件尾部加入quota启动脚本:
if [ -x /sbin/quotacheck ]
then
echo "Checking quotas. This may take some time..."
/sbin/quotacheck -avug
echo "Done"
fi
if [ -x /sbin/quotaon ]
then
echo "Turning on quota"
/sbin/quotaon -avug
echo "OK"
fi
7]再重启,注意观察,不会再出错了。进入系统后就可以对用户home目录进行限制了。比如现在有一个test用户,我们对他进行限制:
edquota –u test #此命令将进入一个vi编辑模式,其内容如下:
Filesystem blocks soft hard inodes soft hard
/dev/hda3 0 0 0 0 0 0
注解标识: A B C D E F
在讲解各参数之前先说说限制的两种方式:soft,hard
soft:又称软限制,当用户到达这个限制以后,系统会给予警告,但仍可写入。
hard:又称硬限制,到达这个限制,就完全禁止任何写入啦。
ABC为磁盘空间的限制设置,而DEF为总文件个数的限制
A:已使用空间,无需要设置
B:用户空间使用限制,为软限制,需要设置。
C:用户空间使用限制,为硬限制,需要设置。
D:已有文件总数,无需要设置。
E:文件总数限制,为软限制,需要设置。
F:文件总数限制,为硬限制,需要设置。
我们要限制test用户使用空间100M,最多不能超过120M,文件总数为2000个,
最多不能超过2500个,设置如下:
Filesystem blocks soft hard inodes soft hard
/dev/hda3 0 102400 122880 0 2000 2500
注:空间限制是以k为单位的。
ftp://ftp.openbsd.org/pub/OpenBS ... penssh-3.4p1.tar.gz
3]安装软件:
tar zxvf openssh-3.4p1.tar.gz
cd openssh-3.41
./configure --prefix=/usr/local/ssh \
--sysconfdir=/etc/ssh \
--with-tcp-wrappers \
--with-ipv4-default \
--with-md5-passwords
make
make install
注:安装完成以后,会自动生成主机密钥,还会提示需要sshd用户帐号,可用useradd加一个sshd用户。
install /contrib/redhat/sshd.pam /etc/pam.d/sshd
cp contrib/redhat/sshd.init /etc/rc.d/init.d/sshd
chkconfig --level 3 sshd on ;配置成系统服务
4]配置openssh之/etc/ssh/ssh_config文件
vi /etc/ssh/ssh_config
Host *
ForwardAgent no
ForwardX11 no
RhostsAuthentication no
RhostsRSAAuthentication no
RSAAuthentication yes
PasswordAuthentication yes
BatchMode no
CheckHostIP yes
StrictHostKeyChecking ask
IdentityFile ~/.ssh/identity
Port 22
Cipher 3des
EscapeChar ~
5]配置openssh之/etc/ssh/sshd_config文件
vi /etc/ssh/sshd_config
Port 22
ListenAddress 0.0.0.0
ListenAddress ::
HostKey /etc/ssh/ssh_host_key
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
KeyRegenerationInterval 3600
ServerKeyBits 768
SyslogFacility AUTH
LogLevel INFO
LoginGraceTime 600
#PermitRootLogin yes #还是不要让root直接登录为妙!
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
RhostsAuthentication no
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
IgnoreUserKnownHosts no
PasswordAuthentication yes
PermitEmptyPasswords no
Subsystem sftp /usr/local/ssh/libexec/sftp-server
6]配置用户的加密密钥
useradd test
passwd test
su test
ssh-keygen -d
出现提示请回车并输入passwd,再次输入passwd。
注:这个密码是系统加密运算时用到的,登录时还用原来密码。