服务器使用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;

总结

简单记录

相关推荐
张火火isgudi1 小时前
fedora43 安装 nvidia 驱动以及开启视频编解码硬件加速
linux·运维·视频编解码·nvidia
赋创小助手2 小时前
融合与跃迁:NVIDIA、Groq 与下一代 AI 推理架构的博弈与机遇
服务器·人工智能·深度学习·神经网络·语言模型·自然语言处理·架构
电商API&Tina2 小时前
跨境电商 API 对接指南:亚马逊 + 速卖通接口调用全流程
大数据·服务器·数据库·python·算法·json·图搜索算法
IT19952 小时前
Qt笔记-使用SSH2进行远程连接linux服务器并上传文件
linux·服务器·笔记
北京盟通科技官方账号3 小时前
工业通讯底层对齐:EtherNet/IP Class 1 连接中的 32-bit Header 与内存映射逻辑
服务器·网络·网络协议·自动化·制造
叽里咕噜怪3 小时前
docker-compose 编排ruoy实践
运维·docker·容器
lengjingzju4 小时前
一网打尽Linux IPC(三):System V IPC
linux·服务器·c语言
SoveTingღ6 小时前
【问题解析】我的客户端与服务器交互无响应了?
服务器·c++·qt·tcp
iconball6 小时前
个人用云计算学习笔记 --37 Zabbix
运维·笔记·学习·云计算·zabbix
zhougl9966 小时前
Vuex 模块命名冲突:问题解析与完整解决方案
linux·服务器·apache