如何在Ubuntu上面安装LAMP环境
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |

大家都知道LAMP是一组开源软件的集合体,用来作为网站服务器的生产环境,这里简单的告诉大家如何在当前流行的Linux发型版本Ubuntu上面安装LAMP环境。
第一步:安装Apache
先更新一下还是有必要的对吧?
sudo apt-get update
sudo apt-get install apache2
就这么简单,完了!检查一下是不是安装成功:直接在浏览器里面输入VPS的IP看看,是不是有”“It works!"“类似的东西出现?有,那就可以了!
不知道自己的ip? 试试:ifconfig eth0 | grep inet | awk '{ print $2 }'
第二步:安装MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
在MySQL安装期间会让你输入MySQL的root密码,如果你错过了那也没关系后面可以在shell里面修改。
启动MySQL: 安装完成后我们输入sudo mysql_install_db 就启动了
技术MySQL的设置脚本:
sudo /usr/bin/mysql_secure_installation
接下来提示让你输入root密码:
Enter current password for root (enter for none):
OK, successfully used password, moving on...
接下来会提示你是否需要修改密码,我么这里选择N,继续下面的步骤。接下来就是最简单的输入yes和no了,知道MySQL重启:
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
上面这就完成了MySQL,接下来我们来搞PHP。
第三步,安装PHP
输入 sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
接下来在提示让你两次确定YES后,PHP就自己开始安装了。
设置个PHP目录下的default 文件也许对你有用(非必须)
sudo nano /etc/apache2/mods-enabled/dir.conf
加入:
Direc"不可描述"yIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
PHP有很多有用的组件什么的可以帮你:
输入
apt-cache search php5-
接下来会显示一大堆,大概像这样:
hp5-cgi - server-side, HTML-embedded scripting language (CGI binary)
php5-cli - command-line interpreter for the php5 scripting language
php5-common - Common files for packages built from the php5 source
php5-curl - CURL module for php5
php5-dbg - Debug symbols for PHP5
php5-dev - Files for PHP5 module development
php5-gd - GD module for php5
php5-gmp - GMP module for php5
php5-ldap - LDAP module for php5
php5-mysql - MySQL module for php5
php5-odbc - ODBC module for php5
php5-pgsql - PostgreSQL module for php5
php5-pspell - pspell module for php5
php5-recode - recode module for php5
php5-snmp - SNMP module for php5
php5-sqlite - SQLite module for php5
php5-tidy - tidy module for php5
php5-xmlrpc - XML-RPC module for php5
php5-xsl - XSL module for php5
php5-adodb - Extension optimising the ADOdb database abstraction library
php5-auth-pam - A PHP5 extension for PAM authentication
[...]
一旦你选定你需要安装的模块的话你只要输入类似这样的命令:
sudo apt-get install name of the module
你可以一次安装一个或者多个组件。
还想继续?没了!
第四步,在服务器上查看自己的PHP信息
创建个文件:sudo nano /var/www/info.php,在里面添加:
保存退出!
接下来重启Apache:
sudo service apache2 restart
在:http://ip/info.php下就能看到你需要和缺少的东西了!
真没了!
[lamp]历史优惠活动内容
猜你可能想看的VPS
- js 随机数生成方法大全全球[VPS测评]
- PHP 国家及地区代码数组全球[VPS测评]
- ShockHosting→3.74 美元 KVM 1G 150G 1TB全球[VPS测评]
- 腾讯云→国内云服务器年付 99 元起 单核 2G2M 三年仅 680 元全球[VPS测评]
- 腾讯云秒杀→双核 4G6M 三年 1499 元 单核 2G2M 三年仅 全球[VPS测评]
- 便宜 VPS $11.99 年 1G 内存 15G SSD 1.5T 流全球[VPS测评]
- DogYun→香港云服务器按小时计费 25.27 元 月起(0.0351香港VPS[主机]
- Krypt 新平台 KVM 月付 5 美元起 年付 5 折 洛杉矶 CN全球[VPS测评]
- 云创网络→55.2 元 月 512MB 内存 10GB SSD 空间 1虚拟空间(主机)
- javascript 除法结果取整的四种方法全球[VPS测评]
- 便宜 $18 年 2 核 CPU 2G 内存 25G SSD 3T 流量全球[VPS测评]
- 国外稳定优秀知名云主机商列表及部分简评全球[VPS测评]
- UOvZ 劳动节促销,泉州 cn2 大带 vps 七折,100M 独享三独立服务器[U]
- 代码实现类似大前端DUX WordPress主题评论列表显示楼层全球[VPS测评]
- WordPress插件:有字库插件美化文章标题和内容全球[VPS测评]
- Google Voice 自动回复短信保号一键脚本,防止谷歌收回全球[VPS测评]
- DigitalVirt 美国洛杉矶 四网9929 VPS 测试美国VPS[主机]
- HostLAB-2$ 月 土耳其 1G内存20G硬盘 1Gbps@不限流全球[VPS测评]
- 适合美容院的正能量抖音文案,唯美阳光,正能量满满全球[VPS测评]
- 香港云服务器的优势有哪些方面香港VPS[主机]
- SEO和网页加载速度有关系吗?如何提升?全球[VPS测评]
- SugarHosts:虚拟主机三折起,VPS五折起,续费也可以享受优惠全球[VPS测评]
- 2.45亿、成都公安(大数据基座-服务器)采购:神码、虹信、海康、超聚变全球[VPS测评]
- 冀青云怎么样?香港CN2-GIA vps月28元/香港NTT 月9元香港VPS[主机]
- 阿里云香港服务器多少钱一年?阿里云香港云服务器如何购买?香港VPS[主机]
- 原创解析:云计算含义及定义全球[VPS测评]
- 桔子数据怎么样?美国、香港CN2云服务器2核2G10M带宽仅480元/年美国VPS[主机]
- 微基主机:1核1G香港云服务器,100Mbps/香港CN2直连/KVM/香港VPS[主机]
- ExCloud:1核256M存/8GB SSD空间/100GB流量/OV虚拟空间(主机)
- 精编案例丨游戏行业转型升级迫在眉睫,云计算助力打造下一代游戏体验全球[VPS测评]
转载请注明原文地址:http://140.238.13.167:12355/read-7285.html











