如何在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
- nexusbytes→大硬盘 VPS $38 年 KVM 512m 内存全球[VPS测评]
- INXY→提供 Leaseweb ahCDN UCDN Highwind香港VPS[主机]
- 直连推荐 €23.8 月 8 核 CPU 4G 内存 120G SSD 香港VPS[主机]
- 真实测评 九互联→宿迁机房高防超集主机测评数据全球[VPS测评]
- 疯狂猜成语 图猜成语一匹马奔向成功是什么成语?全球[VPS测评]
- 疯狂猜成语 图猜成语一个人在搬一块很大的石头是什么成语?全球[VPS测评]
- GeorgeDatacenter→$5 月 1GB 内存 25GB SS虚拟空间(主机)
- bootstrapTable 设置行样式(背景颜色)全球[VPS测评]
- 搬瓦工 美国洛杉矶高质量 CN2 全线补货,1G-10G 口 GIA 带美国VPS[主机]
- 超值! CCleaner Pro 5折促销 折后仅98.02元全球[VPS测评]
- 恒创科技 新用户优惠 香港CN2 GIA线路 1G内存 50g硬盘 2M香港VPS[主机]
- 极云RivenCloud 东京CN2 GIA线路 1G内存 30M小带宽全球[VPS测评]
- LOCVPS上新澳洲悉尼机房VPS,月付29元起,联通CU2电信CN2全球[VPS测评]
- Linveo-欧洲 北美 日本 新加坡 韩国云VPS 6$月付 1g内存日本VPS[主机]
- HKSS 2G 内存 20G SSD 2T流量 100M带宽 香港 Ce香港VPS[主机]
- HTML5绿色有机食品电商网站模板 - Organtio全球[VPS测评]
- 消费复苏形势良好,我们将多措并举实施扩大内需政策全球[VPS测评]
- sugarhosts首推DECADE云服务器,香港云服务器,1核512M香港VPS[主机]
- Aoyohost:1核1GB/20GB/600GB流量/60Mbps端口香港VPS[主机]
- 景林网络:香港CN2vps,1核1G3M月付35元;美国高防vps,48美国VPS[主机]
- 华凯易佰同比扭亏跨境电商行业回暖H2旺季将至|中报追踪全球[VPS测评]
- 八成企业看好出海投资 防止“溺水”需重视这一点全球[VPS测评]
- 人们为啥不爱吃海底捞了?海底捞上半年亏损达2.97亿 网友神评扎心全球[VPS测评]
- 腾讯云限时秒杀改版:轻量应用服务器2核4G8M仅598元/年,增香港/新香港VPS[主机]
- 消费复苏形势良好,我们将多措并举实施扩大内需政策全球[VPS测评]
- 初忆云:香港美国cn2云服务器30元;香港cn2高防vps30元,美国1美国VPS[主机]
- 福州职业技术学院获得世界职业院校技能大赛云计算赛项银牌全球[VPS测评]
- 详细介绍vps云服务器及其作用全球[VPS测评]
- 播放量破千万,点赞量破百万,你绝对想不到这三款多功能产品居然在TK上卖爆全球[VPS测评]
- 野草云:2021开年大促 – 香港VPS 136.8元年起;香港服务器3香港VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-7285.html











