全国服务热线:4008-888-888

公司新闻

免费手机网页制作

免费手机网页制作:网站服务器集群构建之:系统安装篇

摘要:本文章主要讲解大型网站构建,全部采用开源软件和开源的操作系统,构架采用 LAMP (Linux+Apache+Mysql+Php)模式实现。 系统安装。
1、服务器系统采用CentOS5.1_X86_64,之所以采用64位系统是因为,在32为系统中内存大于3.2G的时候要使用内核的PAE模式,这样在大内存的时候就需要内核经常变动地址位来保证内存的访问与使用,这样对服务器的性能肯定会有影响,所以采用64为系统。
2、安装最好采用kickstart,保证系统安装的一致性有利于维护和排错。
3、创建安装服务器。
第一步,建立kickstart安装文件:可以用linux自带的system-config-kickstart来创建也可以手工编辑,这里给出我的kickstart文件。
ks.cfg

#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
# Installation logging level
logging --level=info
# Use network installation
url --url=ftp://192.168.0.240/setup/centos5.1x86_64
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on --hostname=web.800hr.com
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$VVFNki27$xxgyze1ry.iNwEURMjA6F.
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# Disk partitioning information
part /boot --asprimary --bytes-per-inode=4096 --fstype= ext3 --size=256
part / --asprimary --bytes-per-inode=4096 --fstype= ext3 --size=10240
part /usr --asprimary --bytes-per-inode=4096 --fstype= ext3 --size=20480
part /tmp --bytes-per-inode=4096 --fstype= ext3 --size=4096
part /var --bytes-per-inode=4096 --fstype= ext3 --grow --size=1
%pre
%post
#!/bin/sh
i386file=
alsa-lib-1.0.14-1.rc4.el5.i386
apr-1.2.7-11.i386
apr-util-1.2.7-6.i386
aspell-0.60.3-7.1.i386
audiofile-0.2.6-5.i386
audit-libs-1.5.5-7.el5.i386
beecrypt-4.1.2-10.1.1.i386
boost-1.33.1-10.el5.i386
boost-devel-1.33.1-10.el5.i386
coolkey-1.1.0-5.el5.i386
coolkey-devel-1.1.0-5.el5.i386
cracklib-2.8.9-3.3.i386
cryptsetup-luks-1.0.3-2.2.el5.i386
curl-7.15.5-2.el5.i386
curl-devel-7.15.5-2.el5.i386
cyrus-sasl-devel-2.1.22-4.i386
cyrus-sasl-lib-2.1.22-4.i386
cyrus-sasl-plain-2.1.22-4.i386
db4-4.3.29-9.fc6.i386
db4-devel-4.3.29-9.fc6.i386
dbus-1.0.0-6.el5.i386
dbus-devel-1.0.0-6.el5.i386
device-mapper-1.02.20-1.el5.i386
e2fsprogs-libs-1.39-10.el5.i386
elfutils-libelf-0.125-3.el5.i386
esound-0.2.36-3.i386
expat-1.95.8-8.2.1.i386
expat-devel-1.95.8-8.2.1.i386
fontconfig-2.4.1-6.el5.i386
freetype-2.2.1-19.el5.i386
freetype-devel-2.2.1-19.el5.i386
gd-2.0.33-9.3.fc6.i386
gdbm-1.8.0-26.2.1.i386
gdbm-devel-1.8.0-26.2.1.i386
gd-devel-2.0.33-9.3.fc6.i386
gettext-0.14.6-4.el5.i386
gmp-4.1.4-10.el5.i386
gmp-devel-4.1.4-10.el5.i386
gpm-1.20.1-74.1.i386
gpm-devel-1.20.1-74.1.i386
hesiod-3.1.0-8.i386
hesiod-devel-3.1.0-8.i386
krb5-devel-1.6.1-17.el5.i386
krb5-libs-1.6.1-17.el5.i386
kudzu-devel-1.2.57.1.15-1.el5.centos.i386
lcms-1.15-1.2.2.i386
libacl-2.2.39-2.1.el5.i386
libacl-devel-2.2.39-2.1.el5.i386
libaio-0.3.106-3.2.i386
libattr-2.4.32-1.1.i386
libattr-devel-2.4.32-1.1.i386
libcap-1.10-26.i386
libcap-devel-1.10-26.i386
libdrm-2.0.2-1.1.i386
libdrm-devel-2.0.2-1.1.i386
libfontenc-1.0.2-2.2.el5.i386
libgcrypt-1.2.3-1.i386
libgpg-error-1.4-2.i386
libICE-1.0.1-2.1.i386
libICE-devel-1.0.1-2.1.i386
libicu-3.6-5.11.i386
libidn-0.6.5-1.1.i386
libjpeg-6b-37.i386
libjpeg-devel-6b-37.i386
libmng-1.0.9-5.1.i386
libmng-devel-1.0.9-5.1.i386
libogg-1.1.3-3.el5.i386
libogg-devel-1.1.3-3.el5.i386
libpng-1.2.10-7.0.2.i386
libpng-devel-1.2.10-7.0.2.i386
libselinux-1.33.4-4.el5.i386
libselinux-devel-1.33.4-4.el5.i386
libsepol-1.15.2-1.el5.i386
libSM-1.0.1-3.1.i386
libSM-devel-1.0.1-3.1.i386
libtermcap-2.0.8-46.1.i386
libtermcap-devel-2.0.8-46.1.i386
libtiff-3.8.2-7.el5.i386
libtiff-devel-3.8.2-7.el5.i386
libuser-0.54.7-2.el5.2.i386
libuser-devel-0.54.7-2.el5.2.i386
libutempter-1.1.4-3.fc6.i386
libvorbis-1.1.2-3.el5.0.i386
libvorbis-devel-1.1.2-3.el5.0.i386
libX11-1.0.3-8.0.1.el5.i386
libX11-devel-1.0.3-8.0.1.el5.i386
libXau-1.0.1-3.1.i386
libXau-devel-1.0.1-3.1.i386
libXaw-1.0.2-8.1.i386
libXaw-devel-1.0.2-8.1.i386
libXcomposite-0.3-5.1.i386
libXcomposite-devel-0.3-5.1.i386
libXcursor-1.1.7-1.1.i386
libXcursor-devel-1.1.7-1.1.i386
libXdamage-1.0.3-2.1.i386
libXdamage-devel-1.0.3-2.1.i386
libXdmcp-1.0.1-2.1.i386
libXdmcp-devel-1.0.1-2.1.i386
libXevie-1.0.1-3.1.i386
libXevie-devel-1.0.1-3.1.i386
libXext-1.0.1-2.1.i386
libXext-devel-1.0.1-2.1.i386
libXfixes-4.0.1-2.1.i386
libXfixes-devel-4.0.1-2.1.i386
libXfont-1.2.2-1.0.2.el5.i386
libXfontcache-1.0.2-3.1.i386
libXfontcache-devel-1.0.2-3.1.i386
libXfont-devel-1.2.2-1.0.2.el5.i386
libXft-2.1.10-1.1.i386
libXft-devel-2.1.10-1.1.i386
libXi-1.0.1-3.1.i386
libxml2-2.6.26-2.1.2.i386
libxml2-devel-2.6.26-2.1.2.i386
libXmu-1.0.2-5.i386
libXmu-devel-1.0.2-5.i386
libXpm-3.5.5-3.i386
libXrandr-1.1.1-3.1.i386
libXrandr-devel-1.1.1-3.1.i386
libXrender-0.9.1-3.1.i386
libXrender-devel-0.9.1-3.1.i386
libXres-1.0.1-3.1.i386
libXres-devel-1.0.1-3.1.i386
libXScrnSaver-1.1.0-3.1.i386
libXScrnSaver-devel-1.1.0-3.1.i386
libxslt-1.1.17-2.i386
libXt-1.0.2-3.1.fc6.i386
libXt-devel-1.0.2-3.1.fc6.i386
libXTrap-1.0.0-3.1.i386
libXTrap-devel-1.0.0-3.1.i386
libXtst-1.0.1-3.1.i386
libXtst-devel-1.0.1-3.1.i386
libXv-1.0.1-4.1.i386
libXvMC-1.0.2-2.1.i386
libXvMC-devel-1.0.2-2.1.i386
libXxf86dga-1.0.1-3.1.i386
libXxf86dga-devel-1.0.1-3.1.i386
libXxf86misc-1.0.1-3.1.i386
libXxf86misc-devel-1.0.1-3.1.i386
libXxf86vm-1.0.1-3.1.i386
libXxf86vm-devel-1.0.1-3.1.i386
lockdev-1.0.1-10.i386
lockdev-devel-1.0.1-10.i386
mesa-libGL-6.5.1-7.5.el5.i386
mesa-libGL-devel-6.5.1-7.5.el5.i386
mkinitrd-5.1.19.6-19.i386
ncurses-5.5-24.20060715.i386
ncurses-devel-5.5-24.20060715.i386
neon-0.25.5-5.1.i386
netpbm-10.35-6.fc6.i386
netpbm-devel-10.35-6.fc6.i386
net-snmp-libs-5.3.1-19.el5.i386
newt-0.52.2-9.i386
newt-devel-0.52.2-9.i386
nspr-4.6.5-3.el5.i386
nss-3.11.7-1.3.el5.centos.i386
nss_db-2.2-35.1.i386
nss_ldap-253-5.el5.i386
numactl-0.9.8-2.el5.i386
openldap-2.3.27-8.i386
openldap-devel-2.3.27-8.i386
openssl-0.9.8b-8.3.el5_0.2.i686
openssl-devel-0.9.8b-8.3.el5_0.2.i386
pam-0.99.6.2-3.26.el5.i386
pam_ccreds-3-5.i386
pam-devel-0.99.6.2-3.26.el5.i386
pam_krb5-2.2.14-1.i386
pam_passwdqc-1.0.2-1.2.2.i386
pam_pkcs11-0.5.3-23.i386
pam_smb-1.1.7-7.2.1.i386
parted-1.8.1-12.el5.i386
pciutils-devel-2.2.3-4.i386
pcsc-lite-devel-1.3.1-7.i386
pcsc-lite-libs-1.3.1-7.i386
popt-1.10.2-47.el5.i386
postgresql-libs-8.1.9-1.el5.i386
python-devel-2.4.3-19.el5.i386
readline-5.1-1.1.i386
readline-devel-5.1-1.1.i386
rpm-devel-4.4.2-47.el5.i386
rpm-libs-4.4.2-47.el5.i386
SDL-1.2.10-8.el5.i386
SDL-devel-1.2.10-8.el5.i386
slang-2.0.6-4.el5.i386
slang-devel-2.0.6-4.el5.i386
sqlite-3.3.6-2.i386
subversion-1.4.2-2.el5.i386
tcp_wrappers-7.6-40.4.el5.i386
valgrind-3.2.1-6.el5.i386
Xaw3d-1.5E-10.1.i386
Xaw3d-devel-1.5E-10.1.i386
xdelta-1.1.3-20.i386
xmlsec1-1.2.9-8.1.i386
xmlsec1-devel-1.2.9-8.1.i386
xorg-x11-xtrans-devel-1.0.1-1.1.fc6.i386
service1=
acpid
anacron
arptables_jf
atd
auditd
autofs
cpuspeed
crond
gpm
kudzu
haldaemon
iptables
irqbalance
messagebus
microcode_ctl
netfs
network
readahead_early
readahead_later
restorecond
sshd
syslog
sysstat
xinetd
service2=
amd
arpwatch
avahi-daemon
avahi-dnsconfd
conman
dhcdbd
ip6tables
ipmi
irda
iscsi
iscsid
kdump
lm_sensors
mcstrans
mdmonitor
mdmpd
named
netplugd
NetworkManager
NetworkManagerDispatcher
nfs
nfslock
nscd
ntpd
oddjobd
pcscd
portmap
postfix
psacct
rdisc
rpcgssd
rpcidmapd
rpcsvcgssd
saslauthd
smartd
smb
snmpd
snmptrapd
vsftpd
winbind
wpa_supplicant
xfs
ypbind
yum-updatesd
rpm --import ftp://192.168.0.240/setup/centos5.1x86_64/RPM-GPG-KEY-CentOS-5
rpm -i ftp://192.168.0.240/setup/centos5.1x86_64/CentOS/ntp-4.2.2p1-7.el5.x86_64.rpm
rpm -i ftp://192.168.0.240/setup/centos5.1x86_64/CentOS/dialog-1.0.20051107-1.2.2.x86_64.rpm
rpm -i ftp://192.168.0.240/setup/centos5.1x86_64/CentOS/giflib-4.1.3-7.1.el5.1.x86_64.rpm
rpm -i ftp://192.168.0.240/setup/centos5.1x86_64/CentOS/giflib-devel-4.1.3-7.1.el5.1.x86_64.rpm
rpm -i ftp://192.168.0.240/setup/centos5.1x86_64/CentOS/giflib-utils-4.1.3-7.1.el5.1.x86_64.rpm
for I in $i386file
do
rpm -e --nodeps $I
done
for I in $service1
do
chkconfig --level 3 $I on
done
for I in $service2
do
chkconfig --level 3 $I off
done
: /etc/issue.net
: /etc/issue
ntpdate 192.168.0.209 clock -w
cat /etc/sysconfig/network EOF
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=web.800hr.com
EOF
cat /etc/hosts EOF
# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost web web.800hr.com
EOF
cat /etc/sysconfig/static-routes EOF
any net 192.168.254.0 netmask 255.255.255.0 gw 192.168.0.253
EOF
cat /etc/cron.daily/ntptime EOF
#!/bin/sh

