CentOS 7一些常用配置

一、更改启动模式

背景:个人开发环境,安装了GNOME桌面,默认启动是图形化模式。

修改为命令行模式。

systemctl set-default multi-user.target 

二、命令行模式下启动图形

1 startx
2 
3 想重新打开命令行界面呢?
4 alt + ctrl +F1~F6 //这个方法尝试了下不好用

三、实时查看启动日志

默认是有图片覆盖在屏幕上的,我想看看为啥启动到哪一步了?(当然也可以在val/log/boot.log中看)

这里是修改为实时显示的方法。

1 vim /boot/grub2/grub.cfg
2 找到如下一行:
3 linux16 /vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_US.UTF-8
4 删除rhgb(redhat图形化启动)即可。

更优雅一些的方法:
1 vim /etc/default/grub
2 删除配置参数GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet"中的rhgb
3 执行grub2-mkconfig -o /boot/grub2/grub.cfg重新生成启动参数。 

四、永久关闭SElinux

执行vim /etc/selinux/config,将文件中的enforcing改为disabled即可。

  1 
  2 # This file controls the state of SELinux on the system.
  3 # SELINUX= can take one of these three values:
  4 #     enforcing - SELinux security policy is enforced.
  5 #     permissive - SELinux prints warnings instead of enforcing.
  6 #     disabled - No SELinux policy is loaded.
  7 SELINUX=enforcing
  8 # SELINUXTYPE= can take one of three two values:
  9 #     targeted - Targeted processes are protected,
 10 #     minimum - Modification of targeted policy. Only selected processes are protected. 
 11 #     mls - Multi Level Security protection.
 12 SELINUXTYPE=targeted

 五、关闭防火墙

1 关闭防火墙:
2 systemctl stop firewalld.service
3 启动防火墙:
4 systemctl start firewalld.service
5 禁止防火墙启动:
6 systemctl disable firewalld.service
原文地址:https://www.cnblogs.com/yoyotl/p/5622891.html