Coding库地址
课程使用代码
Centos6和7区别 https://zhidao.baidu.com/question/716660948565551765.html http://xiaofengmo.blog.51cto.com/10116365/1744661 http://www.cnblogs.com/Csir/p/6746667.html
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
设置putty显示最大行数:
设置字体:
设置编码格式:
http://www.netsarang.com/download/down_xsh.html
xshell登陆:
选择用户验证方式,密钥验证:
-更改活动状态时间:
centos7的运行级别都定义在 /lib/systemd/system下. 不再是之前的/etc/inittab文件 以下是/etc/inittab内容:
# inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # systemctl get-default # # To set a default target, run: # systemctl set-default TARGET.target 查看启动级别文件关联文件 [root@localhost ~]# ls -ltr /lib/systemd/system/runlevel*.target lrwxrwxrwx. 1 root root 16 9月 10 20:58 /lib/systemd/system/default.target -> graphical.target lrwxrwxrwx. 1 root root 13 9月 10 20:58 /lib/systemd/system/runlevel1.target -> rescue.target lrwxrwxrwx. 1 root root 15 9月 10 20:58 /lib/systemd/system/runlevel0.target -> poweroff.target lrwxrwxrwx. 1 root root 17 9月 10 20:58 /lib/systemd/system/runlevel4.target -> multi-user.target lrwxrwxrwx. 1 root root 17 9月 10 20:58 /lib/systemd/system/runlevel3.target -> multi-user.target lrwxrwxrwx. 1 root root 17 9月 10 20:58 /lib/systemd/system/runlevel2.target -> multi-user.target lrwxrwxrwx. 1 root root 16 9月 10 20:58 /lib/systemd/system/runlevel5.target -> graphical.target lrwxrwxrwx. 1 root root 13 9月 10 20:58 /lib/systemd/system/runlevel6.target -> reboot.target针对不同启动级别,创建对应target软链接
设置init 3 级别不同方法:
1. [root@localhost ~]# ln -svf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target 2. [root@localhost ~]# ln -svf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target 3. [root@localhost ~]#systemctl set-default multi-user.target设置init 5 级别不同方法:
1. [root@localhost ~]# ln -svf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target 2. [root@localhost ~]# ln -svf /lib/systemd/system/graphical.target /etc/systemd/system/default.target 3. [root@localhost ~]#systemctl set-default graphical.target关机命令: init 0 、shutdowm -r now 、poweroff开机进入选择系统模式,按e键进入单用户编辑模式,光标移动到下图,修改ro(只读)值为rw(可读可写),添加 启动路径:init=/sysroot/bin/sh.按ctrl+x保存启动
切换原系统用户下:chrooot /sysroot/
切换用户后可以进行更改root用户密码等操作
出现小方块是因为系统为中文,需要指定语言:LANG=en
单用户更改密码后必须生效selinux:touch /.autorelabel
挂载光驱开机启动,选择Troubleshooting选项
进入后,选择Rescue a Centos Linux system
此时有几个选项:继续、只读、跳过shell、离开。选择1继续。
进入shell后,需要切换回原操作系统用户下:chroot /mnt/sysimage,需要注意的是在进入单用户模式下,切换回原操作系统用户:chroot /sysroot/。切换后才能找到原系统下的相关目录和文件。切换后可以进行更改密码、更改配置文件等操作。