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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM