李導(dǎo)排難解憂系列
01-老男孩教育-李導(dǎo)-Linux解惑系列
Linux應(yīng)用這么廣泛凰浮,學(xué)起來難不難寄猩?
新手面試Linux運維工作至少需要知道哪些知識點顺献?-
https://www.bilibili.com/video/av48981405
02-老男孩教育-李導(dǎo)-Linux解惑系列-自學(xué)還是培訓(xùn)淑掌?
https://www.bilibili.com/video/av48985870
老男孩教育-李導(dǎo)-手把手帶你玩轉(zhuǎn)物理服務(wù)器
https://www.bilibili.com/video/av46656120
手把手帶你繪圖1-億圖專業(yè)繪制原理圖超詳細實戰(zhàn)教程(限時免費)
https://edu.51cto.com/course/6173.html
老男孩教育-虛擬機無法上網(wǎng)/連接失敗常見原因大集合
http://www.reibang.com/p/0bc0b596c1a0
今日課程
1.查看系統(tǒng)版本信息
查看系統(tǒng)版本
[root@oldboyedu59 ~]# cat /etc/redhat-release /etc/centos-release
CentOS Linux release 7.6.1810 (Core)
CentOS Linux release 7.6.1810 (Core)
[root@oldboyedu59 ~]# ll /etc/redhat-release /etc/centos-release
-rw-r--r--. 1 root root 38 Nov 23 21:16 /etc/centos-release
lrwxrwxrwx. 1 root root 14 Mar 26 11:38 /etc/redhat-release -> centos-release
查看內(nèi)核版本
[root@oldboyedu59 ~]# uname -r
3.10.0-957.el7.x86_64
2.6.32 CentOS 6.x
[root@oldboyedu59 ~]# uname -m
x86_64
32位
i386 i686
passwd --stdin 用法
[root@oldboyedu59 ~]# echo 123456|passwd --stdin oldboy
Changing password for user oldboy.
passwd: all authentication tokens updated successfully.
環(huán)境變量:
1.系統(tǒng)設(shè)置 創(chuàng)建 顯示或配置系統(tǒng)特性
2.名字大寫
3.可以在linux下面隨處使用 一般含義一樣
常見的環(huán)境變量
UID 當(dāng)前用戶uid信息
PATH 存放的是命令的位置/路徑
[root@oldboyedu59 ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin === /sbin
/usr/bin === /bin
/root/bin
輸入ls 回車之后發(fā)生了什么廊佩?
1.系統(tǒng)會在PATH里面進行查找
2.存在 運行(命令解釋器)
3.不存在 提示 command not found
PATH
[root@oldboyedu59 ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
PS1 控制命令行格式
老男孩教育出品-PS1環(huán)境變量講解
https://www.processon.com/view/link/5a31efdbe4b03a96d02497af
修改環(huán)境變量過程:
1.臨時-重新登錄系統(tǒng)失效
export PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$ "
2.永久-寫入文件/etc/profile 與生效
[root@oldboyedu59 /etc/sysconfig]# tail -1 /etc/profile
export PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$ "
[root@oldboyedu59 /etc/sysconfig]# source /etc/profile
3.檢查
[root@oldboyedu59 /etc/sysconfig]# echo $PS1
[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$
關(guān)閉Selinux
操作前備份 操作后檢查
cp /etc/selinux/config /etc/selinux/config.bak
臨時:命令修改即可剔应。
永久:修改配置文件碎绎。
3 # SELINUX= can take one of these three values:
4 # enforcing - SELinux security policy is enforced.
5 # permissive - SELinux prints warnings instead of disabled.
6 # disabled - No SELinux policy is loaded.
7 SELINUX=enforcing
SELINUX=右邊可以寫什么
SELINUX=enforcing SELinux開啟
SELINUX=permissive SELinux關(guān)閉 還會有警告信息
SELINUX=disabled SELinux徹底關(guān)閉
[root@oldboyedu59 ~]# grep '=disabled' /etc/selinux/config
SELINUX=disabled
臨時
查看selinux狀態(tài)
[root@oldboyedu59 ~]# getenforce
Disabled
操作過程
[root@oldboyedu59 ~]# getenforce
Disabled
[root@oldboyedu59 ~]# setenforce
usage: setenforce [ Enforcing | Permissive | 1 | 0 ]
[root@oldboyedu59 ~]# setenforce 0
setenforce: SELinux is disabled
關(guān)閉防火墻
臨時關(guān)閉防火墻
[root@oldboyedu59 ~]# systemctl stop firewalld
[root@oldboyedu59 ~]#
[root@oldboyedu59 ~]#
[root@oldboyedu59 ~]#
[root@oldboyedu59 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
查看防火墻是否臨時關(guān)閉成功
systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active:active (running)這是重點 since Mon 2019-04-15 15:37:52 CST; 38s ago
Docs: man:firewalld(1)
Main PID: 2048 (firewalld)
CGroup: /system.slice/firewalld.service
└─2048 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Apr 15 15:37:51 lusanbao systemd[1]: Starting firewalld - dynamic firewall daemon...
Apr 15 15:37:52 lusanbao systemd[1]: Started firewalld - dynamic firewall daemon.
永久關(guān)閉防火墻
[root@lusanbao ~]# systemctl disable firewalld
[root@lusanbao ~]#
臨時啟動防火墻``
[root@wuxin-123 ~]# systemctl restart firewalld.service
** (pkttyagent:103429): WARNING **: 11:29:43.184: Unable to register authentication agent: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.106" (uid=0 pid=103429 comm="/usr/bin/pkttyagent --notify-fd 5 --fallback ") interface="org.freedesktop.PolicyKit1.Authority" member="RegisterAuthenticationAgentWithOptions" error name="(unset)" requested_reply="0" destination=":1.2" (uid=999 pid=6336 comm="/usr/lib/polkit-1/polkitd --no-debug ")
Error registering authentication agent: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.106" (uid=0 pid=103429 comm="/usr/bin/pkttyagent --notify-fd 5 --fallback ") interface="org.freedesktop.PolicyKit1.Authority" member="RegisterAuthenticationAgentWithOptions" error name="(unset)" requested_reply="0" destination=":1.2" (uid=999 pid=6336 comm="/usr/lib/polkit-1/polkitd --no-debug ") (g-dbus-error-quark, 9)
###/var/log/messages 報錯
Apr 15 11:34:36 wuxin-123 dbus[6339]: [system] Rejected send message, 1 matched rules; type="method_call", sender=":1.109" (uid=0 pid=103805 comm="/usr/bin/pkttyagent --notify-fd 5 --fallback ") interface="org.freedesktop.PolicyKit1.Authority" member="RegisterAuthenticationAgentWithOptions" error name="(unset)" requested_reply="0" destination=":1.2" (uid=999 pid=6336 comm="/usr/lib/polkit-1/polkitd --no-debug ")
###解決 發(fā)現(xiàn)切換用戶會卡主 重啟服務(wù)報錯
可能與系統(tǒng)用戶登錄服務(wù)有關(guān)重啟后 解決略步。
[root@wuxin-123 ~]# systemctl restart systemd-logind.service
[root@wuxin-123 ~]#
[root@wuxin-123 ~]#
[root@wuxin-123 ~]# su - oldboy
Last login: Mon Apr 15 09:27:22 CST 2019 on pts/1
[oldboy@wuxin-123 ~]$ logout
[root@wuxin-123 ~]#
[root@wuxin-123 ~]# systemctl restart firewalld
##查看已安裝的yum源
[root@oldboyedu59 ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
- base: mirrors.aliyun.com
- extras: mirrors.aliyun.com
- updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,019
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 385
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,511
repolist: 11,915
配置完成epel源之后完整 常用的軟件包
>yum install -y tree vim nc nmap lrzsz wget bash-completion* cowsay sl htop iotop iftop
>>bash-completion (base)
bash-completion-extras (epel)
今日回顧:
課前準備好虛擬機能正常上網(wǎng)。
每日回顧:
程序 進程 守護進程區(qū)別
如何查看進程
提升用戶體驗的方案
raid 0 1特點
什么是磁盤接口 常見的有什么接口
說出你服務(wù)器配置
什么是GNU GPL
上述復(fù)習(xí)完可以看
文件與目錄筆試題
http://www.reibang.com/p/d333f4f8dec8