1.yum
yum install tree
yum install telnet
直接安装与更新
2.查询软件是否装上
rpm -qa tree telnet
3.查询软件包的内容
rpm -ql tree telnet
4.tree
tree -L 1 /
5.挂载光盘
①插入光盘
②挂载光盘
挂载----给设备创建一个入口
mount /dev/cdrom /mnt/
ls Packages/ |head (前十行)
tail 后
装 rpm -ivh /mnt/Packages/tree
6.df -h 查看磁盘与光驱
7.yum源
增加yum源 epel 源
①阿里云 http://mirrors.aliyun.com/
②yum install epel-release -y
③yum install sl cowsay -y
2.关闭iptables和
iptables
1.临时关闭防火墙重启后失效
/etc/init.d/iptables stop
2.永久关闭防火墙
开机自启动
chkconfig
chkconfig |grep iptables
3上是on就是自动运行
关闭iptables
chkconfig iptables off
运行级别
0. 关机状态
1. 单用户模式 重新设置root密码 √
2. 多用户模式 没有NFS(存储)
3. 完全的多用户模式 命令行模式 文本模式 √
4. 未被使用的
5. 桌面模式 图形界面模式 √
6. 重启状态
查询系统的运行级别
runlevel
tail -1 /etc/inittab
如何进入单用户模式
为了解决用户root密码忘记
如何进入救援模式
resuce installed system
切换系统的运行级别
init 4
查看系统版本
cat /etc/redhat-release
uname -r
用户操作
useradd ldq
passwd ldq112
su - ldq
ctrl + d/logout 退出当前用户
关机
shutdown -r 10
shutdown -c
SELinux 的关闭
1.永久关闭
sed 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
sed -i.bak 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
grep 'disabled' /etc/selinux/config
上个命令的最后的参数
esc + .
查看当前SELinux状态
getenforce
setenforce
时间查看与修改
date -s '20180101'
ntpdate ntpl.aliyun.com
定时任务
crontab -l #list
crontab -e #edit
1.具体时间
2.做什么事
00 00 * * * go to bed
30 08 * * * go to shool
特殊符号
* 每
怎么做
1.命令
2.写入定时任务
tail -f /tmp/oldboy.txt
查看定时任务日志
上传与下载
rpm install
rz 上传到Linux
sz 下载到Windows
unzip secure-20161219.zip
查看日志
less f或空格下一页 b上一页
head /tail
grep '关键字' secure
nginx
Linux的启动流程
1.BIOS自检(检测硬件是否有损坏)
2.MBR引导(导入系统硬盘)
3.GRUB菜单(选择不同内核,进入单用户)
4.加载内核,放入内存
5.运行init进程
6.读取配置文件
7.运行脚本
8.运行开机自启动脚本
9.启动mingetty
http请求与相应的过程
1.请求起始行 get
2.请求头
3.空行
4.请求主体
1.相应的起始行 响应的状态码
2.响应头
3.空行
4.响应主体
访问
curl www.baidu.com
curl - v 请求与响应的过程
编译安装前的准备
1.添加一个用户
[root@oldboyedu-s6 nginx-1.12.2]# useradd -s /sbin/nologin -M www
[root@oldboyedu-s6 nginx-1.12.2]# id www
uid=501(www) gid=501(www) groups=501(www)
[root@oldboyedu-s6 nginx-1.12.2]# su - www
su: warning: cannot change directory to /home/www: No such file or directory
This account is currently not available.
2.安装依赖包
#pcre-devel Perl语言兼容正则表达式
#openssl-devel https
yum install pcre-devel openssl-devel -y
3.编译安装
./configure --user=www --group=www --prefix=/application/nginx-1.12.2 --with-http_stub_status_module --with-http_ssl_module
make
make install
4.启动
/application/nginx-1.12.2/sbin/nginx
5.修改配置文件
cd /application/nginx-1.12.2
egrep -v '^$|#' conf/nginx.conf.default >conf/nginx.conf
#优雅的重启nginx √√√√√√
/application/nginx-1.12.2/sbin/nginx -s reload
#关闭nginx 然后开启
/application/nginx-1.12.2/sbin/nginx -s stop
/application/nginx-1.12.2/sbin/nginx
echo $? 查看上次命令的错误代码