001.linux的基础优化(期中架构方面的优化)
1. linux内核优化
第一步
cat >>/etc/sysctl.conf<<EOF
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 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
EOF第二步:
sysctl -p
----可选的优化配置<如果开启防火墙可以使用>
iptables
net.nf_conntrack_max = 25000000
net.netfilter.nf_conntrack_max = 25000000
net.netfilter.nf_conntrack_tcp_timeout_established = 180
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120
2. 添加双网卡需要激活
*###setup的启动网卡配置中 Controlled by NetworkManager 如果无法访问网络可以尝试去掉这个选选项
3. 关闭防火墙(2步)
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
/etc/init.d/iptables stop
4. 时间同步服务(2步)
\ntpdate -u cn.pool.ntp.org
hwclock -w \写入硬件时间
hwclock -r \查看当前硬件时间配置时间同步任务
yum -y install ntp \安装时间同步工具
2. 同步时间的两种方法
-1.开机同步
vim /etc/rc.d/rc.local
/usr/sbin/ntpdate -u cn.pool.ntp.org >/dev/null 2>&1; /sbin/hwclock -w
-2.定时任务同步
vi /etc/crontab
*/10 * * * * /usr/sbin/ntpdate time.windows.com >/dev/null 2>&1;/sbin/hwclock -w #(更新时间同时写入硬件)
5.配置yum源添加eper源
更换yum源
-1. 清除yum源缓存
yum clean all
-2.备份yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
-3.更换 centos 7源
下载新的源: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
-4.添加epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
-5.生成缓存
yum makecache
6.精简开机自启动
chkconfig|egrep -v "crond|sshd|network|rsyslog|sysstat"|awk '{print "chkconfig",$1,"off"}'|bash
7.字符集更改
cp /etc/sysconfig/i18n /etc/sysconfig/i18n.ori
echo 'LANG="en_US.UTF-8"' >/etc/sysconfig/i18n
source /etc/sysconfig/i18n
echo $LANG
8.历史命令,断开时间优化
echo 'export TMOUT=300' >>/etc/profile
echo 'export HISTSIZE=5' >>/etc/profile
echo 'export HISTFILESIZE=5' >>/etc/profile
tail -3 /etc/profile
. /etc/profile
9.下载安装系统基础软件
yum install lrzsz nmap tree dos2unix nc -y
10.配置hosts文件(非优化项目,仅为实验)
cat >/etc/hosts<<EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.1.5 lb01
172.16.1.6 lb02
172.16.1.7 web01
172.16.1.8 web02
172.16.1.9 web03
172.16.1.51 db01
172.16.1.31 nfs01
172.16.1.41 backup
172.16.1.61 m01
172.16.1.62 jumpserver
EOF
11.关闭SElinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
getenforce
12.sudo权限控制[可在以后配置]
useradd oldboy | echo '123456' | passwd --stdin oldboy
echo "oldboy ALL=(ALL) NOPASSWD:ALL" >>/etc/suduers
viduso -c ##-----!检查
13.优化ssh服务登陆太慢
修改 /etc/ssh/sshd_config 配置文件
UseDNS yes 更改前
UseDNS no 更改后
完成后保存,这样能提高链接到服务器的速度
001.linux的基础优化(期中架构方面的优化)的更多相关文章
- Linux 首先基本包安装(vim啊什么的),源,源优化,项目架构介绍, (LNMuWsgi)Django项目相关软件mysql,redies,python(相关模块)安装配置测试
内容 补充: 查看已启动服务的端口 netstat -tulnp |grep (方式1) ss -tulnp|grep (方式2) 前期铺垫: . Linux要能上网 . 掌握Linux软件包安装方法 ...
- Linux实战教学笔记06:Linux系统基础优化
第六节 Linux系统基础优化 标签(空格分隔):Linux实战教学笔记-陈思齐 第1章 基础环境 第2章 使用网易163镜像做yum源 默认国外的yum源速度很慢,所以换成国内的. 第一步:先备份 ...
- Linux运维就业技术指导(八):期中架构考核
一,期中架构考核概述 1.1 架构图 1.2 架构图公司背景概述 公司是一个新兴的人脸识别高新创业公司,公司名称xxxx 老总是博士生导师,还有一个副总是研究生导师 副总同时是研发总监,负责所有的研发 ...
- Linu之linux系统基础优化和基本命令
Linux系统基础优化和基本命令 网络参数设定命令 ifconfig: 查询,设置网卡和ip等参数 ifup,ifdown: 脚本命令,更简单的方式 ip: 符合指令,直接修改上述功能 编辑网卡配置文 ...
- Linux(12):期中架构(4)--- 前端部分:HTTP & Nginx & LNMP架构
HTTP协议概念原理说明 1. 当用户访问一个网站时经历的过程 # ①. 利用DNS服务,将输入的域名解析为相应的IP地址 a 本地主机输入域名后,会查询本地缓存信息和本地hosts b 本地主机会向 ...
- Linux 系统基础优化和常用命令
目录 Linux 系统基础优化和常用命令 软连接 tar解压命令 gzip命令 netstart命令 ps命令 kill命令 killall命令 SELinux功能 iptables防火墙 Linux ...
- Linux内核基础优化
Linux内核基础优化 net.ipv4.ip_forward = 1 #开启网络转发 net.ipv4.conf.default.rp_filter = 0 #开启代理功能 net.ipv4.con ...
- 运维 07 Linux系统基础优化及常用命令
Linux系统基础优化及常用命令 Linux基础系统优化 引言没有,只有一张图. Linux的网络功能相当强悍,一时之间我们无法了解所有的网络命令,在配置服务器基础环境时,先了解下网络参数设定命令 ...
- Linux运维期中架构(50台集群)
一.期中架构 二.期中架构-前端部分 三.第三阶段作业-期中架构
随机推荐
- 【原创】官方文档-hive 启动命令
[一起学Hive]之十六-Hive的WEB页面接口-HWI Apache Hive 管网 hive metrics hive常用命令整理 Hive学习之HiveServer2服务端配置与启动 启动hi ...
- 记一次oralce 11g r2 rac安装问题
环境:虚拟机[root@rac1 ~]# lsb_release -aLSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd6 ...
- 第五章 深入class文件结构
一次编译好的class文件是如何到处运行的 5.1 JVM指令集简介 5.1.1 与类相关的指令 5.1.2 方法的定义 5.1.3 属性的定义 5.1.4 其他指令集 5.2 class文件头的表示 ...
- Dynamics CRM 2011 WebResources
Type Limitation Capabilities Usage Images JPG, PNG, GIF, ICO Custom entity icons Icons for custom ...
- Zabbix自定义监控网站服务是否能够正常响应
监测tcp连接数文件名: /etc/zabbix/zabbix_agentd.conf.d/count_tcp.conf UserParameter=count.tcp,netstat -s|g ...
- Oracle 11G的间隔(INTERVAL)分区
-- Create table create table MS_BIGTABLE_LOG ( record_date DATE, col_1 VARCHAR2(), col_2 VARCHAR2() ...
- Venom的简单使用
工具地址:https://github.com/r00t-3xp10it/venom 打开到venom目录,输入./venom.sh 打开程序 按回车键继续 这里有很多的模块,要用哪个模块就输入它的编 ...
- 完整部署OpenStack-memcache配置
一.[root@openstack-server ~]# nova listERROR (CommandError): You must provide a username or user id v ...
- temp8
- 「小程序JAVA实战」微信开发者工具helloworld(三)
转自:https://idig8.com/2018/08/09/xiaochengxu-chuji-03/ 第一个小程序demo的运行,首选需要去使用开发工具 开发工具下载安装 https://mp. ...