PATH=\$PATH:/sbin:/usr/sbin
ntpdate 192.168.0.209 clock -w
EOF
chmod 755 /etc/cron.daily/ntptime
cat /etc/sysconfig/i18n EOF
LANG= zh_CN
SYSFONT= latarcyrheb-sun16
EOF
cat /etc/modprobe.conf EOF
alias net-pf-10 off
alias ipv6 off
EOF
cat /etc/rc.d/my-shell.sh EOF
#!/bin/sh

export PATH=\$PATH
INITTY=/dev/tty[1-8]
for tty in \$INITTY; do
setleds -L -D +num \$tty
done
EOF
echo /etc/rc.d/my-shell.sh /etc/rc.d/rc.local
chmod 755 /etc/rc.d/my-shell.sh
%packages
@core
kernel
system-config-securitylevel-tui
@base
@dialup
@system-tools
@text-internet
@editors
@ftp-server
@smb-server
@dns-server
@mail-server
@legacy-network-server
@legacy-software-support
@development-tools
@development-libs
@legacy-software-development
@x-software-development
@chinese-support
aide
-bluez-utils
bridge-utils
convmv
keyutils
keyutils-libs
unifdef
-firstboot-tui
-redhat-lsb
-cups
-ibmasm
iscsi-initiator-utils
kexec-tools
-sendmail
-logwatch
-mailx
star
x86info
-wireless-tools
nasm
-isdn4k-utils
statserial
-rusers
-rwho
telnet-server
-cyrus-sasl
-dovecot
postfix
-sendmail
-sendmail-cf
-spamassassin
am-utils
arptables_jf
arpwatch
audit
avahi-tools
-bluez-hcidump
-bluez-gnome
gnutls-utils
iptraf
lslk
lsscsi
net-snmp-utils
nmap-frontend
sysstat
uucp
-cadaver
-fetchmail
lynx
-slrn


接下来我们创建一个用于安装的数据源,我们下载CentOS5.1 的DVD文件。
mount -t iso9660 -r -o loop CentOS5.1xxxx.iso /mnt/cdrom
cp -a /mnt/cdrom /var/ftp/setup
这样只要在配置一个ftp或http、nfs之类的服务,让这能远程访问就可以了。然后配置一个apache,默认安装就可以,拷贝我们刚才创建的ks.cfg文件到他的htdocs下面。数据源这里就是用ftp吧,不会配置没关系,放到默认的路径下就可以了 /var/ftp
现在我们应该可以通过光盘引导,然后输入命令来使用网络自动安装了。
linux ks=http://server_ip/ks.cfg
下一步是添加安装服务器对pxe的支持。
1、创建dhcp服务器,并测试可以分配ip地址。
2、dhcpd.conf配置文件中几个关键部分说明如下:host q10{ }定义了笔记本Q10网卡的MAC地址与IP地址的对应关系,表明DHCP Server为Q10分配一个固定的IP:192.168.0.22;filename 指定bootstrap的文件名;netx-server指定TFTP Server的地址。其它的配置请读者参考DHCP Server的手册。
dhcpd.conf


#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.252.0 {
# --- default gateway
option routers 192.168.0.253;
option subnet-mask 255.255.252.0;
option nis-domain 800hr.co ;
option domain-name 800hr.co ;
option domain-name-servers 192.168.0.160;
# option time-offset -18000; # Eastern Standard Time
option ntp-servers 192.168.0.209;
range dynamic-bootp 192.168.1.250 192.168.3.254;
default-lease-time 21600;
max-lease-time 43200;
filename /setup/pxelinux.0 ;
next-server 192.168.0.240;

} #END


  创建tftp服务器。添加可引导内核。
1、在启动tftpd的时候要使用-s 指定一个虚拟的根目录。
tftp主要修改两处就可以,这里就不给出配置文件了。
/etc/xinetd.d/tftpd 中的
server_args = -u username -s /tftpboot
disable = no
2、拷贝光盘上pxeboot下面的文件到所刚才所指定的虚拟根目录里面去。
3、拷贝/usr/lib/syslinux/pxelinux.0  pexlinux.0到虚拟根目录下。
4、配置引导文件 在虚拟根目录的 pxelinux.cfg/default文件。
default

default linux ks=http://192.168.0.240/ks.cfg
prompt 1
timeout 30
label linux
kernel vmlinuz
append initrd=initrd.img


  启动tftp,dhcp,httpd,ftp服务,这会你已经可以按F12直接安装系统了。怎么样现在估计你应该1小时安装50台机器的系统应该没什么问题了,现在系统已经安装完成了,而且已经关闭了不必要的服务,剩下的就是根据需要安装相应的软件并配置服务了。
这里说明一个技巧,在这里你的default配置的是安装的,等你的集群装好了,那天不小心又按到了F12咋办,那不是很麻烦吗,你可以把default文件的第一行改成
default linux rescue ks=http://192.168.0.240/ks.cfg
这样以后就不会重新安装了,而会进入修复模式,看看维护是不是也很方便。



在线客服

关闭

客户服务热线
4008-888-888


点击这里给我发消息 在线客服

点击这里给我发消息 在线客服