【分享】Shell 初始化AIX操作系统的脚本

#!/usr/bin/ksh

#

#####################################

#  INIT AIX5308 OS SCRIPT           #

#####################################

#############################################################

#                                                           #

# SET the PS1,nimserver  and Define the NFS /mountpoint     #

#                                                           #

#############################################################

export PS1="[`hostname`""(""`ifconfig en0|grep inet|awk '{print $2}'`"")]:"'[$USER][$PWD] '

set -o vi

####################################################      

#                                                  #

# Define The mount and umount  nfs filesystem func #

#                                                  #

####################################################

mountnfs(){

     

             mkdir -p /epack1 /epack2 /epack3 /lpp5308 /linux_toolbox

             mount nimserver:/nim/expansion_pack1 /epack1

             mount nimserver:/nim/expansion_pack2 /epack2

             mount nimserver:/nim/expansion_pack3 /epack3

             mount nimserver:/nim/lpp_source/lpp5308 /lpp5308

             mount nimserver:/nim/lpp_source/linuxtoolbox /linux_toolbox

}

umountnfs(){

         

        for i in   /epack1 /epack2 /epack3 /lpp5308 /linux_toolbox

         do

             umount $i

         done        

}

###########################################

#                                         #

#  Define the init filesystem function    #

#                                         #

###########################################

install_001(){

           df -g

           chfs -a size=4G  /   

           chfs -a size=5G  /home

           chfs -a size=4G  /var

           chfs -a size=4G  /tmp  

           chfs -a size=4G  /opt

           chfs -a size=4G  /usr

           df -g

}

###########################################

#                                         #

#  Define the init Page Space function    #

#                                         #

###########################################

install_002(){

           chps -s'64' hd6

}

###########################################

#                                         #

#  Define the init MAX Process function   #

#                                         #

###########################################

install_003(){

            chdev -l sys0 -a maxuproc='2048'

}

###########################################

#                                         #

#  Define the init AIO Setting function   #

#                                         #

###########################################

install_004(){

            chdev -l aio0 -a maxservers='40' -a autoconfig='available'

}

####################################################

#                                                  #

#  Define init root user resource limit function   #

#                                                  #

####################################################

install_005(){

            chuser fsize='-1' data='-1' stack='-1' core='-1' root

}

####################################################

#                                                  #

#  Define init AIX User Password Security function #

#                                                  #

####################################################

install_006(){

             chsec -f /etc/security/user -s default -a minlen=8 -a minalpha=3 -a minother=1 -a maxrepeats=3 -a mindiff=3

}

####################################################

#                                                  #

#  Define Install the CDE environment function     #

#                                                  #

####################################################

install_007(){

            /usr/lib/instl/sm_inst installp_cmd -a -Q -d '/lpp5308'  -b 'CDE' -f 'all'  '-c' '-N' '-g' '-X'  '-G'   '-Y'

}

####################################################

#                                                  #

#  Define Install Lang(en_us,chinese) function     #

#                                                  #

####################################################

install_008(){

            installp -aX -d /lpp5308  \

             bos.loc.utf.ZH_TW        \

             bos.loc.utf.ZH_SG        \

             bos.loc.utf.ZH_HK        \

             bos.loc.utf.ZH_CN        \

             bos.loc.utf.EN_US        \

             bos.loc.iso.zh_TW        \

             bos.loc.iso.zh_CN        \

             bos.loc.iso.Zh_TW        \

             bos.loc.iso.Zh_CN        \

             bos.loc.iso.en_US        \

             bos.loc.com.utf          \

             bos.loc.com.CN           \

             bos.iconv.zh_TW          \

             bos.iconv.zh_CN          \

             bos.iconv.ucs.Zh_CN      \

             bos.iconv.ucs.ZH_CN      \

             bos.iconv.Zh_TW          \

             X11.loc.zh_CN.base.rte   \

             X11.loc.zh_CN.base.lib   \

             X11.loc.zh_TW.base.rte   \

             X11.loc.zh_TW.base.lib   \

             X11.loc.ZH_SG.base.rte   \

             X11.loc.ZH_SG.base.lib   \

             X11.loc.ZH_HK.base.rte   \

             X11.loc.ZH_HK.base.lib   \

             X11.loc.Zh_TW.base.rte   \

             X11.loc.Zh_TW.base.lib   \

             X11.loc.Zh_CN.base.rte   \

             X11.loc.Zh_CN.base.lib   \

             X11.loc.ZH_TW.base.rte   \

             X11.loc.ZH_TW.base.lib   \

             X11.loc.ZH_CN.base.rte   \

             X11.loc.ZH_CN.base.lib   \

             X11.loc.EN_US.base.rte   \

             X11.loc.EN_US.base.lib   \

             X11.fnt.ucs.ttf_extb     \

             X11.fnt.ucs.ttf_CN       \

             X11.fnt.ucs.ttf_TW       \

             X11.fnt.ucs.ttf

}

####################################################

#                                                  #

#  Define Install openssl and openssh function     #

#                                                  #

####################################################

install_009(){

             geninstall -d /lpp5308 -Y \

                       I:openssl.base  \

                       I:openssl.license \

                       I:openssl.man.en_US

              

             geninstall -d /lpp5308   \

                       I:openssh.base.client  \

                       I:openssh.base.server  \

                       I:openssh.man.en_US

}

