Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
init-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Meifa Tang
init-server
Commits
d6bdcaac
Commit
d6bdcaac
authored
May 25, 2021
by
Meifa Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parents
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
0 deletions
+97
-0
init-server.sh
init-server.sh
+97
-0
No files found.
init-server.sh
0 → 100644
View file @
d6bdcaac
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment