CentOS7.X更新yum源;nginx安装,启动,彻底删除与查看

1. 备份原来的yum源

$sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo-backup

2.设置aliyun的yum源

$sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3.添加EPEL源

$sudo wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo

 

4.清理缓存,生成新缓存,执行yum系统更新

$sudo yum clean all

$sudo yum makecache

$sudo yum update(可选)

------------------------------------------------------------------------------------------------------------------------------------------
1,安装nginx
yum install nginx -y

2,nginx使用
systemctl start nginx.service systemctl stop nginx.service systemctl reload nginx.service systemctl status nginx.service

 3.删除Nginx的自动启动

 chkconfig nginx off

 4.从源头删除Nginx

 rm -rf /usr/sbin/nginx

 rm -rf /etc/nginx

 rm -rf /etc/init.d/nginx

 5.再使用yum清理

 yum remove nginx

 6,端口查看

   命令2:netstat -antp | grep :80(查看80端口被哪个服务占用)or netstat -antpuel  | grep ":22" | grep  -v grep(过虑grep本身)
   命令3:netstat -antp | grep :(查看所有端口占用情况)
 命令4:ps aux | grep nginx(查看nginx进程运行状态)or ps aux | grep :80 | grep -v grep(过虑grep本身)

 7、杀掉进程命令
    a)相关nginx进行全部杀掉:killall -9 nginx  
    b)把PID两个进程杀掉:kill -9 pid1 and kill -9 pid1


 8、查看版本
   命令:nginx -V

 

posted @ 2019-12-05 09:13  Miraclexu  阅读(788)  评论(0)    收藏  举报