centos系统新机部署

@TO加粗样式C 新centos系统环境配置
|

  • 新的系统要想能够提供测试和线上生产环境,一些标准化的流程是必须的,就像打地基盖房子一样。

  • 配置yum源 使用epel-release yum install -y epel-release openssh-devel lrzsz vim bind-utils

  • 执行初始环境脚本enent_.sh

  • #!/bin/bash
    read -p “请输入系统最大打开的文件数量” a
    read -p “请输入系统最大的进程数量” b
    echo “* noproc $b” >> /etc/security/limits.conf
    echo “* nofile a " > > / e t c / s e c u r i t y / l i m i t s . c o n f s e d − i " 1 , a" >> /etc/security/limits.conf sed -i "1, a">>/etc/security/limits.confsedi"1, s/SELINUX=enforcing/SELINUX=disabled/g” /etc/selinux/config
    setenforce 0
    cat /etc/issue | grep 6
    if [ $? -eq 0 ];then
    chkconfig iptables off
    /etc/init.d/iptables stop
    echo “您的系统是CENTOS 6 已经关闭防火墙”
    else
    systemctl stop firewalld && systemctl disable firewalld
    echo “您的系统是centos 7 防火墙已经关闭”
    fi

  • 在jenkins自动化部署环境中涉及到常常改变CI和UAT环境下发到不同IP的服务器上,所以需要在下发配置目录下更改项目的IP地址和port。所以有一个批量查看此目录下文件名和文件内容的脚本,方便于以后对于项目的统筹和管理,如下

  • [root@localhost src]# cat kk.sh
    #!/bin/bash
    if [ -f ./kk.txt ];then
    rm -rf ./kk.txt
    else
    touch ./kk.txt
    fi
    a=CI–*
    for name in $a
    do
    echo $namecat $name >> ./kk.txt
    done

以下为 输出内容:
[root@bussiness-interface-ct program_new]# cat kk.txt
CI–aps_approvalIP=10.194.63.111 PORT=8080
CI–crf_cdsIP=10.194.64.106 PORT=8080
CI–crf_channel_dataIP=10.194.63.100 PORT=8080

  • nginx的优化脚本
    [root@localhost src]# cat nginx_youhua.sh
    #!/bin/bash
    a=grep "define NGINX_VERSION" ./src/core/nginx.h
    b=grep "#define NGINX_VER" ./src/core/nginx.h
    sed -i “13s/KaTeX parse error: Expected 'EOF', got '#' at position 3: a/#̲define NGINX_VE…b/#define NGINX_VER “Apache/” NGINX_VERSION/” ./src/core/nginx.h
    sed -i “s/Server: nginx/Server: Apache/g” ./src/http/ngx_http_header_filter_module.c
    sed -i “s#
    nginx
    #
    Apache
    #” ./src/http/ngx_http_special_response.c
    #以上是安装nginx之前编译的更改源码隐藏信息及版本号
    useradd nginx -s /sbin/nologin -M #禁止登陆,无家目录 配置文件中修改为 worker_processes 1; user nginx;
  • 时间同步以保证安装服务时候不会报错
  • 1.安装ntpdate工具
    yum -y install ntp ntpdate
    2.设置系统时间与网络时间同步
    ntpdate cn.pool.ntp.org
    3.将系统时间写入硬件时间
    hwclock --systohc
    4.强制系统时间写入CMOS中防止重启失效
      hwclock -w
      或clock -w
    5.设置计划任务 crontab -e 查看计划任务 crontab -l

/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值