歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux綜合 >> Linux資訊 >> Linux文化

Red hat 6 配置實例



以下是我使用Red hat 6.0的一些筆記,與大家分享。

使用APACHE提供虛擬主機WEB SERVER
-------------------------------------
1. 先把主機配置為多主址, 在X下運行linuxconf命令:
在Server欄下配置virtual host, 選定網卡eth0, 配置其IP和MASK.
原始IP:192.168.0.241
掩碼 :255.255.255.0

Virtual host IP Mask
------------------------------------------
192.168.0.242 255.255.255.0
192.168.0.243 255.255.255.0
192.168.0.244 255.255.255.0
192.168.0.245 255.255.255.0
192.168.0.246 255.255.255.0


2. 編輯/etc/httpd/conf/httpd.conf文件, 在最後加入:


DocumentRoot /home/httpd/html/241/Hardware.AIX
ServerName bbs1.ttsc.hl.cn


DocumentRoot /home/httpd/html/242/Networking.AIX
ServerName bbs2.ttsc.hl.cn


DocumentRoot /home/httpd/html/243/Security.AIX
ServerName bbs3.ttsc.hl.cn


DocumentRoot /home/httpd/html/244/Unix.AIX
ServerName bbs4.ttsc.hl.cn


DocumentRoot /home/httpd/html/245/WinNT.AIX
ServerName bbs5.ttsc.hl.cn


DocumentRoot /home/httpd/html/246/XWindow.AIX
ServerName bbs6.ttsc.hl.cn

3. 建立目錄, 拷入WEB文檔.

mkdir /home/httpd/html/241/Hardware.AIX
mkdir /home/httpd/html/242/Networking.AIX
mkdir /home/httpd/html/243/Security.AIX
mkdir /home/httpd/html/244/Unix.AIX
mkdir /home/httpd/html/245/WinNT.AIX
mkdir /home/httpd/html/246/XWindow.AIX

4. 重新啟動httpd服務.
/usr/sbin/httpd stop
/usr/sbin/httpd start

5. OK, 現在可以在其他機器上訪問
http://192.168.0.241/
http://192.168.0.242/
http://192.168.0.243/
http://192.168.0.244/
http://192.168.0.245/
http://192.168.0.246/

================================================================

在REDHAT6.0上配置DHCP服務
=====================================

條件:
---------
子網掩碼: 255.255.255.0
租借地址: 192.168.0.181 ~ 192.168.0.190
192.168.0.201 ~ 192.168.0.220
固定IP: 192.168.0.188 ~ 08:00:2b:4c:59:23
缺省網關: 192.168.0.254
DNS地址: 202.97.227.93, 192.168.0.241


建立步驟如下:
=================


安裝DHCPD服務程序:
-------------------------
可以到下面的網址取得

ftp://ftp.isc.org/isc/dhcp/

在你下載之後,你必須將它解開。然後進入解開的目錄,輸入:

./configure

要做好安裝前設定,可能要會花點時間。後隨輸入:

make

以及

make install


校驗核心:
---------------
請輸入 ifconfig -a,你將看到如下的訊息:

--------------------------------------------------------------------------------

eth0 Link encap:10Mbps Ethernet HWaddr 00:C0:4F:D3:C4:62
inet addr:183.217.19.43 Bcast:183.217.19.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2875542 errors:0 dropped:0 overruns:0
TX packets:218647 errors:0 dropped:0 overruns:0
Interrupt:11 Base address:0x210

--------------------------------------------------------------------------------

如果未顯示 MULTICAST 的訊息,你應該重新設定你的核心,加入對“多址傳播(multicast)” 的支援。
對於大多數的系統而言,你幾乎都不必如此做。


需要加入動態路由:
---------------------
輸入:

route add -host 255.255.255.255 dev eth0

如果你看到如下的訊息

"255.255.255.255: Unknown host"

你應該將下面的資訊加入到 /etc/hosts 檔案中:

255.255.255.255 all-ones

然後,輸入:

route add -host all-ones dev eth0

route add -net 255.255.255.0 dev eth0

eth0 應該是你目前使用網路卡的裝置名稱。如果不是,你得配合實際情況做正確的修改。


需要配置文件:
----------------------
/etc/dhcpd.conf
/etc/dhcpd.leases 初次配置只需建立文件名(內部為空), 當有客戶租用時
系統自動寫入租用記錄;


調試命令:
-----------------------------
/usr/sbin/dhcpd 停止DHCP服務;
/usr/sbin/dhcpd 啟動DHCP服務;
/usr/sbin/dhcpd -d -f 啟動並放到前台調試;

在/etc下配置dhcpd.conf文件如下:
-----------------------------------------------------------------------
[root@lee2 /etc]# more dhcpd.conf
default-lease-time 6000;
max-lease-time 72000;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.254;
option domain-name-servers 202.97.227.93, 192.168.0.241;
option domain-name "ttsc.hl.cn";

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.181 192.168.0.190;
range 192.168.0.201 192.168.0.220;
}

