LINUX Initialization Script and linux Initialization Script
#! /Bin/bash
###### The system first start configuretion #### for install
#### Copy right by donglei ##############
#1. Configure sysctl
Mv/etc/sysctl. conf/etc/sysctl. bak
Echo "########################## the new config for sysctl ##### ######
Net. ipv4.ip _ forward = 0
Net. ipv4.conf. default. rp_filter = 1
Net. ipv4.conf. default. accept_source_route = 0
Kernel. sysrq = 0
Kernel. core_uses_pid = 1
Net. ipv4.tcp _ syncookies = 1
Kernel. msgmnb = 65536
Kernel. msgmax = 65536
Kernel. shmmax = 68719476736
Kernel. shmall = 4294967296
Kern. maxfiles = 65536
Kern. maxfilesperproc = 32768
Net. core. rmem_default = 262144
Net. core. wmem_default = 262144
Net. core. rmem_max = 262144
Net. core. wmem_max = 262144
Net. inet. udp. checksum = 1
Net. inet. tcp. syncookies = 1
Net. ipv4.tcp _ synack_retries = 2
Net. ipv4.tcp _ syn_retries = 2
Net. ipv4.tcp _ keepalive_time = 30
Net. ipv4.tcp _ keepalive_probes = 2
Net. ipv4.tcp _ keepalive_intvl = 2
Net. ipv4.tcp _ fin_timeout = 30
Net. ipv4.tcp _ tw_reuse = 1
Kernel. sem = 250 32000 100 128
Fs. file-max = 65536
Net. ipv4.ip _ local_port_range = 1024 65000 ">/etc/sysctl. conf
Chmod 644/etc/sysctl. conf
#2. Configure ipv6
Echo "########## ipv6-disabled ###########
Alias net-pf-10 off
Alias ipv6 off ">/etc/modprobe. d/dist. conf
Echo "############# ipv6-disabled #########
NETWORKING_IPV6 = no ">/etc/sysconfig/network
/Sbin/chkconfig ip6tables off
#3. Configure the system clock
Echo "############# system_clock ###########
01 *** root ntpdate 172.17.1.150; hwclock -- systohc ">/etc/crontab
#4. Configure the bash environment. The current location and time are displayed on the command line each time. Currently, only the root is configured.
Echo "export PS1 = '\ 033 [1; 33m \ H \ 033 [1; 34 m [\ w] \ 033 [1; 35m \ D {% D % T} \ n \ [\ 033 [1; 36m \] \ u @ pts/\ l \ [\ 033 [00m \] \ $ '">/root /. bashrc
#5. Configure System Service startup items
For I in 'ls/etc/rc3.d/S *'
Do
Servi = 'echo $ I | cut-c 15 -'
Case $ servi in
Cpuspeed | crond | irqbalance | microcode_ctl | sendmail)
;;
*)
Echo "change $ servi to off">./log. log
Chkconfig $ servi off
Service $ servi stop
;;
Esac
Done
#6. Configure the default language environment of the system
Mv/etc/sysconfig/i18n/etc/sysconfig/i18n. bak
Echo "######### set new language by admin #######
LANG = "zh_CN.UTF-8"
SUPPORTED = "zh_CN.UTF-8: zh_CN: zh: en_US.UTF-8: en_US: en"
SYSFONT = "latarcyrheb-sun16">/etc/sysconfig/i18n
Chmod 644/etc/sysconfig/i18n
#7. Configure selinux
Sed-I-e's/^ SELINUX =. */LANG = "SELINUX = disabled/'-e's/^ SELINUXTYPE =. */SELINUXTYPE = disabled/'/etc/sysconfig/selinux
#8. Disable iptables
Service iptables stop
Chkconfig iptables off
#9. You cannot log on to the system as the root user.
Mv/etc/ssh/sshd_config/etc/ssh/sshd_config.bak
Grep-Ev '^ $ | ^ #'/etc/ssh/sshd_config.bak>/etc/ssh/sshd_config
Chmod 600/etc/ssh/sshd_config
Sed/PermitRootLogin/d/etc/ssh/sshd_config
Sed/ClientAliveCountMax/d/etc/ssh/sshd_config
Echo "####### ssh security config #######
PermitRootLogin no
ClientAliveCountMax 10 ">/etc/ssh/sshd_config
Service sshd restart
Linux is the shell script of the system initialization file. Let's see how to read this description.
It's really messy. You can try again.
In linux, when is/etc/sysconfig/* called? What should I do? Who called it? Is the value of the initialization script?
It will be used at startup, including IP addresses and configuration of a network service.