.改主机名:
sed -i 's#HOSTNAME=.*#HOSTNAME=u05mix06.yaya.corp#g' /etc/sysconfig/network && hostname u05mix06.yaya.corp
sed -i 's#HOSTNAME=.*#HOSTNAME=u04es01' /etc/sysconfig/network && hostname u04es01 .修改服务器ssh端口
ucloud:
sed -i 's/#Port 22/Port 28290/' /etc/ssh/sshd_config
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
service sshd restart aliyun:
sed -i 's/#Port 22/Port 38390/' /etc/ssh/sshd_config
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
service sshd restart test:
sed -i 's/#Port 22/Port 48490/' /etc/ssh/sshd_config
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
service sshd restart 修改root密码:
echo 'pass'|passwd --stdin root .添加chinasoft用户
uclod
mkdir -p /data/chinasoft
useradd chinasoft -d /data/chinasoft aliyun useradd chinasoft -d /home/chinasoft
# 配置密码
echo 'pass'|passwd --stdin chinasoft cp /etc/skel/{.bash_profile,.bashrc,.bash_logout} /data/chinasoft
cp /etc/skel/{.bash_profile,.bashrc,.bash_logout} /home/chinasoft chown -R chinasoft.chinasoft /data
# 验证
su - chinasoft 验证端口,密码是否修改ok 是否添加sudo权限
visudo chinasoft ALL=(ALL) NOPASSWD: ALL .安装jdk1.8_102
将jdk-8u102-linux-x64.rpm上传到对应的服务器上 具体步骤:
检查现有版本JDK
# java -version 查找java相关文件并卸载
# rpm -qa|grep -i java
tzdata-java-2016f-.el6.noarch
java-1.8.-openjdk-headless-1.8.0.101-.b13.el6_8.x86_64 卸载openjdk1.
rpm -e --nodeps java-1.8.-openjdk-headless-1.8.0.101-.b13.el7_2.x86_64
rpm -e --nodeps tzdata-java-2016f-.el7.noarch
rpm -e --nodeps java-1.8.-openjdk-1.8.0.101-.b13.el7_2.x86_64 scp -P -r /usr/lib/rpm/ u04dnsmgr02.yaya.corp:/usr/lib/rpm/ 安装jdk8
rpm -ivh jdk-8u102-linux-x64.rpm java环境所在目录:
/usr/java/jdk1..0_102/
/usr/java/jdk1..0_102/bin/java JAVA_HOME=/usr/java/jdk1..0_102/
JRE_HOME=/usr/java/jdk1..0_102/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME JRE_HOME PATH CLASSPATH vim /etc/profile
export JAVA_HOME=/usr/java/jdk1..0_111
export PATH=$JAVA_HOME/bin:$PATH vim /etc/profile
export JAVA_HOME=/usr/java/jdk1..0_102
export PATH=$JAVA_HOME/bin:$PATH 验证是否ok
java -version java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) -Bit Server VM (build 25.102-b14, mixed mode) .启动时间同步服务,
yum install -y ntp vim /etc/ntp.conf # ntp.conf driftfile /var/lib/ntp/drift
pidfile /var/run/ntpd.pid
logfile /var/log/ntp.log # Access Control Support
restrict default kod nomodify notrap nopeer noquery
restrict - default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 # local clock
server 127.127.1.0
fudge 127.127.1.0 stratum server ntp1.aliyun.com iburst minpoll maxpoll
restrict ntp1.aliyun.com nomodify notrap nopeer noquery
server ntp1.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp1.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp10.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp10.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp11.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp11.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp12.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp12.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp2.aliyun.com iburst minpoll maxpoll
restrict ntp2.aliyun.com nomodify notrap nopeer noquery
server ntp2.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp2.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp3.aliyun.com iburst minpoll maxpoll
restrict ntp3.aliyun.com nomodify notrap nopeer noquery
server ntp3.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp3.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp4.aliyun.com iburst minpoll maxpoll
restrict ntp4.aliyun.com nomodify notrap nopeer noquery
server ntp4.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp4.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp5.aliyun.com iburst minpoll maxpoll
restrict ntp5.aliyun.com nomodify notrap nopeer noquery
server ntp5.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp5.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp6.aliyun.com iburst minpoll maxpoll
restrict ntp6.aliyun.com nomodify notrap nopeer noquery
server ntp6.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp6.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp7.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp7.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp8.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp8.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp9.cloud.aliyuncs.com iburst minpoll maxpoll
restrict ntp9.cloud.aliyuncs.com nomodify notrap nopeer noquery chkconfig ntpd on
service ntpd restart
service ntpd status aliyun_dns配置参考:
[]# cat /etc/resolv.conf
; generated by /sbin/dhclient-script
options timeout: attempts: rotate
nameserver 10.143.22.118
nameserver 10.143.22.116 如果是海外服务器需要调整时区 查看系统默认的时区: [root@u05mix06 Asia]# ll /etc/localtime
lrwxrwxrwx root root May : /etc/localtime -> /usr/share/zoneinfo/America/Los_Angeles .修改时区
将Asia/shanghai-上海时区写入当前时区 # cp -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
cp: overwrite `/etc/localtime'? y

# cat /etc/sysconfig/clock
ZONE="America/Los_Angeles"

# centos7设置洛杉矶时间

timedatectl set-timezone America/Los_Angeles

提示是否覆盖,输入Y回车,

然后#date
查看时区和时间(CST,中国时区)
# date -R
Fri, May :: + crontab -e
加入如下任务:
* * * /usr/sbin/ntpdate -u us.pool.ntp.org | logger -t NTP 表示每天6点进行同步一次也可以选择us.ntp.org.cn 这个美国的时间同步服务器 将时间写入硬件
hwclock -w .安装zabbix-agent配置开机自启动
针对:centos #!/bin/bash
######################
# date: --
# author: junjie.zheng
# about: auto_install zabbix-agent and salt-minion
####################### # check os version
platform=`uname -i`
if [ $platform != "x86_64" ];then
echo "this script is only for 64bit Operating System!"
exit
fi cat << EOF
+---------------------------------------+
| your system is CentOS x86_64 |
| start optimizing....... |
+---------------------------------------
EOF ZABBIX_SERVERIP=zbx.chinasoft.com echo "------ step 3: install zabbix_client------"
rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
yum -y install zabbix zabbix-agent echo "------ step 4: modify zabbix-agent profile_file and port------" sed -i "s#Server=127.0.0.1#Server=$ZABBIX_SERVERIP#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s#ServerActive=127.0.0.1#ServerActive=$ZABBIX_SERVERIP#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s#Hostname=Zabbix server#Hostname=`hostname`#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/# ListenPort=10050/ListenPort=20050/g" /etc/zabbix/zabbix_agentd.conf echo "------ step 5: start zabbix-agent------"
chkconfig zabbix-agent on
/etc/init.d/zabbix-agent start netstat -lnt|grep && echo "zabbix agent is ok" 如果是香港或者海外的服务器需要修改参数,以免经常重复报警:主机不可达 两个参数配置:
RefreshActiveChecks=
Timeout= .安装添加监控模板 基本硬件监控:linux
tcp监控
tomcat或者nginx监控
端口、url监控 非root用户随机启动程序示例: -------------------------------------------------------------------------------
touch /var/lock/subsys/local
ulimit -SHn echo 'options timeout:2' > /etc/resolv.conf
echo 'nameserver 10.19.177.116' >> /etc/resolv.conf
echo 'nameserver 10.19.31.157' >> /etc/resolv.conf
echo 'nameserver 114.114.114.114' >> /etc/resolv.conf
bash /usr/local/bin/set_irq_affinity.sh
su chinasoft -c "cd /data/chinasoft/zookeeper-3.4.6/bin && bash zkServer.sh start"
su chinasoft -c "cd /data/chinasoft/voice-server1 && bash start.sh start"
su chinasoft -c "cd /data/chinasoft/voice-server2 && bash start.sh start"
"cd /data/troops_test/video-record-server && bash start.sh start"
------------------------------------------------------------------------------- .北京地区ucloud主机添加dns内网解析
# 改变serial,方便dns02即slave同步
; serial (d. adams) 添加解析:
vim /var/named/yaya.corp 如下示例:
u04elk02 IN A 10.19.9.156
u04elk03 IN A 10.19.67.56 重启使配置生效
service named restart .修改文件句柄数限制
vim /etc/security/limits.conf * hard nofile
* soft nofile vim /etc/security/limits.d/-nproc.conf
删除这行
* soft nproc 编辑/etc/sysctl.conf
net.ipv4.tcp_syncookies =
net.ipv4.tcp_tw_reuse =
net.ipv4.tcp_tw_recycle =
net.ipv4.tcp_fin_timeout = swapoff -a echo "fs.file-max = 1000000" >> /etc/sysctl.conf
echo "vm.max_map_count=262144" >> /etc/sysctl.conf
echo "vm.swappiness = 0" >> /etc/sysctl.conf .添加内网域名解析
dns域名服务器:u04dns01.yaya.corp 添加解析
vim /var/named/yaya.corp 示例:
u04ck01 IN A 10.19.33.185
u04ck02 IN A 10.19.170.118
ck01.sql IN A 10.19.150.242
ck01.rds IN A 10.19.130.29 注意:
需要修改,如果不修改从服务器无法同步 ; serial (d. adams) 重启服务
service named restart .yum源配置,国内可配置为阿里云,国外yum install -y epel-release

判断centos6和centos7安装zabbix-agent

#!/bin/bash
######################
# date: --
# author: junjie.zheng
# about: auto_install zabbix-agent and salt-minion
####################### # .check os version
platform=`uname -i`
if [ $platform != "x86_64" ];then
echo "this script is only for 64bit Operating System!"
exit
fi ZABBIX_SERVERIP=zbx.yunva.com # .judge centos6 or centos7
cat /etc/redhat-release |grep \..*|grep -i centos>/dev/null
if [ $? -eq ];then
cat << EOF
+---------------------------------------+
| your system is CentOS x86_64 |
| start optimizing....... |
+---------------------------------------
EOF echo "------ step 3: install zabbix_client------"
rpm -ivh http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
yum -y install zabbix zabbix-agent echo "------ step 4: modify zabbix-agent profile_file and port------" sed -i "s#Server=127.0.0.1#Server=$ZABBIX_SERVERIP#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s#ServerActive=127.0.0.1#ServerActive=$ZABBIX_SERVERIP#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s#Hostname=Zabbix server#Hostname=`hostname`#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/# ListenPort=10050/ListenPort=20050/g" /etc/zabbix/zabbix_agentd.conf echo "------ step 5: start zabbix-agent------"
chkconfig zabbix-agent on
/etc/init.d/zabbix-agent start netstat -lnt|grep && echo "zabbix agent is ok"
else cat << EOF
+---------------------------------------+
| your system is CentOS x86_64 |
| start optimizing....... |
+---------------------------------------
EOF ZABBIX_SERVERIP=zbx.yunva.com echo "------ step 3: install zabbix_client------"
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm
yum -y install zabbix zabbix-agent echo "------ step 4: modify zabbix-agent profile_file and port------" sed -i "s#Server=127.0.0.1#Server=$ZABBIX_SERVERIP#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s#ServerActive=127.0.0.1#ServerActive=$ZABBIX_SERVERIP#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s#Hostname=Zabbix server#Hostname=`hostname`#g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/# ListenPort=10050/ListenPort=20050/g" /etc/zabbix/zabbix_agentd.conf echo "------ step 5: start zabbix-agent------"
systemctl enable zabbix-agent
systemctl start zabbix-agent ss -lnt|grep && echo "zabbix agent is ok" fi

centos系统初始化配置的更多相关文章

  1. centos 系统初始化

    centos 系统初始化 #!/bin/bash # author cfwl create date of 2012-10-21 # blog http://cfwlxf.blog.51cto.com ...

  2. 新的 Centos 服务器初始化配置

    当你初次创建新的 Centos 服务器的时候, Centos 默认的配置安全性和可用性上会存在一点缺陷(运维人员往往会有初始化的脚本).为了增强服务器的安全性和可用性,有些配置你应该尽快地完成. 这篇 ...

  3. centos系统初始化流程及实现系统裁剪

    Linux系统的初始化流程: POST:ROM+RAM BIOS: Boot Sequence MBR: 446:bootloader 64: 分区表 2: 5A kernel文件:基本磁盘分区 /s ...

  4. VMware安装CentOS系统与配置全过程

    1.需要哪些安装包 VMware Workstation 15 Pro CentOS-7-x86_64-DVD-1810 hadoop-2.7.3 apache-hive-3.1.1 jdk-8u18 ...

  5. 完整的WindowsServer服务器系统初始化配置、安全策略加固和基线检查脚本等保2.0适用

    转载自:https://www.bilibili.com/read/cv14326780?spm_id_from=333.999.0.0 0x00 前言简述 最近单位在做等保测评,由于本人从事安全运维 ...

  6. Kubernetes集群搭建之系统初始化配置篇

    Kubernetes的几种部署方式 1. minikube Minikube是一个工具,可以在本地快速运行一个单点的Kubernetes,尝试Kubernetes或日常开发的用户使用.不能用于生产环境 ...

  7. 大数据分析VMWare虚拟机centos系统下配置网络参数

    最近搞大数据方面的数据,通过网上视频学习和自己实践,有些不成文的实践就零碎的记录在此吧. 系统也可安装CentOS DVD版. 1.先进入配置文件,并查看基本情况,如下: 2.用vi编辑器打开物理网卡 ...

  8. 给新centos系统虚拟机配置网络服务

    记录下今天新建虚拟机的过程吧. 镜像:CentOS-6.3-x86_64-minimal; 虚拟机版本: vm 8.0 LET'S----------------------->GO 手动新建一 ...

  9. 虚拟机下克隆3个centos系统并配置IP访问网络(转载)

    此文是保证linux系统能够上网 先查看本机的IP 打开虚拟机,更改虚拟机为桥接方式 在第一个虚拟机上打开终端,在命令行输入setup,选择NETWORK CONFIGRATION 回车后, 配置IP ...

随机推荐

  1. spring boot集成redis的血泪史

    首先说明环境不是我搭建的,然后因项目需要添加redis的时候,麻烦来了.springboot 用的是1.5.9因为以前弄过redis,所以直接拿过来,麻烦了首先是莫名的错误,连项目都启动不了.但是最后 ...

  2. OPCServer:使用Matrikon OPC Server Simulation

    实验用模拟OPCServer 旧版(50M):Matrikon OPC Server Simulation(v1.5.0.0),百度网盘,密码: mcur 新版(157M):Matrikon OPC ...

  3. ajax传递对象数组

    1.Json.stringify()是将json数据格式转换成String类型字符串的方法. 后台可以使用String类型接受,接收完可以使用json转换java集合的方法. List<实体类& ...

  4. scoketserver模块(TCP协议 与 udp 协议)

    socketserver模块 ( 基于 TCP 协议 ) import socketserver # 自定义类用来处理通信循环 class MyTCPhanler(socketserver.BaseR ...

  5. kali渗透测试之缓冲区溢出实例-windows,POP3,SLmail

    kali渗透测试之缓冲区溢出实例-windows,POP3,SLmail 相关链接:https://www.bbsmax.com/A/xl569l20Jr/ http://4hou.win/wordp ...

  6. call apply bind 区别?

    call apply bind 区别? 例:定义一个计算器,没绑定bind的为公共计算器,call可以调用,绑定bind的为私人计算器,别人调用不了, //ps:用bind绑定的call强制作借用不好 ...

  7. 让table中td的内容靠上对齐

    valign=“top”; <td valign="top"></td> 点此查看详细table的td的valign属性

  8. git部分提交

    ---git add 需要提交的文件----git stash -u -k -k 开关告诉仓库保持文件的完整. -u 开关告诉仓库包括无路径的文件(那些新的和未添加到git的)----git stas ...

  9. 移动端300ms延迟解决方法在vue 里面的一些小坑

    话不多说上图: 至于import为什么会报错,瞅下面这个图: 总结:要搞懂个必须了解下es6的解构赋值才能在这方面装逼,网上资料一大堆自行百度.

  10. You Only Look Once: Unified, Real-Time Object Detection(翻译)

    0 - 摘要 我们提出了YOLO,一种新的物体检测方法.之前的物体检测工作是通过重新使用分类器来进行检测.相反,我们将对象检测抽象为一个回归问题,描述为以空间分隔的边界框和相关的类别概率.一个简单的神 ...