ubuntu lamnp 环境的安装/卸载 及 配置

安装mysql
--------------------------------------
sudo apt install mysql-server   #5.7版本

安装php
--------------------------------------
sudo apt install php   #php7.0版本

安装nginx
---------------------------------------
sudo apt install nginx   #nginx/1.10.0
service nginx start       #启动nginx
service nginx -s reload  #重启
打开配置文件 /etc/nginx/nginx.conf   #https://www.nginx.com/resources/wiki/start/topics/examples/full/

server{
        listen 80;
        root /home/x/www/mayibang.local/public;
        server_name mayibang.local admin.mayibang.local bbs.mayibang.local;
        location / {
                index index.html index.php;
                try_files $uri $uri/ =404;
                if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx)$){
                        add_header Content-Disposition: 'attachment;';
                }
        }
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }
}

 



一、卸载删除 mysql 

1 sudo apt-get autoremove --purge mysql-server-5.0
2 sudo apt-get remove mysql-server
3 sudo apt-get autoremove mysql-server
4 sudo apt-get remove mysql-common (非常重要)
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
sudo find /etc -name "*mysql*" |xargs  rm -rf 
最后用 dpkg -l | grep mysql 检查,如无返回即干净卸载
 
 
二、卸载删除apache 
sudo apt-get --purge remove apache-common
sudo apt-get --purge remove apache
sudo find /etc -name "*apache*" |xargs  rm -rf 
sudo rm -rf /var/www
sudo rm -rf /etc/libapache2-mod-jk
sudo rm -rf /etc/init.d/apache2
sudo rm -rf /etc/apache2
dpkg -l |grep apache2|awk '{print $2}'|xargs dpkg -P
删除svn
sudo apt-get remove subversion
sudo apt-get remove libapache2-svn 
最后用 dpkg -l | grep apache 和 dpkg -l | grep apache2检查,如无返回即干净卸载
 
 三、卸载删除php 
sudo apt-get –purge remove libapache2-mod-php5 php5 php5-gd php5-mysql
sudo apt-get autoremove php5 
删除关联,
sudo find /etc -name "*php*" |xargs  rm -rf 
清楚残留信息
dpkg -l |grep ^rc|awk ’{print $2}’ |sudo xargs dpkg -P
最后用 dpkg -l | grep php 和dpkg -l | grep php5 检查,如无返回即干净卸载
posted @ 2017-02-20 17:42  geek程序员  阅读(534)  评论(0编辑  收藏  举报