安裝ubuntu10.10後,如何配置一個Apache+MySQL+PHP環境

來源:互聯網
上載者:User

1、 Apache
$ sudo apt-get install apache2

2、Mysql
$ sudo apt-get install mysql-server

3、PHP
$ sudo apt-get install php5

4、MySQL for Apache PHP (通訊模板)
$ sudo apt-get install libapache2-mod-auth-mysql
$ sudo apt-get install php5-mysql

5、phpmyadmin
$ sudo apt-get install phpmyadmin

在安裝過程中,mysql 等均會提示設定root密碼。(別隨便添,要記住喲!)

 

安裝後
1、開啟 http://localhost 可以看到
It works!           表示apache正常運行

2、在終端輸入:sudo netstat -tap | grep mysql
tcp 0 0 localhost.localdomain:mysql *:* LISTEN -      表示mysql正常運行

3、
安裝完成之後預設網站根目錄是/var/www
,預設情況是只有root才有完全的讀寫權限的,所以我們需要讓自己對/var/www擁有管理員權限,在終端輸入:sudo chmod -R 777
/var/www      大功告成,可以正常順利的進行網站的讀寫操作了!

4、phpMyAdmin,會自動安裝在/usr/share/phpmyadmin下
在終端輸入 cp -r /usr/share/phpmyadmin /var/www      將phpmyadmin檔案複製到www檔案夾下   一定要注意大小寫哦,phpMyAdmin不行,linux大小寫敏感。
開啟 http://localhost/phpmyadmin                        開啟mysql管理介面。

ubuntu之使用phpmyadmin

(Linux+Apache+MySQL+PHP) structure on my Ubuntu machine. Installing the structure is pretty easy. But getting it all running seamlessly is the another thing. After installing the things I typed http://127.0.0.1 (http://localhost/) on my Browser and it said “It Works”. But when I tried to open the phpmyadmin (http://localhost/phpmyadmin/) which is used to manage your MySQL backend and tables it shows the 404 Not Found error.

By Default your www directory is created here /var/www and the phpmyadmin configuration files are stored in /usr/share/phpmyadmin. So the trick involved here is to point your the later location or directory from your former directory. To do this open your terminal and run the following command.

sudo ln -s /usr/share/phpmyadmin /var/www

This will create the pointer to /usr/share/phpmyadmin in /var/www

Now open the http://localhost/phpmyadmin/ and you are good to go. If you still face any problems feel free to ask and comment.

 卸載apache、php、mysql

一、卸載apache
1、sudo apt-get remove apache2
   sudo apt-get remove apache2.2-common
   sudo apt-get autoremove (此命令會自動卸載PHP)

強制卸載apche:
   sudo apt-get --purge remove apache-common
   sudo apt-get --purge remove apache

2、找到沒有刪除掉的設定檔,一併刪除
清除etc下的安裝檔案:
   sudo find /etc -name "*apache*" |xargs  rm -rf 
   或者
   sudo find /etc -name "*apache*" -exec rm -rf {} \;
   分別刪除apache2,apache2.2-common, apache2-mpm-work,apache2-utils,libapr1,

清除安裝包:
   #dpkg -l |grep apache2|awk '{print $2}'|xargs dpkg -P

清除工作目錄:
   sudo rm -rf /var/www

二、卸載php
   sudo apt-get remove php5 

三、卸載mysql
   sudo apt-get remove mysql-server mysql-server-5.1(根據自己ubuntu版本mysql 版本會不一樣)

   用whereis mysql查看mysql安裝在哪裡,然後把目錄清掉
   如:rm -fr /usr/lib/mysql等

注意:ln 大意是連結,和c++中到指標意思一樣

 

 

 

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.