在Linux CentOS 7.9 64位操作系统服务器上,以下是关键信息和使用建议:
1. 系统确认
cat /etc/centos-release
uname -m # 确认架构为x86_64
2. 基础管理
-
网络配置
配置文件路径:/etc/sysconfig/network-scripts/ifcfg-eth0
重启网络:systemctl restart network -
防火墙(firewalld)
systemctl status firewalld firewall-cmd --list-all # 查看规则 firewall-cmd --add-port=80/tcp --permanent # 开放端口 firewall-cmd --reload
3. 软件管理
-
YUM包管理
yum update -y # 更新所有包(谨慎操作) yum install httpd -y # 安装Apache -
EPEL仓库
yum install epel-release -y
4. 服务管理
systemctl start httpd # 启动服务
systemctl enable httpd # 设置开机自启
5. 安全加固
-
禁用root SSH登录
编辑/etc/ssh/sshd_config:PermitRootLogin no重启SSH:
systemctl restart sshd -
SELinux管理
getenforce # 查看状态 setenforce 0 # 临时关闭(不推荐生产环境)
6. 备份与快照
- 重要数据定期备份(如使用
tar或rsync)。 - 虚拟机建议打快照后再进行重大操作。
7. 升级注意事项
- CentOS 7.9是CentOS 7的最终版本,后续无功能更新(仅安全补丁支持至2024年6月30日)。
- 长期考虑可迁移至AlmaLinux/Rocky Linux或CentOS Stream。
8. 常见问题
-
时间同步
yum install chrony -y systemctl enable --now chronyd -
磁盘空间不足
使用df -h和du -sh *排查大文件。
如需更具体的配置指导,请提供应用场景(如Web服务器、数据库等)。
云服务器