当前位置: 首页 > news >正文

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

文章目录

  • 前言
    • 1.操作记录
  • 总结


前言

记录一下centos7.9操作系统的服务器在部署业务服务之前需要做的准备工作。
大家可以复制到自己的编辑器里面,有需求的注释一些步骤。
备注:有条件的项目推荐使用有长期支持的操作系统版本。


1.操作记录

# 更换阿里云源 安装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安装服务
yum install -y ntp;
#修改配置文件
sudo sed -i 's/^server /#server /' /etc/ntp.conf;
sed -i '/3.centos.pool.ntp.org iburst/a server time1.aliyun.com prefer\nserver time2.aliyun.com\nserver time3.aliyun.com\nserver time4.aliyun.com\nserver time5.aliyun.com\nserver time6.aliyun.com\nserver time7.aliyun.com' /etc/ntp.conf;
#重启并加入自启
systemctl enable ntpd;
systemctl restart ntpd;
ntpq -p;
hwclock;# 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;

总结

简单记录

http://www.lryc.cn/news/536313.html

相关文章:

  • 【Prometheus】prometheus结合cAdvisor监控docker容器运行状态,并且实现实时告警通知
  • 【Stable Diffusion模型测试】测试ControlNet,没有线稿图?
  • 算法刷题-数组系列-卡码网.区间和
  • Druid GetConnectionTimeoutException解决方案之一
  • 【JavaScript爬虫记录】记录一下使用JavaScript爬取m4s流视频过程(内含ffmpeg合并)
  • CSDN2024年度总结|乾坤未定你我皆是黑马|2025一起为了梦想奋斗加油少年!!!
  • 【前端】 react项目使用bootstrap、useRef和useState之间的区别和应用
  • 联想电脑如何进入BIOS?
  • 蓝桥杯单片机大模板(西风)
  • 20250213刷机飞凌的OK3588-C_Linux5.10.209+Qt5.15.10_用户资料_R1
  • 2.13学习记录
  • 【DeepSeek】Deepseek辅组编程-通过卫星轨道计算终端距离、相对速度和多普勒频移
  • JavaEE架构
  • Docker 网络的几种常见类型
  • C++ 常用的设计模式
  • 【设计模式】01- 一文理解常用设计模式-“创建型模式”篇
  • 在ArcGIS JS API中使用WebGL实现波纹扩散特效
  • 我用AI做数据分析之四种堆叠聚合模型的比较
  • 《LSTM与HMM:序列建模领域的双雄对决》
  • Flutter 的 Widget Key 提议大调整?深入聊一聊 Key 的作用
  • 只需三步!5分钟本地部署deep seek——MAC环境
  • 网络工程师 (31)VLAN
  • 浏览器网络请求全流程深度解析
  • React历代主要更新
  • 【数据结构】(8) 二叉树
  • navicat导出表结构到Excel 带字段备注
  • 使用pocketpal-ai在手机上搭建本地AI聊天环境
  • 程序诗篇里的灵动笔触:指针绘就数据的梦幻蓝图<10>
  • FPGA简介|结构、组成和应用
  • [c语言日寄]在不完全递增序中查找特定要素