服务器使用centos7.9操作系统前需要做的准备工作

文章目录


前言

记录一下centos7.9操作系统的服务器在部署业务服务之前需要做的准备工作。

大家可以复制到自己的编辑器里面,有需求的注释一些步骤。

备注:有条件的项目推荐使用有长期支持的操作系统版本。


1.操作记录

shell 复制代码
# 更换阿里云源 安装epel-release
mkdir -p /etc/yum.repos.d/CentOS-Base.repo.backup;
\mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup;
# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo;
# 没有wget命令的时候,可以用curl命令下载文件
curl  -o  /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache;
yum install wget -y;
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo;
yum -y install epel-release;

#安装调试用基础软件包
yum install -y tree nmap dos2unix lrzsz lsof  tcpdump htop iftop iotop sysstat nethogs;
yum install -y psmisc net-tools bash-completion vim vim-enhanced;
yum install -y vim  pciutils traceroute  unzip zip expect yum-utils tar telnet;

#关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux;
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config;
sed -i 's/SELINUX=permissive/SELINUX=disabled/g' /etc/sysconfig/selinux;
sed -i 's/SELINUX=permissive/SELINUX=disabled/g' /etc/selinux/config;

# 关闭防火墙 不推荐直接关闭 最好是按照服务开放端口和白名单 防止项目交付后再动
# systemctl stop firewalld.service;
# systemctl disable firewalld.service;

# 时间配置
timedatectl set-timezone "Asia/Shanghai";
yum install ntpdate -y;
# 从阿里云ntp集群同步时间
ntpdate  time1.aliyun.com;
# 将时间同步到硬件
clock -w;

# CPU升频
yum install cpupowerutils -y ;
cpupower frequency-set -g performance;

# 备份网卡配置文件
mkdir -p /etc/sysconfig/network-scripts/bak
cp /etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/bak

# 备份yum源文件
mkdir -p /etc/yum.repos.d/bak
cp /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak

# 更新打补丁 更新这里按需来 现在服务大多跑在容器中,操作系统的更新已经不太影响业务了
yum update -y;

总结

简单记录

相关推荐
咕噜企业分发小米8 小时前
有哪些开源的直播云服务器安全防护方案?
运维·服务器·云计算
C_心欲无痕9 小时前
nginx - 开启 gzip 压缩
运维·前端·nginx
开开心心_Every9 小时前
安卓后台录像APP:息屏录存片段,行车用
java·服务器·前端·学习·eclipse·edge·powerpoint
qq_316837759 小时前
IP网段冲突 配置指定ip使用指定的网络接口发送,而不经过默认网关
服务器·网络·tcp/ip
王阿巴和王咕噜9 小时前
【WSL】安装并配置适用于Linux的Windows子系统(WSL)
linux·运维·windows
Xの哲學10 小时前
深入剖析Linux文件系统数据结构实现机制
linux·运维·网络·数据结构·算法
深圳市恒讯科技10 小时前
Linux 文件权限指南:chmod 755、644、drwxr-xr-x 解析
linux·服务器·xr
Wpa.wk10 小时前
性能测试工具 - JMeter工具组件介绍二
运维·经验分享·测试工具·jmeter·自动化·json
朝阳58110 小时前
Ubuntu 22.04 安装 Fcitx5 中文输入法完整指南
linux·运维·ubuntu
xingzhemengyou110 小时前
Linux taskset指令设置或查看进程的 CPU 亲和性
linux·服务器