#fix ip
host haagen {
hardware ethernet 08:00:2b:4c:59:23;
fixed-address 192.168.0.188;
}
-----------------------------------------------------------------------====================================================================


在REDHAT6.0上配置DNS服務
=========================

條件:
-----------------
服務器: lee2.ttsc.hl.cn 192.168.0.241 OS: Redhat6.0
網段: 192.168.0
域名: ttsc.hl.cn
郵件服務器: lee2.ttsc.hl.cn
ftp服務器: xiu.ttsc.hl.cn
www服務器: lee2.ttsc.hl.cn
主機: xiu 192.168.0.155
lee 192.168.0.170
zq 192.168.0.128
lee2 192.168.0.241
madi 192.168.0.108

需配置文件:
---------------------
/etc/named.boot
/etc/named.conf
/var/named/db.ttsc
/var/named/db.192.168.0

缺省文件(不需修改):
-----------------------
/var/named/named.ca
/var/named/named.local

若服務器自身也使用自己做解析,則配置文件:
------------------------------------------
/etc/resolv.conf

調試命令:
--------------------
/usr/sbin/ndc start 啟動DNS服務;
/usr/sbin/ndc stop 停止DNS服務;
/usr/sbin/ndc reload 刷新數據庫數據;


配置文件清單:
------------------------------------------------------------------------------------------------
[root@lee2 /etc]# more named.boot
;
; a caching only nameserver config
;
directory /var/named
cache . named.ca
primary 0.0.127.in-addr.arpa named.local
primary ttsc.hl.cn db.ttsc
primary 0.168.192.in-addr.arpa db.192.168.0
------------------------------------------------------------------------------------------------
[root@lee2 /etc]# more named.conf
options {
directory "/var/named";
};
zone "." {
type hint;
file "named.ca";
};
zone "0.0.127.in-addr.arpa"{
type master;
file "named.local";
};
zone "0.168.192.in-addr.arpa"{
type master;
file "db.192.168.0";
};
zone "ttsc.hl.cn"{
type master;
file "db.ttsc";
};
------------------------------------------------------------------------------------------------
[root@lee2 named]# more named.local
@ IN SOA localhost. root.localhost. (
1997022700 ; serial
28800 ; refresh
14400 ; retry
3600000 ; expire
86400 ; default_ttl
)
@ IN NS localhost.
1 IN PTR localhost.
------------------------------------------------------------------------------------------------
[root@lee2 named]# more db.ttsc
@ IN SOA lee2.ttsc.hl.cn. root.lee2.ttsc.hl.cn. (
2000082014; serial
28800 ; refresh
14400 ; retry
3600000 ; expire
86400 ; default_ttl
)
NS lee2.ttsc.hl.cn.
MX 10 lee2.ttsc.hl.cn.

localhost A 127.0.0.1
lee2 A 192.168.0.241
lee A 192.168.0.170
xiu A 192.168.0.155
zq A 192.168.0.128
madi A 192.168.0.109

mail MX 10 lee2.ttsc.hl.cn.

www CNAME lee2.ttsc.hl.cn.
ftp CNAME xiu.ttsc.hl.cn.
ns CNAME lee2.ttsc.hl.cn.
-----------------------------------------------------------------------------------------------
[root@lee2 named]# more db.192.168.0
@ IN SOA lee2.ttsc.hl.cn. root.lee2.ttsc.hl.cn. (
2000082014; serial
28800 ; refresh
14400 ; retry
3600000 ; expire
86400 ; default_ttl
)
NS lee2.ttsc.hl.cn.

241 IN PTR lee2.ttsc.hl.cn.
170 IN PTR lee.ttsc.hl.cn.
155 IN PTR xiu.ttsc.hl.cn.
128 IN PTR zq.ttsc.hl.cn.
109 IN PTR madi.ttsc.hl.cn.
-----------------------------------------------------------------------------------------------
[root@lee2 /etc]# more resolv.conf
search ttsc.hl.cn
# nameserver 202.97.227.93
# nameserver 202.97.224.68
nameserver 192.168.0.241
-----------------------------------------------------------------------
======================================================================


在REDHAT6.0上配置Sendmail服務
=============================

條件:
-----------------
服務器: lee2.ttsc.hl.cn 192.168.0.241 OS: Redhat6.0
網段: 192.168.0
域名: ttsc.hl.cn
郵件服務器: lee2.ttsc.hl.cn
email用戶帳號:Soldier, 別名Duke
email地址:[email protected]

需建立帳號:
---------------------
使用useradd命令創建用戶的email帳號:
# usr/sbin/useradd -g mail -n soldier
# passwd soldier

需配置文件:
---------------------
/etc/sendmail.cw
/etc/aliases
/etc/mail/access
/etc/inetd.conf
/etc/services

缺省文件(不需修改):
-----------------------
/etc/sendmail.mc
/etc/sendmial.cf


