[root@fu ~ 12:02:20]$set|grep PS1 —set命令查看系统所有环境变量信息
PS1=‘[\u@\h \W \T]$’
3)系统基础优化–安全优化
1.安全服务软件–selinux(在一定程度上限制root用户权限)
2.安全服务软件–iptables(防火墙就是网络安全隔离的服务)
PS:系统初始化使用时,尽量将安全服务先关闭
复制代码
4.selinux软件如何先关闭
- 临时关闭
此时系统的selinux服务状态
[root@fu ~ 12:03:38]$getenforce —查看selinux开启或关闭的状态
Enforcing
head /etc/selinux/config
This file controls the state of SELinux on the system.
SELINUX= can take one of these three values:
enforcing - SELinux security policy is enforced.
selinux服务处于开启状态
permissive - SELinux prints warnings instead of enforcing.
selinux临时关闭状态,还会有安全告警提示信息
disabled - No SELinux policy is loaded.
selinux彻底关闭状态
[root@fu ~ 01:32:41]$setenforce
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]
[root@fu ~ 01:37:01]$setenforce 0
[root@fu ~ 01:37:51]$getenforce
Permissive
复制代码
selinux服务有自己的配置文件,直接修改配置文件,即可使配置修改永久生效
1)永久关闭
vim /etc/selinux/config — selinux软件配置文件
SELINUX=enforcing
改为
SELINUX=disabled
???
sed ‘s#enforcing#disabled#g’ /etc/selinux/config
sed -n ‘7p’ /etc/selinux/config
???
sed ‘7s#SELINUX=enforcing#SELINUX=disabled#g’ /etc/selinux/config
sed ‘s#SELINUX=enforcing#SELINUX=disabled#g’ /etc/selinux/config
sed -i.bak ‘s#SELINUX=enforcing#SELINUX=disabled#g’ /etc/selinux/config
iptables 软件如何关闭
ll /etc/init.d/
drwxr-xr-x. 2 root root 4096 Jun 19 12:25 /etc/init.d/
#此目录中一般存放的是服务程序脚本文件
- 临时关闭
[root@fu ~]# /etc/init.d/iptables
Usage: iptables {start|stop|reload|restart|condrestart|status|panic|save}
[root@fu ~]# /etc/init.d/iptables status —(status表示查看防火墙当前状态是否开启)
iptables: Firewall is not running.
[root@fu ~]# /etc/init.d/iptables stop — (STOP表示关闭)
[root@fu ~]# /etc/init.d/iptables start —(satrt表示开启)
iptables: Applying firewall rules: [ OK ]
[root@fu ~]# /etc/init.d/iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
- 永久关闭
[root@fu ~]# chkconfig|grep “ipt”
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
说明:利用chkconfig命令查看开机服务自启状态
[root@fu ~]# chkconfig|grep “ipt”
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@fu ~]# chkconfig iptables off
[root@fu ~]# chkconfig|grep “ipt”
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
说明:利用chkconfig设置iptables服务永久关闭
复制代码
5.系统基础优化–防止系统乱码
制造出乱码情况(字符集设定不对)
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Linux运维工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Linux运维知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取)
升的进阶课程,基本涵盖了95%以上Linux运维知识点,真正体系化!**
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取)
[外链图片转存中…(img-xyYRzfvJ-1712515827087)]