HOW TO: Install a development LAMP stack with minimal fuss

Discussion in 'Linux' started by 3ld468, Sep 8, 2008.

  1. 3ld468

    3ld468

    Joined:
    Aug 23, 2008
    Messages:
    24
    Likes Received:
    0
    Some have posted questions about running Apache and MySQL on the AA1. Basic installs of these two servers are present on standard, recently updated, Linux models but it seems to me that a lot of work would be needed to make a fully functioning LAMP server based on these foundations.
    I have been using MAMP on the Mac for a while which is a fully-featured stack that is completely independent of the web server that comes with Mac OS X client. I thought there must be something similar for Linux, and there is, XAMPP.
    Until recently it was called LAMPP but changed its name to reflect the fact that there are versions now for other platforms (make a note of that as it is referred to later).
    What follows is the story of how I became the proud owner of a development web server. It covers the installation and setting up to make a working system but I am sure that others with more Linux experience can suggest improvements.
    NOTE: I am assuming basic familiarity with Terminal here. This is not the place for command line tutorials.
    Installation: This is a 4 step process which is best described by the people at apachefriends . Choose the version Xampp Linux 1.6.7 and follow the instructions carefully. After that you should have a working server.
    Setting-up: Under the installation instructions you will see a section entitled 'A matter of security (A MUST READ!)'. Please do so. Then, still as root, call the security program, which runs in the terminal, and enter some passwords. The dialog starts something like this:-
    Code:
    LAMPP: Quick security check...
    LAMPP: Your LAMPP pages are NOT secured by a password.
    LAMPP: Do you want to set a password? [yes] yes
    LAMPP: Password: ******
    LAMPP: Password (again): ******
    LAMPP: Password protection active. Please use 'lampp' as user name!
    I think that the above password is optional but it depends on your paranoia level. I set it...
    Code:
    LAMPP: MySQL is accessable via network.
    LAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes] yes
    LAMPP: Turned off.
    LAMPP: Stopping MySQL...
    LAMPP: Starting MySQL...
    LAMPP: The MySQL/phpMyAdmin user pma has no password set!!!
    LAMPP: Do you want to set a password? [yes] yes
    LAMPP: Password: ******
    LAMPP: Password (again): ******
    LAMPP: Setting new MySQL pma password.
    LAMPP: Setting phpMyAdmin's pma password to the new one.
    I would certainly do both the above but...
    Code:
    LAMPP: MySQL has no root passwort set!!!
    LAMPP: Do you want to set a password? [yes] yes
    LAMPP: Write the passworde somewhere down to make sure you won't forget it!!!
    LAMPP: Password: ******
    LAMPP: Password (again): ******
    LAMPP: Setting new MySQL root password.
    LAMPP: Setting phpMyAdmin's root password to the new one.
    When I tried setting the MySQL root password here, phpMyAdmin could not connect to the database afterwards so I set it manually which I describe later on. In the meantime finish off this script...
    Code:
    LAMPP: The FTP password is still set to 'lampp'.
    LAMPP: Do you want to change the password? [yes] yes
    LAMPP: Password: ******
    LAMPP: Password (again): ******
    LAMPP: Reload ProFTPD...
    LAMPP: Done.
    Now for the MySQL password. Three things need to be done. Firstly, the user password needs to be set. If the local XAMMP homepage is not already open in Firefox, browse to http://localhost/ and click 'phpMyAdmin 'in the left menu to open it. In its left menu click 'mysql(17)', then 'user' and then click 'Browse' which is near the top of the right frame. Now click the pencil icon in the top row to edit 'localhost' 'user'. In the 'password' row, select 'PASSWORD' from the 'Function' menu and type your password in the 'Value' box. Click the 'Go' button at the bottom of the page and that's done.
    Secondly, the phpMyAdmin configuration file needs to be adjusted. Back in the Terminal call
    Code:
    mousepad /opt/lampp/phpmyadmin/config.inc.php
    and change the top lines of the file to look something like:-
    Code:
    <?php
    /*
     * This is needed for cookie based authentication to encrypt password in
     * cookie
     */
    $cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
    
    /*
     * Servers configuration
     */
    $i = 0;
    
    /*
     * First server
     */
    $i++;
    
    /* Authentication type and info */
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['host'] = 'localhost';/*this line needs to be added*/
    $cfg['Servers'][$i]['user'] = 'root';/**/
    $cfg['Servers'][$i]['password'] = '';/*<-put your password here*/
    Finally, restart XAMPP to effect the changes.
    Code:
    /opt/lampp/lampp restart
    There are a couple more things to do to reduce your reliance on the Terminal.
    First, you need to decide whether you want XAMPP to start on boot every time or be given the choice to start or not on boot. I have not found a way to interact with XAMPP from the desktop yet so your suggestions are welcome.
    To implement either choice you have to edit /etc/rc.d/slim/nowait.sh.
    As root:
    Code:
    mousepad /etc/rc.d/slim/nowait.sh
    For Always On function add the following line somewhere in the middle of the file:-
    Code:
    sudo /opt/lampp/lampp start 
    Note that it is lampp NOT xampp.(See earlier)
    There is a shell script which launches a control panel which allows you to turn on and off the whole server or its individual components called xampp-control-panel. Cor!
    To launch the script add this line:-
    Code:
    sudo /opt/lampp/share/xampp-control-panel/xampp-control-panel &
    The ampersand (&) at the end is important otherwise the boot process will wait until you close the panel. Now you can decide whether you want to start XAMPP or not and should you want the option to turn it on later, hide, do not close, the panel or you will have to resort to the Terminal or re-boot.
    Second, XAMPP defaults to PHP 5 so if your scripts only work with version 4 you need to add this line to nowait.sh after the 'lampp start' line if you have it set to always start on boot:-
    Code:
    sudo /opt/lampp/lampp php4
    I do not know a way of doing this after using the control panel other than using the command line.
    One more thing, the directory XAMPP looks in for web documents is /opt/lampp/htdocs which is not currently accessible to the user account. To make it so, while still as root, change the directory to be available to editors such as gedit by issuing the following command:-
    Code:
    chmod o+rw /opt/lampp/htdocs
    I should stress that this system should only be used for web development on the local machine. It is not suitable for production servers though why anybody would want to use an AA1 as a production server is beyond me.
    That is all. I hope it goes as well for you as it did for me.
    Cheers,
    Mike
    (Edited to expand on MySQL password setting.)
     
    3ld468, Sep 8, 2008
    #1
  2. 3ld468

    neomaximus2k

    Joined:
    Sep 15, 2008
    Messages:
    31
    Likes Received:
    0
    An additional feature would be to add a quicklaunch button on the taskbar by doing the following

    load up terminal by pressing alt + f2, type in terminal and press enter

    type in xfce4-panel -a

    double click on launcher

    Type in the name box "Localhost"
    type in the description "Load up the localhost window"
    click on the button that looks like a grey sun and select the network icon
    then in the command box type in "firefox http://127.0.0.1" or "firefox http://localhost" whichever notation you wish to choose from

    You can also expand on this to have a little menu but i'll post more on that another time
     
    neomaximus2k, Oct 7, 2008
    #2
  3. 3ld468

    kgingeri

    Joined:
    Aug 17, 2008
    Messages:
    8
    Likes Received:
    0
    Hey All,

    Have a look at Bitnami.org - they have a bunch of 'stacks' for various platforms.
    Single installs - some with control panels.

    kgingeri :)
     
    kgingeri, Nov 6, 2008
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.