给公司个别安装好的系统环境处理-相当half系统初始化脚本shell
#!/bin/bash
# Used for other system-environment update!
echo -e '\n\033[35m~~请使用root权限运行此脚本~~\033[0m\n'
read -n 1 -p "Sure?(y/n):" sure
echo
if [ $sure == 'y' ]
then
echo -e '\n\033[32mcontinue......\033[0m\n'
else
exit 126
fi
echo -e "\033[34m[请输入nginx配置文件所在目录路径]:\033[0m" && read nginx_conf_dir
echo -e "\033[34m[请输入php配置文件所在目录路径]:\033[0m" && read php_conf_dir
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
setenforce 0
for i in {adm,games,lp,operator,systemd-network,dbus,polkitd,halt}
do /usr/sbin/userdel -r $i
done
/usr/sbin/useradd -M www;/usr/sbin/useradd -M ops
openssl rand -base64 8 >/home/ops.pass;openssl rand -base64 8 >/home/www.pass
cat /home/ops.pass | passwd --stdin ops
cat /home/www.pass | passwd --stdin www
mkdir -p /data/{bak,bin,logs,package,soft,store,tmp,upload,www}
echo '
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 62144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 1024 65535
' >>/etc/sysctl.conf
sysctl -p
echo '
* soft nofile 65536
* hard nofile 65536
* soft nproc 2048
* hard nproc 4096
' >> /etc/security/limits.conf
sed -i 's/env_reset$/env_reset,pwfeedback/g' /etc/sudoers
echo '
ops ALL=(ALL) NOPASSWD: ALL
www ALL=(ALL) NOPASSWD: /bin/whoami,/usr/bin/pwd,!/usr/bin/chattr,!/usr/bin/yum,!/usr/bin/chmod,!/usr/bin/rm
' >> /etc/sudoers
/usr/bin/chattr +i /etc/passwd /etc/shadow /etc/group /etc/gshadow /etc/inittab
#args1:是nginx配置文件目录
sed -i 's/^#user nobody;/user www;/g' $nginx_conf_dir
#args2:是php-fpm配置文件目录
sed -i 's/^user = nobody$/user = www/g;s/^group = nobody$/group = www/g' $php_conf_dir
给公司个别安装好的系统环境处理-相当half系统初始化脚本shell的更多相关文章
- 安装k8s,使用root帐号的初始化脚本
现在稳定性差不多了.可以总结一下了. 真正使用时,有几个地方,还是确认一下,再正式运行吧. #!/bin/bash # Version V0. ---: ;fi K8S_VERSION="1 ...
- 分享我自己的一个最小化安装CentOS6的初始化脚本
在自己的虚拟机上使用的基于CentOS6的系统初始化脚本 #!/bin/bash # #Filename:system_init.sh #Description:系统安装完成后,对系统进行一些配置,以 ...
- 公司电脑安装mysql出现小问题
按步骤将mysql安装好后,在自己电脑完全没问题,但是在公司电脑安装的时候出现了这样的问题. 查阅资料以后,找到了问题: 参考链接:https://blog.csdn.net/huacode/arti ...
- Linux编译源码的方式安装Qt4开发环境(基于Ubuntu系统)
1.到官网http://qt-project.org/downloads或者ftp://ftp.qt-project.org/上下载Qt的源码包,要安装当然要先有源码咯,我下载的是qt-everywh ...
- Mysql安装、查看密码、修改密码、初始化、修改字符类型
安装mysql 参照python篇一键安装lnmp.安装完之后再按照下面修改密码,修改配置文件,否则安装的时候就修改配置文件会出错. 注意:这也是二进制安装mysql.另一种二进制安装容易出错,生产环 ...
- vmware安装无法打开内核设备 \\.\Global\vmx86: 系统找不到指定的文件
刚刚安装好了虚拟机,Windows XP 64bit Professional,安装好了开发环境,然后重启机器后虚拟机就打不开了,提示“vmware安装无法打开内核设备 \\.\Global\vmx8 ...
- 如何安装win10+Red Hat Enterprise Linux双系统?
1,如何安装win10+Red Hat Enterprise Linux双系统???? 有很多人(没做过调查,可能就我自己想装吧)想要安装Red Hat Enterprise Linux系统,但是又不 ...
- Linux安装系统注意事项及系统初始化
Linux安装系统注意事项 1.分区 学习用途: /boot:200M /swap :内存的1到2倍 /:根据需要分配大小,比如虚拟机下总空间是15G,那么可以分配8——10G跟/分区,如果是生产 ...
- 沉淀,再出发——安装windows10和ubuntu kylin15.04双系统心得体会
安装windows10和ubuntu kylin15.04双系统心得体会 一.安装次序 很简单,两种安装次序,"先安装windows后安装linux:先安装linux后安装wind ...
随机推荐
- JIRA之两大统计图讲解
一.创建与解决的问题-状态统计图 配置方式 理解该统计图 横坐标 x:时间 纵坐标 y:issue数量 统计图示解读: A.随着时间的推移,创建的问题数(红线)减少,修复问题数(绿线)增加,标志着版本 ...
- 两个list 合并后去除掉重复removeAll()的,然后再随机获取最后list中的 几个值
public static void test1(){ String s1="1,2,5,3,6,9"; String n1[]=s1.split(","); ...
- Integrating .NET Code and SQL Server Reporting Services
SQL Server Reporting Services versions 2000 and 2005 (SSRS) has many powerful features. SSRS has a w ...
- 2、投资之基金 - IT人思维之投资
笔者曾经对基金进行投资,但是当时对基金不是很了解,只是为了投资而去投资.现在,笔者对基金的投资有了更深入的了解认识,所以就有了本文. 基金投资在国内还是挺流行的,虽然其是从国外引进来的概念经验,但是国 ...
- windows 系统再重启后,USB口失效(鼠标、U盘都无法识别)的过程及解决方法
今天都差点忘记写随笔.今天在工作中,将电脑重启了一次,悲催了.重启完成后,鼠标无法使用了.最初认为 鼠标的问题,就一直"砸",但后来换了鼠标,仍然不能使用,开始认为没这边简单,拿出 ...
- Largest Point
Largest Point Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Tot ...
- IDEA创建springboot异常(Failed to load class "org.slf4j.impl.StaticLoggerBinder")
IDEA中创建springboot项目遇到的问题 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". ...
- 牛客 Rabbit的数列 (线段树维护值为x的个数+区间覆盖)
https://ac.nowcoder.com/acm/contest/907/C 链接:https://ac.nowcoder.com/acm/contest/907/C来源:牛客网 题目描述 Ra ...
- day14—jQuery UI 之dialog部件
转行学开发,代码100天——2018-03-30 今天主要展示jQuery UI 之dialog部件的用法, 参考文档:https://jqueryui.com/dialog/ 本文记录分享初始的引用 ...
- Jenkins+GitLab持续集成
向GitLab提交代码之后自动触发Jenkins构建 https://baijiahao.baidu.com/s?id=1630678692475452408&wfr=spider&f ...