1. Turn off SELinux function
①selinux configuration file path
/etc/selinux/config
② View selinux Status
getenforce
③ Close SELinux
- Method One: General method → Modify the configuration file
vi /etc/selinux/config
Modify Selinux=enforcing to Selinux=disabled
- Method Two:
① Backup configuration file[[email protected] ~]# cp /etc/selinux/config /etc/selinux/config.orl
② Pre-modification
③ modifying to a file
Note: Because in a production environment, you cannot easily restart the server, you can disable the configuration file to achieve the same effect using Setenforce. If you follow these steps, the restart will also turn off SELinux.
2. Linux operating level
①linux run-level configuration files
cat /etc/inittab
②linux Run level Introduction (Enterprise Common interview questions: 7 types of Linux operating level and corresponding role. )
0 - halt (Do NOT set initdefault to this) # 关机状态1 - Single user mode # 单用户模式(通常在维护服务器时使用,比如说找回root密码)2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 没有NFS的多用户模式3 - Full multiuser mode # 完整的多用户模式,Linux的默认模式。4 - unused # 保留5 - X11 # 带桌面的模式6 - reboot (Do NOT set initdefault to this) # 重启(后边的英文意思请你自己意会)
③ viewing the Linux operating level
runlevel
④ switching the Run level
init # 后边接级别
3. Turn off the firewall
① temporarily closed
/etc/init.d/iptables stop 或 service iptables stop
② View Status
/etc/init.d/iptables status 或 service iptables status
③ permanently closed
chkconfig iptables off
PS: This tutorial is for beginners or 0 basic people to learn, although I know in the actual can not do so, the line of people please seriously optimistic about this sentence and then comment.
4, Linux Chinese display settings
① where the configuration file is located
② additional content enables Linux to support Chinese display
③ configuration after application is added
. /etc/sysconfig/i18n
④ View the status of changes
echo $LANG
5. Set Idle account timeout time
export TMOUT=10 # 10秒后退出登录
6. Hide Linux Version information
> /etc/issue> /etc/issue.netcat /etc/issue.net
7, if the virtual machine to do the experiment, save the snapshot and cloning, found that the network card does not come, you can do so.
① editing the eth0 configuration file
vi /etc/sysconfig/network-scripts/ifcfg-eth0# 删除“HWADDR”和“UUID”这两行(可以按键盘上的d两次删除一行)
② if necessary, clear the following files:
> /etc/udev/rules.d/70-persistent-net.rules
③ if it is necessary to restart the system
reboot
8. Clear the History record
history -c # 清除所有history -d 5 # 删除第五条内容export HISTSIZE=5 # 控制命令行历史记录数量为5(Linux特殊变量)export HISTFILESIZE=3 # 命令行命令对应文件的记录数 ~/.bash_history(Linux特殊变量)# 若想设置Linux特殊变量永久生效,可使用echo‘Linux特殊变量‘ >>/etc/profile即可,设置完最后需要source /etc/profile能立即生效。
(not to be continued, about SSH remote Connection service troubleshooting ideas, please see the next article reproduced article ...) )
Welcome attention
Sina Weibo: https://weibo.com/yougazhang0506
Public platform: Zhang Yujia
My site: http://www.zhangyujia.cn
51CTO Blog: http://blog.51cto.com/11099293
CSDN Blog: http://blog.csdn.net/u013260195
03-linux Basics (iii)-Basic optimization of the system [for learners who use virtual machine learning]