debian php mysql 安装_在 Debian 下安装 Apache,MySQL,PHP
我是轉(zhuǎn)載過來的,原地址?http://blog.csdn.net/youngdze/article/details/20455557 ,我安裝成功!
首先,對(duì)你的源進(jìn)行更新:
$?sudo?apt-get?update
第一步--安裝 Apache
Apache 是一個(gè)開源軟件,它目前運(yùn)行在全球超過 50% 的服務(wù)器上,是 LAMP(Linux,Apache,MySQL,PHP)組成部分之一。
安裝 Apache:
$?sudo?apt-get?install?apache2
安裝完成后可以在瀏覽器地址欄輸入?http://localhost/,安裝成功會(huì)有一個(gè) It works 頁面。
可以通過以下命令找到你的服務(wù)器的 IP 地址:
$?sudo?ifconfig?eth0?|?grep?inet?|?awk?'{?print?$2?}'
第二步--安裝 MySQL
MySQL是用于組織和檢索數(shù)據(jù)的廣泛部署的數(shù)據(jù)庫管理系統(tǒng)。
安裝 MySQL:
$?sudo?apt-get?mysql-server
在安裝過程中,MySQL 要求你設(shè)置一個(gè) root 密碼,不過你要是忘了設(shè)置,也可以在安裝之后通過 MySQL shell 設(shè)置。
安裝完成 MySQL 后你需要進(jìn)行 MySQL 的初始設(shè)置,利用以下命令:
#?mysql_secure_installation
這步會(huì)要求你的 root 密碼。
輸入之后會(huì)是這樣的:
Enter?current?password?for?root?(enter?for?none):
OK,?successfully?used?password,?moving?on...
之后會(huì)提示你是否想修改 root 密碼,輸入 N 不修改,Enter 進(jìn)入下一步。
之后的步驟全部 Yes ,最后 MySQL 會(huì)重載使得設(shè)置完成,如下:
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...
完成以上步驟后你就可以開始安裝 PHP。
第三步--安裝 PHP
PHP 是種開源的 Web 腳本語言,并被廣泛應(yīng)用來制作動(dòng)態(tài)網(wǎng)頁。
安裝 PHP (Debian 7 以下):
#?apt-get?install?php5?php-pear?php5-suhosin?php5-mysql
安裝 PHP (Debian 7 ):
#?apt-get?install?php5?php-pear?php5-mysql
接下來將會(huì)有兩次詢問,全部 yes 即可。
完成 PHP 安裝后,重載 Apache:
#?service?apache2?restart
恭喜!你已經(jīng)成功安裝 LAMP!
第四步--在你的服務(wù)器上查看 PHP 版本等信息
雖然我們已經(jīng)安裝了 LAMP ,但我們還是需要更直觀一點(diǎn)查看安裝成功的 LAMP。
首先創(chuàng)建一個(gè)文件:
#?nano?/var/www/info.php
在新文件寫下:
phpinfo();
?>
之后保存退出。
現(xiàn)在你可以在瀏覽器中輸入?http://localhost/info.php 查看 PHP 版本等信息,頁面如下面這樣:
總結(jié)
以上是生活随笔為你收集整理的debian php mysql 安装_在 Debian 下安装 Apache,MySQL,PHP的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 手机动态壁纸下载安卓版(手机动态壁纸下载
- 下一篇: airflow mysql_Airflo