應保證在DNS服務器中有郵件主機的ENTRY:
------------------------------------------
lee2.ttsc.hl.cn

調試命令:
--------------------
修改POP3的影子服務(/etc/inetd.conf)和端口(/etc/services)以後,應重新啟動inetd.

修改EMAIL帳號的別名(/etc/aliases)以後,應使用newaliases命令編譯:
# newaliases

修改郵件服務器的別名(/etc/sendmail.cw)以及其他改動以後,應重啟動sendmail服務:
# /etc/rc.d/init.d/sendmail restart


配置文件清單:
------------------------------------------------------------------------------------------------
[root@lee2 /etc]# more sendmail.cw
# sendmail.cw - include all aliases for your machine here.
#該郵件服務器的所有DNS名稱。
ttsc.hl.cn
lee2.ttsc.hl.cn

-----------------------------------------------------------------------
所有EMAIL帳號的別名:

[root@lee2 /etc]# more aliases
#
# @(#)aliases 8.2 (Berkeley) 3/5/94
#
# Aliases in this file will NOT be expanded in the header from
# Mail, but WILL be visible over networks or from /bin/mail.
#
# >>>>>>>>>> The program "newaliases" must be run after
# >> NOTE >> this file is updated for any changes to
# >>>>>>>>>> show through to sendmail.
#

# Basic system aliases -- these MUST be present.
MAILER-DAEMON: postmaster
postmaster: root

如果希望郵給[email protected]的郵件被轉發到[email protected]則加入
以下記錄,否則不加。
Soldier: [email protected]
如希望郵給[email protected]的郵件被轉發到[email protected]則加入
以下記錄,否則不加。
Duke: Soldier

# General redirections for pseudo accounts.
bin: root
daemon: root
(以下略)
-----------------------------------------------------------------------
[root@lee2 mail]# more access
# Check the /usr/doc/sendmail-8.9.3/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/doc/sendmail-8.9.3/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
localhost.localdomain RELAY
localhost RELAY
# 加入可以通過本郵件服務器收發郵件的客戶的IP:以下為允許該網段上的所有計算機。
192.168.0 RELAY
-----------------------------------------------------------------------
[root@lee2 /etc]# more inetd.conf
#
# inetd.conf This file describes the services that will be available
# through the INETD TCP/IP super server. To re-configure
# the running INETD process, edit this file, then send the
# INETD process a SIGHUP signal.
#
(中間略)
# Pop and imap mail services et al
#
#pop-2 stream tcp nowait root /usr/sbin/tcpd ipop2d
# 確定運行POP3影子服務程序:
pop-3 stream tcp nowait root /usr/sbin/tcpd ipop3d
#imap stream tcp nowait root /usr/sbin/tcpd imapd
#
# The Internet UUCP service.
#
#uucp stream tcp nowait uucp /usr/sbin/tcpd /usr/lib/uucp/uucico

-l
#
(以下略)
-----------------------------------------------------------------------
[root@lee2 /etc]# more services
# /etc/services:
# $Id: services,v 1.4 1997/05/20 19:41:21 tobias Exp $
#
# Network services, Internet style
#
(中間略)
# unfortunately the poppassd (Eudora) uses a port which has already
# been assigned to a different service. We list the poppassd as an
# alias here. This should work for programs asking for this service.
# (due to a bug in inetd the 3com-tsmux line is disabled)
#3com-tsmux 106/tcp poppassd
#3com-tsmux 106/udp poppassd
rtelnet 107/tcp # Remote Telnet
rtelnet 107/udp
pop-2 109/tcp postoffice # POP version 2
pop-2 109/udp
# 確保POP3端口開放:
pop-3 110/tcp # POP version 3
pop-3 110/udp
sunrpc 111/tcp portmapper # RPC 4.0 portmapper TCP
sunrpc 111/udp portmapper # RPC 4.0 portmapper UDP
auth 113/tcp authentication tap ident
sftp 115/tcp
uucp-path 117/tcp
(以下略)
-----------------------------------------------------------------------=======================================================================

samba
-------------------------------------

在/etc/services中,
netbios-ns 137/tcp 137/udp;
netbios-dgm 138/tcp 138/udp;
netbios-ssn 139/tcp 139/udp;

啟動相關進程:
/usr/sbin/smbd -D
/usr/sbin/nmbd -D

配置文件:
/etc/smb.conf

配置文件語法檢查:
/usr/bin/testparm smb.conf

用戶及口令文件:
/etc/smbpasswd

添加用戶和口令:
/usr/bin/smbpasswd -a username

測試自身服務:
smbclient -L localhost -U%

浏覽其他機器:
smbclient -L servername

訪問其他機器共享資源:如訪問\\wangpeng\siguo
smbclient //wangpeng/siguo

測試網絡:
nmblookup -d 2 '*'

測試WINS:
smbclient -L server -R wins


=======================================================================


Copyright © Linux教程網 All Rights Reserved