用root账号安装
用tasksel可以方便安装dns server, lamp, kubuntu desktop, ubuntu desktop, xubuntu之类的软件包。
这个软件在ubuntu server里是预装的,而在桌面版里是不预装的,想用的话得安装一下: sudo apt-get install tasksel 用这个软件的话就用命令:sudo tasksel由于tasksel在桌面版中没有预装,所以要先安装
直接安装会出错,解决办法是先更新一下
sudo apt-get update
安装完tasksel之后就是开始安装LAMP
一键安装LAMP服务:sudo tasksel install lamp-server
一键卸载LAMP:sudo tasksel remove lamp-server
通过上面的命令卸载Lamp时不免把Linux系统本身的东西卸载掉了,因此,
在卸载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 -Pubuntu 卸载apache2 php5
|
Apache配置多级域名
1、进入Apache2配置目录 :
cd /etc/apache2/
2、进入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>
4、激活site文件
a2ensite education.bigtreechina.com.conf
激活成功后在/etc/apache2/sites-enabled/目录下就会出现这个文件,如果想disable某个site,可以用a2dissite
5、修改hosts
打开host文件:vi /etc/hosts
添加:127.0.0.1 education.bigtreechina.com
重启网络:sudo /etc/init.d/networking restart
6、重启apache
sudo /etc/init.d/apache2 restart