Ubuntu Geek

Ubuntu Linux Tips,Howtos&Tutorials|Edgy,Feisty,Gutsy,Hardy

  • Subscribe RSS Feed

    subscribe to the ubuntu Geek RSS feed




  • Sponsor

  • Categories

  • Meta

  • Sponsor

  • Archives



  • WidgetBucks - Trend Watch - WidgetBucks.com

Install the LAMP stack with 3 commands!

Posted by James House on August 8th, 2007 Email This Post Email This Post

For this article, I’ll assume that you already have Ubuntu installed. It’s one of the easiest distro’s out there to install, ranking right up there with Fedora and Suse. After installation is complete, and you log in for the first time, you’ll most likely be prompted to install updates. Install these updates and reboot before continuing. Typically, you don’t need to reboot after an update, but just in case you updated your kernel, go ahead and do it.

Now, let’s get to it.

Open a terminal window and run the following commands:

sudo apt-get install apache2 mysql-server php5 libapache2-mod-php5 php5-xsl php5-gd php-pear libapache2-mod-auth-mysql php5-mysql

sudo sed -i ’s/; extension=mysql.so/extension=mysql\.so/g’ /etc/php5/apache2/php.ini

#That’s a series of 3 spaces after ’s/;

sudo /etc/init.d/apache2 restart

Reboot and you’re done!

What do those commands do? Well, the first one installs all of the packages needed. The second one uses sed to remove the semicolon (which denotes a comment) from the php config file, thus allowing php to work with mysql. The third one simply restarts apache.

In the above commands, there should only be 3 lines. Your display settings may cause the commands to span more than 3 lines. If so, just copy and paste line by line. Each command begins with sudo.

If you want to be notified the next time we write something please subscribe to our RSS feed.Thanks for Visiting!

Related Articles

10 Responses to “Install the LAMP stack with 3 commands!”

  1. Mark Preston Says:

    James:

    Why don’t the three (3) spaces show in the line on this page?

    sudo sed -i ’s/; extension=mysql.so/extension=mysql\.so/g’ /etc/php5/apache2/php.ini

    using my cursor, I can move only ONE space between -i ’s/; extension . . .

    Please clariy.

  2. Zorro Says:

    Non-breaking Space
    The most common character entity in HTML is the non-breaking space.

    Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the   character entity.

    the text below will give you an example (paste it in a test.html file and try it out):

         these are 4 spaces by using ‘    ’

  3. Zorro Says:

    @Mark,

    Non-breaking Space
    The most common character entity in HTML is the non-breaking space.

    Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the   character entity.

    the text below will give you an example (paste it in a test.html file and try it out):

         these are 4 spaces by using ‘    ’

    Z:-)

  4. i5513 Says:

    ‘\.’ should be used into regular expresion on sed.

    Better:
    sudo sed -i ’s/; extension=mysql\.so/extension=mysql.so/g’ /etc/php5/apache2/php.ini

  5. smoovb Says:

    smoovb@s3rv3r:~$ sudo sed -i ’s/; extension=mysql\.so/extension=mysql.so/g’ /etc/php5/apache2/php.ini
    sed: -e expression #1, char 1: unknown command: `
    bash: /etc/php5/apache2/php.ini: Permission denied

    I get this error when I try to use the second command. In addition, I tried the command with 3 spaces after “’s/;” and receive the same results.

    Any suggestions?

  6. James House Says:

    I don’t know why the sed command isn’t working for you.
    Try this instead… it’s just a few more steps.
    sudo nano /etc/php5/apache2/php.ini

    Type CTRL-W to search. Search for extension=mysql.so
    Remove the leading semicolon.
    CTRL-X to exit, save the changes.
    Then, sudo /etc/init.d/apache2 restart
    to restart Apache.

  7. Thomas Says:

    Why does the user have to reboot? If the services are up, there’s no point in doing this…you must be too used to Windows.

  8. James House Says:

    Yeah, you caught me. That must be it. :-)

  9. Jo-Erlend Schinstad Says:

    You can use tasksel for that. If you’ve ever done an installation from the server cd or dvd, then you’ll have noticed it. It’s the part that lets for choose LAMP, DNS, etc. Install and run it, and you’ll get some choices, like LAMP, DNS, Edubuntu server, etc.

  10. Fabio Says:

    I think in Apache 2 you don’t need the second command, it seems to work without that substitution.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>