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++中到指针意思一样