ubuntu一鍵安裝LAMP 及一鍵卸載

用root帳號安裝php

用tasksel能夠方便安裝dns server, lamp, kubuntu desktop, ubuntu desktop, xubuntu之類的軟件包。
這個軟件在ubuntu server裏是預裝的,而在桌面版裏是不預裝的,想用的話得安裝一下: sudo apt-get install tasksel
用這個軟件的話就用命令:sudo taskselhtml

因爲tasksel在桌面版中沒有預裝,因此要先安裝mysql

直接安裝會出錯,解決辦法是先更新一下sql

sudo apt-get updateapache

安裝完tasksel以後就是開始安裝LAMPubuntu

一鍵安裝LAMP服務:sudo tasksel install lamp-server服務器

一鍵卸載LAMP:sudo tasksel remove lamp-server網絡

 

經過上面的命令卸載Lamp時難免把Linux系統自己的東西卸載掉了,所以,ide

在卸載LAMP後必定記着更新一下系統工具

sudo apt-get update

sudo apt-get upgrade

上面兩條都要執行



安裝lamp環境:
輸入命令 sudo tasksel install lamp-server , 便可完成LAMP的安裝。
經過命令 sudo tasksel 可查看LAMP安裝是否成功。須要指出的是,經過tasksel軟件包不只能夠安裝LAMP組件,還能夠安裝其餘服務器組件,好比DNS服務器,Mail服務器,打印服務器等。

經過命令 sudo apt-get install phpmyadmin 安裝MySQL管理工具phpmyadmin。
因爲phpmyadmin默認安裝在/usr/share/phpmyadmin,而不是/var/www下,因此只需在終端輸入 sudo ln -s /usr/share/phpmyadmin/ /var/www/ 便可解決。
而後經過命令 sudo /etc/init.d/apache2 restart 重啓Apache服務器。
若是要修改php.ini文件,則經過命令 sudo gedit /etc/php5/apache2/php.ini 編輯便可

ubuntu 卸載lamp  

ubuntu 刪除mysql

sudo apt-get autoremove mysql-server
sudo apt-get remove mysql-common

dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

ubuntu 卸載apache2 php5

一、sudo apt-get remove apache2
二、sudo apt-get remove apache2.2-common
三、sudo apt-get autoremove

主要用這個

aptitude purge apache2 apache2.2-common

find /etc -name "*apache*" -exec rm -rf {} \;

aptitude purge php5 php5-common

 

Apache配置多級域名

一、進入Apache2配置目錄 :

         cd  /etc/apache2/

二、進入site-available目錄建立新的site文件,建議文件名和二級域名同樣:好比education.bigtreechina.com

       cd sites-avaiable

       vi education.bigtreechina.com.conf

       而後輸入如下內容,並保存退出

<VirtualHost*:80>

    ServerAdmin education@qq.com

    DocumentRoot /var/www/html/education

    <Directory /var/www/html/education>

       Options ExecCGI FollowSymLinks

       AllowOverride all

       allow from all 

       Order allow,deny 

    </Directory>

    ServerName education.bigtreechina.com

    ErrorLog ${APACHE_LOG_DIR}/education.bigtreechina.com-error.log

    CustomLog ${APACHE_LOG_DIR}/education.bigtreechina.com-access.log combined

</VirtualHost>

四、激活site文件

         a2ensite  education.bigtreechina.com.conf

         激活成功後在/etc/apache2/sites-enabled/目錄下就會出現這個文件,若是想disable某個site,能夠用a2dissite

五、修改hosts

打開host文件:vi /etc/hosts

添加:127.0.0.1 education.bigtreechina.com

重啓網絡:sudo /etc/init.d/networking restart

六、重啓apache

sudo /etc/init.d/apache2 restart

相關文章
相關標籤/搜索