用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 删除mysql
sudo apt-get autoremove mysql-server ubuntu 卸载apache2 php5
|
Apache配置多级域名
cd /etc/apache2/
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>
a2ensite education.bigtreechina.com.conf
激活成功后在/etc/apache2/sites-enabled/目录下就会出现这个文件,若是想disable某个site,能够用a2dissite
打开host文件:vi /etc/hosts
添加:127.0.0.1 education.bigtreechina.com
重启网络:sudo /etc/init.d/networking restart
sudo /etc/init.d/apache2 restart