如何查看系統(tǒng)版本
cat /etc/redhat-release
uname -r
[root@ywb ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@ywb ~]# uname -r
3.10.0-957.el7.x86_64
關(guān)于用戶
添加用戶/刪除用戶/切換用戶/查看用戶
[root@ywb ~]# useradd abc
[root@ywb ~]# su - abc
[abc@ywb ~]$ id
uid=1001(abc) gid=1001(abc) groups=1001(abc)
[abc@ywb ~]$ logout
[root@ywb ~]# userdel abc
[root@ywb ~]# su - abc
su: user abc does not exist
常見環(huán)境變量
PATH
PS1
export PS1="[[\e[34;1m]\u@[\e[0m][\e[32;1m]\H[\e[0m] [\e[31;1m]\w[\e[0m]]\$ "
關(guān)于shell編程
臨時修改
export PS1='[]'
永久修改
- 把臨時修改的內(nèi)容加到/etc/profile最后一行
- 執(zhí)行source /etc/profile 生效
- tail -2 /etc/profile 檢查
- 斷開連接生效
SELINUX
實際工作上不會使用,百分之八十的公司都會選擇關(guān)閉
文件路徑為 /etc/selinux/config
修改前先備份
臨時修改:(重啟服務(wù)器失效)
setenforce 0 配置
getenforce 查看
永久修改:(重啟服務(wù)器生效)
修改配置文件 vim /etc/selinux/config
把中間一行改成SELINUX=disabled
防火墻
CentOS6 中是iptables
CentOS7是firewalld
作用:根據(jù)設(shè)置規(guī)則 準(zhǔn)許/禁止用戶進出
是否開啟?
服務(wù)器有公網(wǎng)地址需開啟
沒有公網(wǎng)ip或者并發(fā)訪問量太高需關(guān)閉
如何關(guān)閉?
臨時:systemctl stop firewalld start 開啟
systemctl status firewalld 查看狀態(tài)
重啟服務(wù)器失效
永久:systemctl disable firewalld

配置yum源
yum源是一個軟件下載倉庫
國內(nèi)有阿里云 清華 等等
系統(tǒng)默認(rèn)源 base updates extras
如何修改yum源
打開阿里云鏡像
找到這個

如何增加epel源
打開阿里云鏡像找到這個
安裝這個

查看從哪個源下載的
yum repolist
目前常用軟件包
yum install -y tree vim nc nmap lrzsz wget bash-completion* cowsay sl htop iotop iftop telnet