Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install CentOS automatically

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install CentOS automatically". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to install CentOS automatically.

Customized automatic installation disk

# install the required software packages:

The code is as follows:

Yum-y install createrepo mkisofs isomd5sum

# generate a simplified rpm list

The code is as follows:

Awk'/ install / {print $2} 'install.log | sed's / ^ [0-9] *: / / g' > / root/packages.list / / mine is in Chinese. See what's in log.

# constraining directory structure

The code is as follows:

Mkdir-p / mnt/cdrom

Mkdir-p / data/OS

Mount / dev/cdrom / mnt/cdrom

Rsync-a-exclude=Packages / mnt/cdrom/* / data/OS

Mkdir / data/OS/Packages

# copy the simplified rpm file to the new system directory

# there are many ways to copy to the new system directory, it is easy to use the replace command here, but the result is all the same

The code is as follows:

Cp / mnt/cdrom/Packages/libgcc-4.4.7-3.el6.x86_64

Cp / mnt/cdrom/Packages/setup-2.8.14-20.el6.noarch

Cp / mnt/cdrom/Packages/filesystem-2.4.30-3.el6.x86_64

Cp / mnt/cdrom/Packages/xml-common-0.6.3-32.el6.noarch

Cp / mnt/cdrom/Packages/cjkuni-fonts-common-0.2.20080216.1-35.el6.noarch

Cp / mnt/cdrom/Packages/iso-codes-3.16-2.el6.noarch

Cp / mnt/cdrom/Packages/basesystem-10.0-4.el6.noarch

Cp / mnt/cdrom/Packages/dmz-cursor-themes-0.4-4.el6.noarch

Cp / mnt/cdrom/Packages/libX11-common-1.5.0-4.el6.noarch

Cp / mnt/cdrom/Packages/ca-certificates-2010.63-3.el6_1.5.noarch

Cp / mnt/cdrom/Packages/ncurses-base-5.7-3.20090208.el6.x86_64

Cp / mnt/cdrom/Packages/tzdata-2012j-1.el6.noarch

Cp / mnt/cdrom/Packages/glibc-common-2.12-1.107.el6.x86_64

Cp / mnt/cdrom/Packages/nss-softokn-freebl-3.12.9-11.el6.x86_64

Cp / mnt/cdrom/Packages/glibc-2.12-1.107.el6.x86_64

Cp / mnt/cdrom/Packages/ncurses-libs-5.7-3.20090208.el6.x86_64

Cp / mnt/cdrom/Packages/bash-4.1.2-14.el6.x86_64

Cp / mnt/cdrom/Packages/libattr-2.4.44-7.el6.x86_64

Cp / mnt/cdrom/Packages/libcap-2.16-5.5.el6.x86_64

Cp / mnt/cdrom/Packages/zlib-1.2.3-29.el6.x86_64

Cp / mnt/cdrom/Packages/dbus-libs-1.2.24-7.el6_3.x86_64

Cp / mnt/cdrom/Packages/info-4.13a-8.el6.x86_64

Cp / mnt/cdrom/Packages/libxml2-2.7.6-8.el6_3.4.x86_64

:% s / ^ / cp\ / mnt\ / cdrom\ / Packages\ / g

Cp / mnt/cdrom/Packages/cjkuni-uming-fonts-0.2.20080216.1-35.el6.noarch.rpm

Cp / mnt/cdrom/Packages/cjkuni-ukai-fonts-0.2.20080216.1-35.el6.noarch.rpm

Cp / mnt/cdrom/Packages/man-pages-3.22-20.el6.noarch.rpm

Cp / mnt/cdrom/Packages/words-3.0-17.el6.noarch.rpm

Cp / mnt/cdrom/Packages/centos-indexhtml-6-1.el6.centos.noarch.rpm

Cp / mnt/cdrom/Packages/ql2400-firmware-5.08.00-1.el6.noarch.rpm

Cp / mnt/cdrom/Packages/iwl5000-firmware-8.83.5.1_1-1.el6_1.1.noarch.rpm

Cp / mnt/cdrom/Packages/ql2100-firmware-1.19.38-3.1.el6.noarch.rpm

Cp / mnt/cdrom/Packages/ivtv-firmware-20080701-20.2.noarch.rpm

Cp / mnt/cdrom/Packages/libertas-usb8388-firmware-5.110.22.p23-3.1.el6.noarch.rpm

Cp / mnt/cdrom/Packages/xorg-x11-drv-ati-firmware-6.99.99-1.el6.noarch.rpm

Cp / mnt/cdrom/Packages/ql2500-firmware-5.08.00-1.el6.noarch.rpm

Cp / mnt/cdrom/Packages/atmel-firmware-1.3-7.el6.noarch.rpm

Cp / mnt/cdrom/Packages/zd1211-firmware-1.4-4.el6.noarch.rpm

Cp / mnt/cdrom/Packages/iwl4965-firmware-228.61.2.24-2.1.el6.noarch.rpm

Cp / mnt/cdrom/Packages/rt61pci-firmware-1.2-7.el6.noarch.rpm

Cp / mnt/cdrom/Packages/iwl3945-firmware-15.32.2.9-4.el6.noarch.rpm

Cp / mnt/cdrom/Packages/ql2200-firmware-2.02.08-3.1.el6.noarch.rpm

Cp / mnt/cdrom/Packages/rt73usb-firmware-1.8-7.el6.noarch.rpm

Cp / mnt/cdrom/Packages/ipw2100-firmware-1.3-11.el6.noarch.rpm

Cp / mnt/cdrom/Packages/ql23xx-firmware-3.03.27-3.1.el6.noarch.rpm

Cp / mnt/cdrom/Packages/ipw2200-firmware-3.1-4.el6.noarch.rpm

Cp / mnt/cdrom/Packages/rootfiles-8.1-6.1.el6.noarch.rpm

:% s/$/.rpm/g

Cp / mnt/cdrom/Packages/cjkuni-uming-fonts-0.2.20080216.1-35.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/cjkuni-ukai-fonts-0.2.20080216.1-35.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/man-pages-3.22-20.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/words-3.0-17.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/centos-indexhtml-6-1.el6.centos.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/ql2400-firmware-5.08.00-1.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/iwl5000-firmware-8.83.5.1_1-1.el6_1.1.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/ql2100-firmware-1.19.38-3.1.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/ivtv-firmware-20080701-20.2.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/libertas-usb8388-firmware-5.110.22.p23-3.1.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/xorg-x11-drv-ati-firmware-6.99.99-1.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/ql2500-firmware-5.08.00-1.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/atmel-firmware-1.3-7.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/zd1211-firmware-1.4-4.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/iwl4965-firmware-228.61.2.24-2.1.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/rt61pci-firmware-1.2-7.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/iwl3945-firmware-15.32.2.9-4.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/ql2200-firmware-2.02.08-3.1.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/rt73usb-firmware-1.8-7.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/ipw2100-firmware-1.3-11.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/ql23xx-firmware-3.03.27-3.1.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/ipw2200-firmware-3.1-4.el6.noarch.rpm / data/OS/Packages

Cp / mnt/cdrom/Packages/rootfiles-8.1-6.1.el6.noarch.rpm / data/OS/Packages

:% splanchester /\ / data\ / OS\ / Packages/g

# create ks.cfg file and install all customized software packages by default

# keyword

The code is as follows:

% post-nochroot% post

[root@test OS] # pwd

/ data/OS

[root@test OS] # cat ks.cfg

Firewall-disabled

Install

Cdrom

Rootpw-- iscrypted $1 $stMs72eG$G3f0zhGBjp6/SioZ28CxQ0

Auth-useshadow-passalgo=md5

Text

Firstboot-disable

Keyboard us

Lang en_US.UTF-8

Selinux-disabled

# Do not configure the X Window System

Skipx

Logging-level=info

Reboot-eject

Timezone Asia/Shanghai

Network-device em1-bootproto=static-ip=192.168.7.123-netmask=255.255.248.0-gateway=192.1s

Bootloader-location=mbr-driveorder=sda

# Clear the Master Boot Record

Zerombr yes

# Partition clearing information

Clearpart-all-initlabel

# Disk partitioning information

Part /-- fstype= "ext4"-- size=10240

Part swap-size=4096

Part / data-fstype= "ext4"-grow-size=1

% packages

@ base

@ core

@ server-policy

Sgpio

Device-mapper-persistent-data

Ntp

% post-- nochroot

Mkdir-p / mnt/sysimage/tmp/custom_data > > / tmp/custom.log 2 > & 1

Cp / mnt/source/Packages/lnmp_pack.tar.gz / mnt/sysimage/tmp/custom_data > > / tmp/custom.log 2 > & 1

Cp / mnt/source/Packages/install_packages.sh / mnt/sysimage/tmp/custom_data > > / tmp/custom.log 2 > & 1

Cp / mnt/source/Packages/ncftp-3.2.5-src.tar.gz / mnt/sysimage/tmp/custom_data > > / tmp/custom.log 2 > & 1

Cp / mnt/source/Packages/rarlinux-3.8.0.tar.gz / mnt/sysimage/tmp/custom_data > > / tmp/custom.log 2 > & 1

Cp / mnt/source/Packages/nmon_linux_14i.tar.gz / mnt/sysimage/tmp/custom_data > > / tmp/custom.log 2 > & 1

% post

Cd / tmp/custom_data > > / tmp/custom.log 2 > & 1

Chmod + x install_packages.sh

Sh install_packages.sh

# remove custom_data

Rm-rf / tmp/custom_data

# vim syntax on

Echo alias vi='vim' > > / etc/bashrc

# disable ipv6

Echo "alias net-pf-10 off" > > / etc/modprobe.d/dist.conf

Echo-e "options\ tipv6\ tdisable=1" > > / etc/modprobe.d/dist.conf

Echo "NETWORKING_IPV6=no" > > / etc/sysconfig/network

# append lib

Echo "/ usr/local/lib/" > > / etc/ld.so.conf

# modify lang

Echo 'export LANG=zh_CN.UTF8' > > / etc/profile

# disable system auto mail

Echo "unset MAILCHECK" > > / etc/profile

# modify history

Echo 'export HISTTIMEFORMAT= "F% T `whoami`" > > / etc/profile

Sed-I "s/HISTSIZE=1000/HISTSIZE=999999999/" / etc/profile

# modifu ssh port on 3389

Echo 'Port 3389' > > / etc/ssh/sshd_config

Echo 'UseDNS no' > > / etc/ssh/sshd_config

For i in `ls / etc/rc3.d/S* `

Do

CURSRV= `echo $I | cut-c 15-`

Chkconfig-- level 3$ CURSRV off

Done

For i in crond rsyslog iptables network ntpd sshd sysstat;do chkconfig-- level 3$ I on;done

Sed-I'/ HOSTNAME=/d' / etc/sysconfig/network

Echo 'HOSTNAME=test' > > / etc/sysconfig/network

# sysctl

Echo "net.core.netdev_max_backlog = 32768" > > / etc/sysctl.conf

Echo "net.core.rmem_default = 8388608" > > / etc/sysctl.conf

Echo "net.core.rmem_max = 16777216" > > / etc/sysctl.conf

Echo "net.core.somaxconn = 32768" > > / etc/sysctl.conf

Echo "net.core.wmem_default = 8388608" > > / etc/sysctl.conf

Echo "net.core.wmem_max = 16777216" > > / etc/sysctl.conf

Echo "net.ipv4.ip_local_port_range = 5000 65000" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_fin_timeout = 30" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_keepalive_time = 300" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_max_orphans = 3276800" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_max_syn_backlog = 65536" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_max_tw_buckets = 5000" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_mem = 94500000 915000000 927000000" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_syn_retries = 2" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_synack_retries = 2" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_syncookies = 1" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_timestamps = 0" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_tw_recycle = 1" > > / etc/sysctl.conf

Echo "net.ipv4.tcp_tw_reuse = 1" > > / etc/sysctl.conf

/ sbin/sysctl-p

# modify core ulimt

Echo-e "*\ tsoft\ tnofile\ t65535" > > / etc/security/limits.conf

Echo-e "*\ thard\ tnofile\ t65535" > > / etc/security/limits.conf

Echo-e "*\ tsoft\ tnofile\ t65535" > > / etc/security/limits.d/90-nproc.conf

Echo-e "*\ thard\ tnofile\ t65535" > > / etc/security/limits.d/90-nproc.conf

# ntpd

Cat > / etc/sysconfig/clock < / etc/sysconfig/iptables

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report