位置: 编程技术 - 正文
推荐整理分享CentOS自动化安装实战(centos安装zsh),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:cobbler自动安装centos7,centos7自动化部署,centos7自动化部署,centos7自动化部署,cobbler自动安装centos7,centos自动化部署,centos7自动安装,centos自动化部署,内容如对您有帮助,希望把文章链接给更多的朋友!
定制自动化安装盘
# 安装所需要的软件包: 复制代码代码如下:yum -y install createrepo mkisofs isomd5sum
# 生成精简后的rpm列表 复制代码代码如下:awk '/安装/{print $2}' install.log |sed 's/^[0-9]*://g' >/root/packages.list //我的是中文环境具体看log里是什么
# 约束目录结构复制代码代码如下:mkdir -p /mnt/cdrommkdir -p /data/OSmount /dev/cdrom /mnt/cdromrsync –a --exclude=Packages /mnt/cdrom/* /data/OSmkdir /data/OS/Packages
# 将精简后的rpm文件 拷贝到新的系统目录里 # 拷贝到新的系统目录方法很多,这里省事儿就用了替换命令 但是结果都一样啊 呵呵复制代码代码如下:cp /mnt/cdrom/Packages/libgcc-4.4.7-3.el6.x_cp /mnt/cdrom/Packages/setup-2.8.-.el6.noarchcp /mnt/cdrom/Packages/filesystem-2.4.-3.el6.x_cp /mnt/cdrom/Packages/xml-common-0.6.3-.el6.noarchcp /mnt/cdrom/Packages/cjkuni-fonts-common-0.2..1-.el6.noarchcp /mnt/cdrom/Packages/iso-codes-3.-2.el6.noarchcp /mnt/cdrom/Packages/basesystem-.0-4.el6.noarchcp /mnt/cdrom/Packages/dmz-cursor-themes-0.4-4.el6.noarchcp /mnt/cdrom/Packages/libX-common-1.5.0-4.el6.noarchcp /mnt/cdrom/Packages/ca-certificates-.-3.el6_1.5.noarchcp /mnt/cdrom/Packages/ncurses-base-5.7-3..el6.x_cp /mnt/cdrom/Packages/tzdata-j-1.el6.noarchcp /mnt/cdrom/Packages/glibc-common-2.-1..el6.x_cp /mnt/cdrom/Packages/nss-softokn-freebl-3..9-.el6.x_cp /mnt/cdrom/Packages/glibc-2.-1..el6.x_cp /mnt/cdrom/Packages/ncurses-libs-5.7-3..el6.x_cp /mnt/cdrom/Packages/bash-4.1.2-.el6.x_cp /mnt/cdrom/Packages/libattr-2.4.-7.el6.x_cp /mnt/cdrom/Packages/libcap-2.-5.5.el6.x_cp /mnt/cdrom/Packages/zlib-1.2.3-.el6.x_cp /mnt/cdrom/Packages/dbus-libs-1.2.-7.el6_3.x_cp /mnt/cdrom/Packages/info-4.a-8.el6.x_cp /mnt/cdrom/Packages/libxml2-2.7.6-8.el6_3.4.x_:%s/^/cp /mnt/cdrom/Packages//g cp /mnt/cdrom/Packages/cjkuni-uming-fonts-0.2..1-.el6.noarch.rpmcp /mnt/cdrom/Packages/cjkuni-ukai-fonts-0.2..1-.el6.noarch.rpmcp /mnt/cdrom/Packages/man-pages-3.-.el6.noarch.rpmcp /mnt/cdrom/Packages/words-3.0-.el6.noarch.rpmcp /mnt/cdrom/Packages/centos-indexhtml-6-1.el6.centos.noarch.rpmcp /mnt/cdrom/Packages/ql-firmware-5..-1.el6.noarch.rpmcp /mnt/cdrom/Packages/iwl-firmware-8..5.1_1-1.el6_1.1.noarch.rpmcp /mnt/cdrom/Packages/ql-firmware-1..-3.1.el6.noarch.rpmcp /mnt/cdrom/Packages/ivtv-firmware--.2.noarch.rpmcp /mnt/cdrom/Packages/libertas-usb-firmware-5...p-3.1.el6.noarch.rpmcp /mnt/cdrom/Packages/xorg-x-drv-ati-firmware-6..-1.el6.noarch.rpmcp /mnt/cdrom/Packages/ql-firmware-5..-1.el6.noarch.rpmcp /mnt/cdrom/Packages/atmel-firmware-1.3-7.el6.noarch.rpmcp /mnt/cdrom/Packages/zd-firmware-1.4-4.el6.noarch.rpmcp /mnt/cdrom/Packages/iwl-firmware-..2.-2.1.el6.noarch.rpmcp /mnt/cdrom/Packages/rtpci-firmware-1.2-7.el6.noarch.rpmcp /mnt/cdrom/Packages/iwl-firmware-..2.9-4.el6.noarch.rpmcp /mnt/cdrom/Packages/ql-firmware-2..-3.1.el6.noarch.rpmcp /mnt/cdrom/Packages/rtusb-firmware-1.8-7.el6.noarch.rpmcp /mnt/cdrom/Packages/ipw-firmware-1.3-.el6.noarch.rpmcp /mnt/cdrom/Packages/qlxx-firmware-3..-3.1.el6.noarch.rpmcp /mnt/cdrom/Packages/ipw-firmware-3.1-4.el6.noarch.rpmcp /mnt/cdrom/Packages/rootfiles-8.1-6.1.el6.noarch.rpm:%s/$/.rpm/g cp /mnt/cdrom/Packages/cjkuni-uming-fonts-0.2..1-.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/cjkuni-ukai-fonts-0.2..1-.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/man-pages-3.-.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/words-3.0-.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/centos-indexhtml-6-1.el6.centos.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/ql-firmware-5..-1.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/iwl-firmware-8..5.1_1-1.el6_1.1.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/ql-firmware-1..-3.1.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/ivtv-firmware--.2.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/libertas-usb-firmware-5...p-3.1.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/xorg-x-drv-ati-firmware-6..-1.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/ql-firmware-5..-1.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/atmel-firmware-1.3-7.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/zd-firmware-1.4-4.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/iwl-firmware-..2.-2.1.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/rtpci-firmware-1.2-7.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/iwl-firmware-..2.9-4.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/ql-firmware-2..-3.1.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/rtusb-firmware-1.8-7.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/ipw-firmware-1.3-.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/qlxx-firmware-3..-3.1.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/ipw-firmware-3.1-4.el6.noarch.rpm /data/OS/Packagescp /mnt/cdrom/Packages/rootfiles-8.1-6.1.el6.noarch.rpm /data/OS/Packages:%s/$/ /data/OS/Packages/g
# 创建ks.cfg文件 默认安装完系统就会安装所有的定制软件包了 # 关键字复制代码代码如下:%post --nochroot %post[root@test OS]# pwd/data/OS[root@test OS]# cat ks.cfgfirewall --disabledinstallcdromrootpw --iscrypted $1$stMseG$G3f0zhGBjp6/SioZCxQ0auth --useshadow --passalgo=md5textfirstboot --disablekeyboard uslang en_US.UTF-8selinux --disabled# Do not configure the X Window Systemskipxlogging --level=inforeboot --ejecttimezone Asia/Shanghainetwork --device em1 --bootproto=static --ip=..7. --netmask=...0 --gateway=.1sbootloader --location=mbr --driveorder=sda # Clear the Master Boot Recordzerombr yes # Partition clearing informationclearpart --all --initlabel # Disk partitioning informationpart / --fstype="ext4" --size=part swap --size=part /data --fstype="ext4" --grow --size=1 %packages@base@core@server-policysgpiodevice-mapper-persistent-datantp %post --nochrootmkdir -p /mnt/sysimage/tmp/custom_data >> /tmp/custom.log 2>&1cp /mnt/source/Packages/lnmp_pack.tar.gz /mnt/sysimage/tmp/custom_data >> /tmp/custom.log 2>&1cp /mnt/source/Packages/install_packages.sh /mnt/sysimage/tmp/custom_data >> /tmp/custom.log 2>&1cp /mnt/source/Packages/ncftp-3.2.5-src.tar.gz /mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1cp /mnt/source/Packages/rarlinux-3.8.0.tar.gz /mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1cp /mnt/source/Packages/nmon_linux_i.tar.gz /mnt/sysimage/tmp/custom_data >>/tmp/custom.log 2>&1 %postcd /tmp/custom_data >> /tmp/custom.log 2>&1chmod +x install_packages.shsh install_packages.sh # remove custom_datarm -rf /tmp/custom_data #vim syntax onecho alias vi='vim' >> /etc/bashrc # disable ipv6echo "alias net-pf- off" >> /etc/modprobe.d/dist.confecho -e "optionstipv6tdisable=1" >> /etc/modprobe.d/dist.confecho "NETWORKING_IPV6=no" >> /etc/sysconfig/network #append libecho "/usr/local/lib/" >> /etc/ld.so.conf #modify langecho 'export LANG=zh_CN.UTF8' >> /etc/profile #disable system auto mailecho "unset MAILCHECK" >> /etc/profile #modify historyecho 'export HISTTIMEFORMAT="%F %T `whoami` "' >> /etc/profilesed -i "s/HISTSIZE=/HISTSIZE=/" /etc/profile #modifu ssh port on echo 'Port ' >> /etc/ssh/sshd_configecho 'UseDNS no' >> /etc/ssh/sshd_config for i in `ls /etc/rc3.d/S*`doCURSRV=`echo $i|cut -c -`chkconfig --level 3 $CURSRV offdone for i in crond rsyslog iptables network ntpd sshd sysstat;do chkconfig --level 3 $i on;done sed -i '/HOSTNAME=/d' /etc/sysconfig/networkecho 'HOSTNAME=test' >> /etc/sysconfig/network # sysctlecho "net.core.netdev_max_backlog = " >> /etc/sysctl.confecho "net.core.rmem_default = " >> /etc/sysctl.confecho "net.core.rmem_max = " >> /etc/sysctl.confecho "net.core.somaxconn = " >> /etc/sysctl.confecho "net.core.wmem_default = " >> /etc/sysctl.confecho "net.core.wmem_max = " >> /etc/sysctl.confecho "net.ipv4.ip_local_port_range = " >> /etc/sysctl.confecho "net.ipv4.tcp_fin_timeout = " >> /etc/sysctl.confecho "net.ipv4.tcp_keepalive_time = " >> /etc/sysctl.confecho "net.ipv4.tcp_max_orphans = " >> /etc/sysctl.confecho "net.ipv4.tcp_max_syn_backlog = " >> /etc/sysctl.confecho "net.ipv4.tcp_max_tw_buckets = " >> /etc/sysctl.confecho "net.ipv4.tcp_mem = " >> /etc/sysctl.confecho "net.ipv4.tcp_syn_retries = 2" >> /etc/sysctl.confecho "net.ipv4.tcp_synack_retries = 2" >> /etc/sysctl.confecho "net.ipv4.tcp_syncookies = 1" >> /etc/sysctl.confecho "net.ipv4.tcp_timestamps = 0" >> /etc/sysctl.confecho "net.ipv4.tcp_tw_recycle = 1" >> /etc/sysctl.confecho "net.ipv4.tcp_tw_reuse = 1" >> /etc/sysctl.conf/sbin/sysctl -p # modify core ulimtecho -e "*tsofttnofilet" >> /etc/security/limits.confecho -e "*thardtnofilet" >> /etc/security/limits.conf echo -e "*tsofttnofilet" >> /etc/security/limits.d/-nproc.confecho -e "*thardtnofilet" >> /etc/security/limits.d/-nproc.conf # ntpdcat > /etc/sysconfig/clock < /etc/sysconfig/iptables <<EOF*filter############################################## disabled (INPUT,FORWARD,OUTPUT):INPUT DROP:FORWARD DROP:OUTPUT DROP # enabled lo-A INPUT -i lo -j ACCEPT-A OUTPUT -o lo -j ACCEPT-A FORWARD -o lo -j ACCEPT # enabled em2# Be careful of the network adapter name-A INPUT -i em2 -j ACCEPT-A OUTPUT -o em2 -j ACCEPT-A FORWARD -o em2 -j ACCEPT # enabled ping-A INPUT -p icmp -j ACCEPT-A OUTPUT -p icmp -j ACCEPT # enabled ntp-A INPUT -p udp -m udp --dport -j ACCEPT-A OUTPUT -p udp -m udp --sport -j ACCEPT # dns-A INPUT -p tcp -m tcp --sport -j ACCEPT-A OUTPUT -p tcp -m tcp --dport -j ACCEPT -A INPUT -p udp -m udp --sport -j ACCEPT-A OUTPUT -p udp -m udp --dport -j ACCEPT ############################################# ############################################## team ssh # all-A INPUT -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -p tcp -m tcp --sport -j ACCEPT # suzhouqiao-A INPUT -s ..x.xx -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -d ..x.xx -p tcp -m tcp --sport -j ACCEPT -A INPUT -s ..x.xx -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -d ..x.xxx -p tcp -m tcp --sport -j ACCEPT # corporate-A INPUT -s ...x -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -d ..xx.1x0 -p tcp -m tcp --sport -j ACCEPT -A INPUT -s ..xx1.x -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -d .x7.x1.x -p tcp -m tcp --sport -j ACCEPT -A INPUT -s ..xxs.x0 -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -d ..xx.xxx -p tcp -m tcp --sport -j ACCEPT -A INPUT -s ..x9.xx -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -d ..xx.xx -p tcp -m tcp --sport -j ACCEPT -A INPUT -s ..xx.xx2 -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -d ..x.xx -p tcp -m tcp --sport -j ACCEPT -A INPUT -s ..xx.1xx -p tcp -m tcp --dport -j ACCEPT-A OUTPUT -d ..1xx.xx -p tcp -m tcp --sport -j ACCEPT############################################# ############################################## jiankongbao-A INPUT -s .xx..xx -p udp -m udp --dport -j ACCEPT-A OUTPUT -d .xx.xx.x3 -p udp -m udp --sport -j ACCEPT -A INPUT -s ...xx -p udp -m udp --dport -j ACCEPT-A OUTPUT -d ..xx. -p udp -m udp --sport -j ACCEPT -A INPUT -s ..x.xx -p udp -m udp --dport -j ACCEPT-A OUTPUT -d ..x.1xx -p udp -m udp --sport -j ACCEPT -A INPUT -s ..sxx -p udp -m udp --dport -j ACCEPT-A OUTPUT -d ..xx.xx -p udp -m udp --sport -j ACCEPT############################################# ############################################## project port#############################################COMMITEOF %end
# 让系统从kickstart配置启动安装复制代码代码如下:[root@test isolinux]# pwd/data/OS/isolinux[root@test isolinux]# cat isolinux.cfgdefault linux ks=cdrom:/ks.cfgprompt 1timeout display boot.msgF1 boot.msgF2 options.msgF3 general.msgF4 param.msgF5 rescue.msglabel linux kernel vmlinuz append initrd=initrd.img label text kernel vmlinuz append initrd=initrd.img text label ks kernel vmlinuz append ks initrd=initrd.imglabel local localboot 1label memtest kernel memtest append -
# 生成rpm包的依赖关系复制代码代码如下:[root@test ~]# cd /data/OS/[root@test OS]# createrepo -g repodata/*-comps.xml /data/OS/
# 生成iso镜像复制代码代码如下:mkisofs -R -J -T -r -l -d -joliet-long -allow-multidot -allow-leading-dots -no-bak -o /data/CentOS-6.4-x_-mini.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /data/OS
# 生成MD5校验码 //本人没有执行这条命令原因是如果需要修改iso里的内容会导致光盘无法使用
复制代码代码如下:implantisomd5 /data/CentOS-6.4-x_-mini.iso
基于Kisckstart的安装
安装软件包
yum -y install createrepo mkisofs制作流程目录结构拷贝CentOS原始镜像内容,不做任何精简
复制代码代码如下:mkdir /mnt/centosmount /dev/sr0 /mnt/centosmkdir /tmp/isocp -r /mnt/centos/* /tmp/iso增加Kickstart配置文件文件路径和安装方式可自由定义
复制代码代码如下:cd /tmp/iso/isolinux#修改引导,注意ks=部分vi isolinux.cfg label linux menu label ^Install or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img ks=cdrom:/isolinux/ks.cfg #手动增加Kickstart配置文件vi ks.cfg#Kickstart file automatically generated by anaconda.#version=DEVEL #Install OS instead of upgrade#表示是安装,而不是升级install #Use text mode install#文本方式安装text #Use network installation#使用网络安装#url --url= installation Use CDROM installation media#使用光盘安装cdrom #Installation Number configuration#如果是RedHat的系统,会要求输入key,这里配置为跳过,如果不配置安装时会停在那里要求用户输入key#key –skip #System language#语言环境#lang en_US.UTF-8lang zh_CN.UTF-8 #System keyboard#键盘类型keyboard us #Network information#网络配置#network --device eth0 --bootproto dhcp --onboot yes #Root password#root密码rootpw chinaums #Firewall configuration#禁用防火墙firewall --disabled #SELinux configuration#禁用selinuxselinux --disabled #Run the Setup Agent on first boot#禁用第一次启动时设置系统的向导firstboot --disable #System authorization information#用户认证配置,useshadow表示使用本地认证,--passalgo表示密码加密算法authconfig --enableshadow --passalgo=sha #System timezone#设置时区为上海timezone --isUtc Asia/Shanghai #System bootloader configuration#指明bootloader的安装位置,指明驱动器的排序,指明操作系统安装完成之后,向内核传递的参数bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" #Clear the Master Boot Record#清除MBR引导记录zerombr yes #Partition clearing information#清除硬盘上的所有数据clearpart --all --initlabel #Disk partitioning information#自定义分区 #创建一个M大小的分区挂载/boot类型为ext4part /boot --fstype=ext4 --size= --ondisk=sda #创建一个M大小的SWAP分区part swap --size= --ondisk=sda #创建/目录part / --fstype=ext4 --grow --size=1 --ondisk=sda #Reboot after installation#设置完成之后重启reboot --eject #This packages is for CentOS 6.4#为CentOS 6.4定制的软件包%packages@base@core@chinese-support #增加安装后运行脚本 %post#config service #自定义服务service NetworkManager stopchkconfig NetworkManager off #eject cdrom#安装完成弹出光碟 #eject #reboot#执行完毕后重启 #reboot -f #结束自动化部署%end生成依赖关系和ISO文件注意路径和命令的准确性
复制代码代码如下:cd /tmp/isocreaterepo -g repodata/*comps.xml . mkisofs -o /tmp/CentOS-6.4__auto.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -joliet-long -R -J -v -T /tmp/iso/
在CentOS系统下安装Puppet和Puppet Foreman的教程 一、系统环境:Centos6.4x_..6.puppet.domain.com..6.agent1.domian.com二、关闭selinux和iptables(我这里是测试环境,也可以增加puppet端口)复制代码代码
CentOS系统中使用EPEL源的方法 国内的yum源貌似没几个全的,尤其是网易,速度虽然快,但是很不全,很多东西都没有就连ipython的都没有,每次装写软件,都要自己去wget包,想省点心
在CentOS系统上简单安装配置XRDP服务器 第一步安装fedora的源1.因为CentOS6.3默认是不带XRDP服务器的复制代码代码如下:[root@s~]#
标签: centos安装zsh
本文链接地址:https://www.jiuchutong.com/biancheng/363278.html 转载请保留说明!上一篇:CentOS系统中安装和破解jira的教程(centos 安装chia)
下一篇:在CentOS系统下安装Puppet和Puppet Foreman的教程(centos安装软件教程)
友情链接: 武汉网站建设