Commit d6bdcaac authored by Meifa Tang's avatar Meifa Tang

init

parents
off_selinux() {
}
off_firewalld() {
systemctl stop firewalld.service &> /dev/null
systemctl disable firewalld.service &> /dev/null
}
reinforce_log() {
THE=(/var/log/wtmp /var/log/messages /var/log/secure)
chattr +a ${THE[@]}
}
increase_file_limits() {
THE="/etc/security/limits.conf"
[ -f $THE ] \
&& cp -a ${THE}{,.bak}
cat >> $THE <<_EOF_
* soft nofile 65535
* hard nofile 65535
_EOF_
ulimit -n ${NUUMBER} &>/dev/null
}
install_tools() {
# change repo
#
TOOLS=(deltarpm net-tools lrzsz tmux htop mlocate tree vim wget telnet lsof ntpdate)
InstallPkg=${TOOLS[@]}
yum -y -q install $InstallPkg &> /dev/null
yum groupinstall -y -q "Development Tools" &> /dev/null
}
change_motd() {
echo -e '\nWarning, fuzamei Production Environment\n' >> '/etc/motd'
}
change_sysctl() {
THE="/etc/sysctl.conf"
[ -f $THE ] \
&& cat >> $THE <<_EOF_
# Optimized kernel
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.ip_local_port_range = 4000 65000
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 16384
net.ipv4.tcp_max_orphans = 16384
vm.swappiness = 1
vm.dirty_ratio = 10
vm.dirty_background_ratio = 5
net.ipv4.tcp_fin_timeout = 720
net.ipv4.ip_local_port_range = 1024 65535
net.ipv4.tcp_keepalive_intvl = 30
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_tw_recycle = 1
_EOF_
}
change_timezone() {
THE="/etc/localtime"
[ -f $THE ] \
&& sudo ln -snf '/usr/share/zoneinfo/Asia/Shanghai' >> $THE
}
change_vimrc() {
THE="$HOME/.vimrc"
[ -f $THE ] \
&& echo -e 'set softtabstop=4\nset shiftwidth=4' >> $THE
}
main() {
off_selinux
off_firewalld
reinforce_log
increase_file_limits
install_tools
change_motd
change_sysctl
change_timezone
change_vimrc
sync_time
}
main
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment