@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 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
/