LAMP集群项目二 初始化系统
2024-09-03 22:02:39
1.关闭防火墙
/etc/init.d/iptables stop chkconfig iptables off
2.关闭selinux
cat /etc/selinux/config #查看状态 sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config setenforce #关闭selinux getenforce #查看selinux状态
3.添加用户
useradd oldboy id oldboy echo "" | passwd --stdin oldboy && history -c
4.更新yum源(souhu源好像没有CentOS6 )
cd /etc/yum.repos.d/ wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
5.更新系统
rpm --import /etc/pki/rpm-gpg/PRM-GPG-KEY* yum upgrade
6.安装必要的软件
yum install sysstat -y # sysstat软件包,包含监测系统的一组工具
7.精简开机启动项(虚拟机测试无法开机)
for a in `chkconfig --list | grep "3:on" | awk '{print $1}' | grep -vE "crond|network|sshd|rsyslog"`;do chkconfig $a off; done
8.更改ssh配置
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ori sed -i 's%#Port 22%Port 52113%' /etc/ssh/sshd_config sed -i 's%#PermitRootLogin yes%PermitRootLogin no%' sed -i 's%#PermitEmptyPasswords no%PermitEmptyPasswords no%' sed -i 's%#UseDNS yes%UseDNS no%' /etc/ssh/sshd_config egrep "UseDNS|52113|RootLogin|EmptyPass" /etc/ssh/sshd_config
9.普通用户加入sudo管理
visudo #相当于编辑/etc/sudoer cp /etc/sudoers /etc/sudoers.ori echo "oldboy ALL=(ALL) ALL" >>/etc/sudoers tail - /etc/sudoers
10.修改字符集显示(测试会码)
echo ' LANG="zh_CN.GB18030"' >/etc/sysconfig/i18n source /etc/sysconfig/i18n echo $LANG
11.定时任务校准时间(虚拟机需要界面上修改时区,校准时间的地址)
echo '*/5 * * * * /usr/sbin/ntpdate time.windows.com >/dev/null 2>&1' >>/var/spool/cron/root crontab -l
12.加大文件描述符
echo '* - nofile 65535 ' >>/etc/security/limits.conf
#重新登录后生效
ulimit -n tail - /etc/security/limits.conf
13.内核参数调优
cp /etc/sysctl.conf /etc/sysctl.conf.`date +"%Y-%m-%d_%H-%M-%S"` #备份
cat>>/etc/sysctl.conf<<EOF
net.ipv4.tcp_timestamps =
net.ipv4.tcp_synack_retries =
net.ipv4.tcp_syn_retries =
net.ipv4.tcp_mem =
net.ipv4.tcp_max_orphans =
net.core.wmem_default =
net.core.rmem_default =
net.core.rmem_max =
net.core.wmem_max =
net.ipv4.tcp_rmem=
net.ipv4.tcp_wmem=
net.core.netdev_max_backlog =
net.core.somaxconn =
net.ipv4.tcp_syncookies=
net.ipv4.tcp_tw_reuse =
net.ipv4.tcp_tw_recycle =
net.ipv4.tcp_fin_timeout=
net.ipv4.tcp_keepalive_time=
net.ipv4.tcp_max_syn_backlog =
net.ipv4.ip_local_port_range =
EOF
cat /etc/sysctl.conf
sysctl -p #参数生效
注意:
最新文章
- bzoj3527: [Zjoi2014]力
- ios基础篇(二十一)—— UIImagePickerController类
- POJ 2411 Mondriaan&;#39;s Dream
- data structure
- sqlserver模糊查询【转】
- 团队项目的NABC(截图软件)
- qt 在指定区域添加图片
- [Stephen]转载 如何提高测试用例评审效率
- Flink Program Guide (6) -- 窗口 (DataStream API编程指导 -- For Java)
- state pattern
- DOM操作-主动触发按钮的单击事件
- OpenCV 之 Mat 类
- LeetCode Algorithm
- centOS7配置DNS服务器
- [USACO5.3]校园网Network of Schools
- spring mvc controller中的参数验证机制(一)
- Java知多少(11)数据类型转换
- C#正则表达式语法教程
- 3DMAX 批量 场景 对象 导出 .X格式 脚本
- 【BZOJ1082】[SCOI2005]栅栏(搜索)
热门文章
- web项目的路径问题
- vue组件调用(全局调用和局部调用)
- java运算符优先级和结合性
- Android Camera API/Camera2 API 相机预览及滤镜、贴纸等处理
- java工程资源文件夹嵌套建立!
- html中iframe子页面与父页面元素的访问以及js变量的访问
- 解决Eclipse下启动tomcat报错:/bin/bootstrap.jar which is referenced by the classpath, does not exist.
- dp背包之01背包poj2184
- python学习笔记(9)--Python UnicodeEncodeError: &#39;gbk&#39; codec can&#39;t encode character 解决方法
- Keil(MDK-ARM)系列教程(五)_Configuration(Ⅰ)