红联Linux门户
Linux帮助

Ubuntu LAMP 详细配置说明(适合新人)

发布时间:2011-08-14 19:20:35来源:红联作者:synw
[i=s] 本帖最后由 synw 于 2011-8-14 19:47 编辑 [/i]

声明:本人也是新手,下面的配置适合第一次配置 LAMP 环境的朋友,希望对大家有所帮助,我的 UBUNTU 顺利通过,但不保证其它的一定也通过,不过我还是推荐大家使用这个配置,很不错!

以下的红色加粗字体,是在 Ubuntu Linux 下的终端(Terminal)下输入的,请新人朋友注意哈~~~

因为原文是英文,本人的英文水平也是个二把刀,翻译能力有限,不过大概意思应该不会有太大的出入,嘿嘿,文章保留原文


[font=Verdana]Step 1: You start by installing mysql (第一步:开始安装 mysql)[/font]
[/size]
[font=Verdana][size=16px]sudo apt-get install mysql-client mysql-server [/font]

[/size]
[font=Verdana][size=16px]Specify new password for the MySQl “root” user when prompted. Repeat it for a second time and you would have MySQL server and client installed.
[/font]
[/size]
指定新的MySQL“root”用户的密码提示,重复输入密码,你必须安装MySQL服务器和客户端。

[size=3]

[font=Verdana]Step 2: Next, install Apache2: (第二步:安装 Apache2)[/font]
[/size]
[font=Verdana][size=16px]sudo apt-get install apache2
[/font]
[/size]
[font=Verdana][size=16px]And you get apache2 installed as well. To double check, point your browser to
[/font][font=Verdana]http://localhost[/font][font=Verdana], and you should see the Apache2 placeholder page like this.[/font]
[/size]



[font=Verdana][size=16px]Step 3: To install support for PHP, do the usual
[/font]
[/size]
[font=Verdana][size=16px]sudo apt-get install php5 libapache2-mod-php5[/font]

[/size]
[font=Verdana][size=16px]To verify that everything installed correctly and php support is enabled, you need torestart apache by doing this
[/font]
[/size]
[font=Verdana][size=16px]sudo /etc/init.d/apache2 restart[/font]

[/size]
[font=Verdana][size=16px]---------------------------------------------------------------------[/font]
[font=Verdana]在重启的过程中如果提示:Could not reliably determine the server’s fully qualified domain name[/font]
[font=Verdana]在ubuntu的终端(Terminal)输入[/font]
[font=Verdana]
   sudo gedit /etc/apache2/apache2.conf
[/font]

[font=Verdana]在文件的底部添加下面一行:
   [color=purple]ServerName LocalHost
然后重新启动apache2
   [/color]sudo /etc/init.d/apache2 restart
[/font]
[font=Verdana][b][font=Verdana][size=16px]---------------------------------------------------------------------[/font][/size][/font][/b][font=Verdana]

[/font]
[font=Verdana]Create a test php file called info.php, using a text editor of your choice (say gedit)[/font]
[/size]
[font=Verdana][size=16px]sudo gedit /var/www/info.php
[/font]
[/size]
[font=Verdana][size=16px]and paste the following content and save the file
[/font]
[/size]
[font=Verdana][size=16px]
[/font]
[/size]
[font=Verdana][size=16px]Now open the following page
[/font][font=Verdana]http://localhost/info.php[/font][font=Verdana]and you should see something like this[/font]




[font=Verdana]Step 4: To make MySQL, php and apache talk among themselves, you would have to install php5-mysql, below I am listing some more useful packages that you might want to install[/font]


[font=Verdana]sudo apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-common[/font]
[/size]
[font=Verdana][size=16px](注:这是一条书写完整的命令,全部输入在终端,然后执行)[/font]

[font=Verdana]Now refresh the info.php page that you have open in your browser and you should be able to see the support for mysql if you search for it by doing Ctrl+f, but before that don’t forget to restart apache again (sudo /etc/init.d/apache2 restart)[/font]
[/size]


[font=Verdana][size=16px]Step 5: Finally install phpmyadmin
[/font]

[font=Verdana]sudo apt-get install phpmyadmin[/font]
[/size]
[font=Verdana][size=16px]It would ask if you want to configure it automatically for apache or lightppd choose apache (by pressing “spacebar” to display a star as shown below and then use tab to navigate to Ok and press
[/font]
[font=Verdana]enter.[/font][font=Verdana]
[/font]
[font=Verdana]It would be automatically configured, however it would ask if you want a database installed and configured, choose yes and press enter[/font]
[/size]


[font=Verdana][size=16px]On the next screen you would be asked to enter the MySQL root password, that you provided in first step
[/font]
[/size]

[font=Verdana][size=16px]
[/font]
[font=Verdana]next it would ask you to enter a password to be used by phpmyadmin to register with thedatabase (basically it would create a user called “phpmyadmin” the password is for that, most likely you won’t be needing this password ever. You can even choose to assign a random password for it.[/font]


[font=Verdana][/size][/font]
[font=Verdana][size=16px]Confirm that password on the next screen. Once you have made your choices the installation would finish and you should be able to access phpmyadmin by pointing your web browser to
[/font][font=Verdana]http://localhost/phpmyadmin/[/font]
文章评论

共有 6 条评论

  1. software_data 于 2011-10-03 18:04:11发表:

    正在找这个呢

  2. vamxiaomi 于 2011-09-26 11:01:44发表:

    好吧 学习..

  3. ryanlunar 于 2011-09-22 14:29:43发表:

    为什么 俺最后一步
    Not Found
    The requested URL /phpmyadmin/ was not found on this server.

    Apache/2.2.17 (Ubuntu) Server at localhost Port 80

  4. synw 于 2011-08-15 12:21:49发表:

    哈哈,希望对大家有所帮助哈,操作中有问题,给我留言

  5. D调漫步 于 2011-08-15 09:14:21发表:

    学习学习

  6. opius 于 2011-08-15 08:43:44发表:

    顺路学学