Created
November 21, 2019 08:41
-
-
Save bfgits/92bedb76a80fd62c8effce9efb6f3da3 to your computer and use it in GitHub Desktop.
centos init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#调整分区大小 | |
$ sudo resize2fs /dev/xvda1 | |
service sshd start | |
yum -y install setuptool | |
yum -y install ntsysv system-config-firewall-tui system-config-network-tui | |
yum -y install openssh-clients | |
yum -y install telnet vim ntpdate wget | |
yum install ntp ntpdate ntp-doc | |
yum install mkfontscale (字体工具) | |
chkconfig ntpd on | |
service ntpd start | |
#编译开发环境的简易安装 | |
sudo yum groupinstall -y "Development tools" | |
#couchbase要安装openssl098e | |
yum install openssl098e | |
Please note that you have to update your firewall configuration to | |
allow connections to the following ports: 11211, 11210, 11209, 4369, | |
8091, 8092 and from 21100 to 21299. | |
#安装scp服务端,不然会显示bash: scp: command not found lost connection | |
change | |
#添加google DNS 8.8.8.8 | |
setenforce 0 | |
/etc/sysconfig/selinux | |
SELINUX=disabled | |
#SELINUX=enforcing | |
#close selinux | |
setenforce 0 | |
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux | |
echo "selinux off" | |
service iptables stop | |
service ip6tables stop | |
#chkconfig | |
chkconfig --level 35 ip6tables off | |
chkconfig --level 35 iptables off | |
chkconfig --level 35 bluetooth off | |
echo "chkconfig iptables off" | |
Selection Command | |
----------------------------------------------- | |
*+ 1 /usr/java/jdk1.6.0_17/bin/java | |
Enter to keep the current selection[+], or type selection number: | |
http://gigabud01.oss-cn-hangzhou.aliyuncs.com/software/jdk-8u161-linux-x64.tar.gz | |
#jdk8 installing | |
JAVA_HOME=/usr/java/jdk1.8.0_161 | |
PATH=$JAVA_HOME/bin:$PATH | |
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar | |
export JAVA_HOME | |
export PATH | |
export CLASSPATH | |
update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_131/bin/java 100 | |
update-alternatives --config java | |
update-alternatives --install /usr/bin/javac java /usr/java/jdk1.8.0_131/bin/javac 100 | |
update-alternatives --config javac | |
禁用GSSAPI和 DNS反向解析来提高ssh连接速度 | |
同时关闭空密码用户登陆,允许root login | |
vi /etc/ssh/sshd_config | |
设置以下几项为 | |
GSSAPIAuthentication no | |
UseDNS no | |
PermitEmptyPasswords no | |
PermitRootLogin ye | |
tcp 性能优化 | |
vi /etc/sysctl.conf | |
加入 | |
net.ipv4.tcp_fin_timeout = 1 | |
net.ipv4.tcp_keepalive_time = 1200 | |
net.ipv4.tcp_mem = 94500000 915000000 927000000 | |
net.ipv4.tcp_tw_reuse = 1 | |
net.ipv4.tcp_timestamps = 0 | |
net.ipv4.tcp_synack_retries = 1 | |
net.ipv4.tcp_syn_retries = 1 | |
net.ipv4.tcp_tw_recycle = 1 | |
net.core.rmem_max = 16777216 | |
net.core.wmem_max = 16777216 | |
net.core.netdev_max_backlog = 262144 | |
net.core.somaxconn = 262144 | |
net.ipv4.tcp_max_orphans = 3276800 | |
net.ipv4.tcp_max_syn_backlog = 262144 | |
net.core.wmem_default = 8388608 | |
net.core.rmem_default = 8388608 | |
调整最大打开文件数调整为65535 | |
vi /etc/security/limits.conf | |
加入 | |
* soft nofile 65535 | |
* hard nofile 65535 | |
#临时调整 ulimit -n 65535 | |
#显示状态ulimit -a | |
调整为美东时区 | |
cp /usr/share/zoneinfo/America/New_York /etc/localtime | |
cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime | |
ln -sf /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime | |
/usr/share/zoneinfo/Asia/Hong_Kong | |
# date -R | |
Mon, 25 Nov 2013 05:32:08 -0500 | |
每天四点和国家授时中心进行时间校正 | |
vi /etc/crontab | |
加入 | |
ntpdate us.pool.ntp.org | |
* 4 * * * /usr/sbin/ntpdate us.pool.ntp.org | |
禁用ctrl+alt+del自动重启 | |
注释掉 | |
exec /sbin/shutdown -r now "Control-Alt-Delete pressed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment