软件
cd /etc/yum.repos.d/
vim local.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://dl.fedoraproject.org/pub/epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
baseurl=http://dl.fedoraproject.org/pub/epel/6/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
baseurl=http://dl.fedoraproject.org/pub/epel/6/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
vim rhel-source.repo
[base]
name=CentOS-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
yum install dhcp -y
vim /etc/dhcp/dhcpd.confddns-update-style interim;ignore client-updates;subnet 192.168.50.0 netmask 255.255.255.0 {# --- default gateway option routers 192.168.50.2; option subnet-mask 255.255.255.0; option domain-name "dns.youshop.com"; option domain-name-servers 10.5.1.200; option time-offset -18000; # Eastern Standard Time range dynamic-bootp 192.168.50.11 192.168.50.253; default-lease-time 21600; max-lease-time 43200; filename "pxelinux.0"; next-server 192.168.50.165; }
/etc/init.d/dhcpd restart
chkconfig dhcpd on
yum install tftp -yyum install tftp-server -y
vim /etc/xinetd.d/tftpservice tftp{ socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no per_source = 11 cps = 100 2 flags = IPv4}
/etc/init.d/xinetd restartchkconfig xinetd on
yum install syslinux -ycd /usr/share/syslinux/find . -name pxelinux.0
cp pxelinux.0 /var/lib/tftpboot//etc/init.d/xinetd restart
yum install lrzsz -y
rz -e rhel-server-6.4-x86_64-dvd.iso
mount -o loop rhel-server-6.4-x86_64-dvd.iso /mnt/ll /mnt
mkdir /var/lib/tftpboot/pxelinux.cfgcd /mnt/isolinux/cp vesamenu.c32 boot.msg splash.jpg /var/lib/tftpboot/cp isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
mkdir -p /var/lib/tftpboot/vmlinuz/rhel-6.4-x86_64mkdir -p /var/lib/tftpboot/initrd/rhel-6.4-x86_64cp initrd.img /var/lib/tftpboot/initrd/rhel-6.4-x86_64/cp vmlinuz /var/lib/tftpboot/vmlinuz/rhel-6.4-x86_64/
vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 6.4!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label rhel-6.4-x86_64
menu label ^Install Rhel-6.4-x86_64
kernel vmlinuz/rhel-6.4-x86_64/vmlinuz
append initrd=initrd/rhel-6.4-x86_64/initrd.img
vim /etc/nginx/nginx.conf
yum install --nogpgcheck nginx -y
mkdir -p /data/server/install/{ks,imgs}/rhel-6.4-x86_64cp -rp /mnt/* /data/server/install/imgs/rhel-6.4-x86_64/
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
listen 80;
server_name _;
root /data/server/install;
}
}
/etc/init.d/nginx restartchkconfig nginx on
cd /data/server/install/ks/
vim rhel-6.4-x86_64.ks
# System authorization information
authconfig --enableshadow --passalgo=sha512
# System bootloader configuration
key --skip
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb rhgb quiet quiet"
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
#graphical
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
#Reboot after installation
reboot
# System language
lang en_US.UTF-8
# Installation logging level
logging --level=info
url --url=http://192.168.50.160/imgs/rhel-6.4-x86_64
network --bootproto=dhcp --device=eth0 --onboot=on
#Root password
rootpw 123
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
skipx
#xconfig --defaultdesktop=GNOME --depth=8 --resolution=640x480 --startxonboot
clearpart --none --initlabel
zerombr
part / --fstype=ext4 --size=20480 --ondisk=sda
part /usr --fstype=ext4 --size=20480 --ondisk=sda
part /var --fstype=ext4 --size=20480 --ondisk=sda
part swap --size=10240 --ondisk=sda
part /data --fstype=ext4 --size 1 --grow --ondisk=sda
#part / --fstype=ext4 --size=20480
#part /usr --fstype=ext4 --size=20480
#part /var --fstype=ext4 --size=20480
#part swap --size=10240
#part /data --fstype=ext4 --size 1 --grow
%pre
/usr/sbin/parted -s /dev/sda mklabel gpt
%packages
@additional-devel
@base
@chinese-support
@client-mgmt-tools
@console-internet
@core
@debugging
@development
@directory-client
@hardware-monitoring
@large-systems
@legacy-unix
@network-file-system-client
@network-tools
@performance
@perl-runtime
@server-platform
@server-platform-devel
@server-policy
libXinerama-devel
xorg-x11-proto-devel
startup-notification-devel
libgnomeui-devel
libbonobo-devel
libXau-devel
libgcrypt-devel
popt-devel
libXrandr-devel
libxslt-devel
libglade2-devel
gnutls-devel
mtools
pax
python-dmidecode
oddjob
sgpio
jpackage-utils
certmonger
pam_krb5
krb5-workstation
tcp_wrappers
perl-DBD-SQLite
telnet
expect
lrzsz
libaio-devel
%end
%post --nochroot
echo "* soft core unlimited" >> /mnt/sysimage/etc/security/limits.conf
echo "* hard core unlimited" >> /mnt/sysimage/etc/security/limits.conf
echo "* soft nofile 65535" >> /mnt/sysimage/etc/security/limits.conf
echo "* hard nofile 65535" >> /mnt/sysimage/etc/security/limits.conf
echo "* soft nproc 32000" >> /mnt/sysimage/etc/security/limits.conf
echo "* hard nproc 32000" >> /mnt/sysimage/etc/security/limits.conf
echo "* soft nproc 32000" > /mnt/sysimage/etc/security/limits.d/90-nproc.conf
echo "net.ipv4.tcp_fin_timeout = 5" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_keepalive_time = 300" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_syncookies = 1" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse = 1" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle = 0" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 5000 65000" >> /mnt/sysimage/etc/sysctl.conf
echo "net.core.rmem_max = 16777216" >> /mnt/sysimage/etc/sysctl.conf
echo "net.core.wmem_max = 16777216" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4096 87380 16777216" >> /mnt/sysimage/etc/sysctl.conf
echo "kernel.core_uses_pid = 0" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 4096 65536 16777216" >> /mnt/sysimage/etc/sysctl.conf
echo "*/5 * * * * /usr/sbin/ntpdate idc01-ms-ns-01 >/dev/null 2>&1" >> /mnt/sysimage/var/spool/cron/root
%post
echo "TMOUT=43200" >> /etc/profile.d/tmout.sh
echo "export TMOUT" >> /etc/profile.d/tmout.sh
echo 'export HISTTIMEFORMAT="%F %T $(whoami) "' >> /etc/profile
cat > /etc/yum.repos.d/local.repo <<eof
[Server]
name=Server
baseurl=http://10.1.15.82:8080/cobbler/ks_mirror/rhel6.5-x86_64-x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
eof
CHK_LIST=`/sbin/chkconfig --list | sed -n '1,/^$/p' | /bin/awk '$0!~/^$|3:off|crond|network|sshd|rsyslog/{print $1}'`
for i in $CHK_LIST; do
/sbin/chkconfig $i off
done
mkdir -p /usr/local/webserver
cd /tmp
groupadd -g 2012 zabbix;
useradd -s /sbin/nologin -u 2014 -g 2012 -M zabbix >& /dev/null
rpm -e mysql
rpm -Uvh http://192.168.50.160/imgs/other/bash-4.1.2-15.el6_5.2.x86_64.rpm
rpm -ivh http://192.168.50.160/imgs/other/MegaCli-8.05.71-1.noarch.rpm
wget http://192.168.50.160/imgs/other/dell-dset-lx64-3.7.0.219.bin
wget http://192.168.50.160/imgs/other/zabbix-2.2.3.tar.gz
tar -zxf zabbix-2.2.3.tar.gz -C /usr/local/webserver/
mv /usr/local/webserver/zabbix/zabbix_agentd /etc/init.d
chkconfig zabbix_agentd on
echo "zabbix_agent 10050/tcp" >>/etc/services
echo "zabbix_trap 10051/tcp" >>/etc/services
/etc/init.d/zabbix_agentd restart >&/dev/null
cat > /etc/resolv.conf <<eof
#options timeout:1
search dns.koudai.com
nameserver 10.2.1.200
nameserver 10.2.1.201
eof
rm -f /root/anaconda-ks.cfg
wget http://192.168.50.160/imgs/other/dnsmasq_install.tar.gz
tar xf dnsmasq_install.tar.gz -C /tmp
/bin/bash /tmp/dnsmasq_install.sh > /tmp/dnsmasq.log 2>&1
%end
mkdir /data/server/install/imgs/other/ && cd /data/server/install/imgs/other/ll /data/server/install/imgs/other/total 35264-rw-r--r-- 1 root root 926900 Oct 14 2014 bash-4.1.2-15.el6_5.2.x86_64.rpm-rw-r--r-- 1 root root 32376292 Dec 10 04:14 dell-dset-lx64-3.7.0.219.bin-rw-r--r-- 1 root root 406594 May 14 15:01 dnsmasq_install.tar.gz-rw-r--r-- 1 root root 1598937 May 14 15:01 MegaCli-8.05.71-1.noarch.rpm-rw-r--r-- 1 root root 786607 Feb 9 15:19 zabbix-2.2.3.tar.gz
vim /var/lib/tftpboot/pxelinux.cfg/default
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 6.4!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label rhel-6.4-x86_64
menu label ^Install Rhel-6.4-x86_64
kernel vmlinuz/rhel-6.4-x86_64/vmlinuz
append initrd=initrd/rhel-6.4-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.50.165/ks/rhel
-6.4-x86_64.ks
umount /mntrz -e rhel-server-6.5-x86_64-dvd.isomount -o loop rhel-server-6.5-x86_64-dvd.iso /mnt
cd /mnt/isolinux/mkdir /var/lib/tftpboot/initrd/rhel-6.5-x86_64/mkdir /var/lib/tftpboot/vmlinuz/rhel-6.5-x86_64/cp initrd.img /var/lib/tftpboot/initrd/rhel-6.5-x86_64/cp vmlinuz /var/lib/tftpboot/vmlinuz/rhel-6.5-x86_64/
mkdir /data/server/install/imgs/rhel-6.5-x86_64/cp -rp /mnt/* /data/server/install/imgs/rhel-6.5-x86_64/ &
vim /var/lib/tftpboot/pxelinux.cfg/default
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 6.4!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label rhel-6.4-x86_64
menu label ^Install Rhel-6.4-x86_64
kernel vmlinuz/rhel-6.4-x86_64/vmlinuz
append initrd=initrd/rhel-6.4-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.50.165/ks/rhel
-6.4-x86_64.ks
label rhel-6.5-x86_64
menu label ^Install Rhel-6.5-x86_64
kernel vmlinuz/rhel-6.5-x86_64/vmlinuz
append initrd=initrd/rhel-6.5-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://192.168.50.165/ks/rhel
-6.5-x86_64.ks
###修改ks配置文件
vim /data/server/install/ks/rhel-6.5-x86_64.ks
# System authorization information
authconfig --enableshadow --passalgo=sha512
# System bootloader configuration
key --skip
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb rhgb quiet quiet"
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
#graphical
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
#Reboot after installation
reboot
# System language
lang en_US.UTF-8
# Installation logging level
logging --level=info
url --url=http://192.168.50.160/imgs/rhel-6.5-x86_64
network --bootproto=dhcp --device=eth0 --onboot=on
#Root password
rootpw 123
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
skipx
#xconfig --defaultdesktop=GNOME --depth=8 --resolution=640x480 --startxonboot
clearpart --none --initlabel
zerombr
part / --fstype=ext4 --size=20480 --ondisk=sda
part /usr --fstype=ext4 --size=20480 --ondisk=sda
part /var --fstype=ext4 --size=20480 --ondisk=sda
part swap --size=10240 --ondisk=sda
part /data --fstype=ext4 --size 1 --grow --ondisk=sda
#part / --fstype=ext4 --size=20480
#part /usr --fstype=ext4 --size=20480
#part /var --fstype=ext4 --size=20480
#part swap --size=10240
#part /data --fstype=ext4 --size 1 --grow
%pre
/usr/sbin/parted -s /dev/sda mklabel gpt
%packages
@additional-devel
@base
@chinese-support
@client-mgmt-tools
@console-internet
@core
@debugging
@development
@directory-client
@hardware-monitoring
@large-systems
@legacy-unix
@network-file-system-client
@network-tools
@performance
@perl-runtime
@server-platform
@server-platform-devel
@server-policy
libXinerama-devel
xorg-x11-proto-devel
startup-notification-devel
libgnomeui-devel
libbonobo-devel
libXau-devel
libgcrypt-devel
popt-devel
libXrandr-devel
libxslt-devel
libglade2-devel
gnutls-devel
mtools
pax
python-dmidecode
oddjob
sgpio
jpackage-utils
certmonger
pam_krb5
krb5-workstation
tcp_wrappers
perl-DBD-SQLite
telnet
expect
lrzsz
libaio-devel
%end
%post --nochroot
echo "* soft core unlimited" >> /mnt/sysimage/etc/security/limits.conf
echo "* hard core unlimited" >> /mnt/sysimage/etc/security/limits.conf
echo "* soft nofile 65535" >> /mnt/sysimage/etc/security/limits.conf
echo "* hard nofile 65535" >> /mnt/sysimage/etc/security/limits.conf
echo "* soft nproc 32000" >> /mnt/sysimage/etc/security/limits.conf
echo "* hard nproc 32000" >> /mnt/sysimage/etc/security/limits.conf
echo "* soft nproc 32000" > /mnt/sysimage/etc/security/limits.d/90-nproc.conf
echo "net.ipv4.tcp_fin_timeout = 5" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_keepalive_time = 300" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_syncookies = 1" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse = 1" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle = 0" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 5000 65000" >> /mnt/sysimage/etc/sysctl.conf
echo "net.core.rmem_max = 16777216" >> /mnt/sysimage/etc/sysctl.conf
echo "net.core.wmem_max = 16777216" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4096 87380 16777216" >> /mnt/sysimage/etc/sysctl.conf
echo "kernel.core_uses_pid = 0" >> /mnt/sysimage/etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 4096 65536 16777216" >> /mnt/sysimage/etc/sysctl.conf
echo "*/5 * * * * /usr/sbin/ntpdate idc01-ms-ns-01 >/dev/null 2>&1" >> /mnt/sysimage/var/spool/cron/root
%post
echo "TMOUT=43200" >> /etc/profile.d/tmout.sh
echo "export TMOUT" >> /etc/profile.d/tmout.sh
echo 'export HISTTIMEFORMAT="%F %T $(whoami) "' >> /etc/profile
cat > /etc/yum.repos.d/local.repo <<eof
[Server]
name=Server
baseurl=http://10.1.15.82:8080/cobbler/ks_mirror/rhel6.5-x86_64-x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
eof
CHK_LIST=`/sbin/chkconfig --list | sed -n '1,/^$/p' | /bin/awk '$0!~/^$|3:off|crond|network|sshd|rsyslog/{print $1}'`
for i in $CHK_LIST; do
/sbin/chkconfig $i off
done
mkdir -p /usr/local/webserver
cd /tmp
groupadd -g 2012 zabbix;
useradd -s /sbin/nologin -u 2014 -g 2012 -M zabbix >& /dev/null
rpm -e mysql
rpm -Uvh http://192.168.50.160/imgs/other/bash-4.1.2-15.el6_5.2.x86_64.rpm
rpm -ivh http://192.168.50.160/imgs/other/MegaCli-8.05.71-1.noarch.rpm
wget http://192.168.50.160/imgs/other/dell-dset-lx64-3.7.0.219.bin
wget http://192.168.50.160/imgs/other/zabbix-2.2.3.tar.gz
tar -zxf zabbix-2.2.3.tar.gz -C /usr/local/webserver/
mv /usr/local/webserver/zabbix/zabbix_agentd /etc/init.d
chkconfig zabbix_agentd on
echo "zabbix_agent 10050/tcp" >>/etc/services
echo "zabbix_trap 10051/tcp" >>/etc/services
/etc/init.d/zabbix_agentd restart >&/dev/null
cat > /etc/resolv.conf <<eof
#options timeout:1
search dns.koudai.com
nameserver 10.2.1.200
nameserver 10.2.1.201
eof
rm -f /root/anaconda-ks.cfg
wget http://192.168.50.160/imgs/other/dnsmasq_install.tar.gz
tar xf dnsmasq_install.tar.gz -C /tmp
/bin/bash /tmp/dnsmasq_install.sh > /tmp/dnsmasq.log 2>&1
%end
/etc/init.d/xinetd restart
本文出自 “天道酬勤的空间” 博客,转载请与作者联系!