####################################################

#                                                  #

#  Define add chkuser and set root security func   #

#  (make chkuser login and root can't login)       #

####################################################

install_010(){

             mkuser -a id=500 pgrp=staff groups=staff chkuser

             echo "chkuser:asdfg123"|chpasswd

             pwdadm -f NOCHECK chkuser

             chuser rlogin=false root

}

###############################################################################

#                                                                             #

#  Define config the  openssh  and Disable telnet service function            #

#                                                                             #

###############################################################################

install_011(){

             echo "PermitRootLogin no">>/etc/ssh/sshd_config             #默认是允许root用户远程ssh登录,设为禁止

             echo "AllowUsers yanghz zhangcy duxs chkuser">>/etc/ssh/sshd_config   #允许3个用户远程登录

             stopsrc -s sshd;startsrc -s sshd

             ######  Disable the telnet service ######

      

             sed -e 's/telnet/\#telnet/' /etc/inetd.conf > /tmp/inetd.conf

             cp -f /tmp/inetd.conf  /etc/inetd.conf

               

             refresh -s inetd

}

###############################################################################

#                                                                             #

#  Define install the AIX tools and Other Filesets Function                   #                           

#  (bos                                                                       #

#   bos.rte                                                                   #

#   bos.adt                                                                   #

#   bos.net                                                                   #

#   bos.perf                                                                  #

#   bos.cifs_fs                                                               #

#   perfagent.tools)                                                          #

#                                                                             #

###############################################################################

install_012(){

       geninstall -d /lpp5308 -Y perfagent.tools \

bos.adt.data \

bos.adt.debug \

bos.adt.graphics      \

bos.adt.insttools     \

bos.adt.libm          \

bos.adt.libmio        \

bos.adt.prof          \

bos.adt.prt_tools     \

bos.adt.samples       \

bos.adt.sccs          \

bos.adt.syscalls      \

bos.adt.utils         \

bos.cifs_fs.rte       \

bos.cifs_fs.smit      \

bos.net.ate           \

bos.net.ewlm.rte      \

bos.net.ipsec.websm   \

bos.net.mobip6.rte    \

bos.net.nfs.adt       \

bos.net.nfs.cachefs   \

bos.net.nfs.server    \

bos.net.nis.server    \

bos.net.nisplus       \

bos.net.ppp           \

bos.net.sctp

}

########################################

#                                      #

# Define Install Sdd Software Function #

########################################

install_013(){

   

    geninstall -d /epack3/sdd  devices.fcp.disk.ibm \

                               devices.sdd.53.rte \

                               ibm2105

            

    geninstall -d /epack3/tapedriver/3576 Atape.driver

            

}

########################################

#                                      #

# Define Install Ca Software Function  #

########################################

install_014(){

  geninstall -d /epack3/ca/sysedge/4.3.4 EMPsysedge.rte

}

########################################

#                                      #

# Define Install  Legato     Function  #

########################################

install_015(){

geninstall -d /epack3/legato/732 -Y \

        LGTOnw.man.rte  \

        LGTOnw.clnt.rte \

        LGTOnw.node.rte \

        LGTOnw.node.rte \

        LGTOnw.licm.rte \

        LGTOnw.licm.rte \

        LGTOnw.serv.rte

}

########################################

#                                      #

# Define Install  Linux tools Function #

########################################

install_016(){

geninstall -d /linux_toolbox rpm.rte \

        bash-3.2 \

        bash-doc-3.2 \

        coreutils-5.2.1 \

        unzip-5.51 \

        tar-1.14 \

        prngd-0.9.29

}

########################################

#                                      #

# Install PowerHA previews filesets    #

# (bos.data,bos.clvm.enh)

########################################

#######################################

#

# Define The main function            #

#

#######################################

init5312(){

      mountnfs

      install_001        # Init the filesystems size

      install_002        # Init the Page space  size

      install_003        # Init the system max process counts

      install_004        # Init the system aio enable and counts

      install_005        # Init the root user resource limits

      install_006        # Init the aix system user's passwd security need

      install_007        # Install the aix CDE filesets  

      install_008        # Install the en,chinese Lang filesets

      install_009        # Install the openssl,openssh

      install_010        # Add the chkuser and disable root rlogin

      install_011        # Config the SSH setting and disable the telnet services

      install_012        # Install the Aix system bos etc. filesets

      install_013        # Install the SDD software

      install_014        # Install the Ehealth software

      install_015        # Install the Legato  software

      install_016        # Install the Linux tools, such as tar,bash etc.

      chtz BEIST-8       # Change the time zone

}

参与3

1同行回答

youki2008youki2008  系统架构师 , DDT
不错的脚本,谢谢分享!显示全部

不错的脚本,谢谢分享!

收起
互联网服务 · 2020-07-13
浏览1386

提问者

powertiandi
系统架构师李宁(中国)体育用品有限公司
擅长领域: 存储服务器灾备

问题来自

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2017-03-23
  • 关注会员:2 人
  • 问题浏览:5255
  • 最近回答:2020-07-13
  • X社区推广