JakeMakes

Git Good @ Tech

Raspberry Pi LAMP , FTP , PhpMyAdmin setup.

  1. First install the apache2 package by typing the following command into the terminal:
    sudo apt-get install apache2 -y
    Test the install with browser by going to http://YOUR_PI_IP/ (examp. http://192.168.1.110). More about networking read here. You should see the following page:
  2. Install the PHP and Apache packages with the following command:
    sudo apt-get install php5 libapache2-mod-php5 -y
    To test the install navigate to your html folder with: cd /var/www/html command. Next create/open file:
    sudo nano index.php
    And paste the following to the file:
    <?php echo "hello world"; ?> Next Ctrl+X and Y to save.
    Now navigate your browser to http://YOUR_PI_IP/index.php and it will display “hello world” text on the page.
  3. For MySQL and PHP-MySQL run following command:
    sudo apt-get install mysql-server php5-mysql -y
    In the installation process you will be prompted  the MySQL root password select so insert your password you wish to use to access the
    MySQL as root user
  4.  Now restart Apache:  sudo service apache2 restart
    And check that MySQL works with:  /etc/init.d/mysql status Result should look something like this:
  5. Next up.. PhpMyAdmin. Run:
    sudo apt-get install phpmyadmin
    The package will begin installing. You will be asked which web server is installed, choose apache2.
  6. Configure for dbconfig-common. You will be prompted the following window:Press Enter/Yes.
    Next you’ll be asked for an administrative password, this is the root password that was set during the MySQL installation on step 3.
    You’ll be asked to set a password for PhpMySQL. I’ve used the same password as the MySQL root password, but its up to you what you set here.
    Make a note of it somewhere.
  7. Configure Apache to work with PhpMyAdmin
    We need to alter the Apache configuration in order to access PhpMyAdmin. To do this, enter the following command to alter the configuration.
    Run: sudo nano /etc/apache2/apache2.conf
    Navigate to the end of file and add the following new line to the file:
    Include /etc/phpmyadmin/apache.conf
    Save the file (CTRL + X and enter Y when prompted to save) and restart Apache2. To restart Apache, enter the following command:  /etc/init.d/apache2 restart
    Check that everything works by going  http://YOUR_PI_IP/phpmyadmin/ and log in with your root user and MySQL root password.
  8. And last but not least FTP. Firstly lets install ftp server: sudo apt-get install vsftpd
  9. Now lets change the www folders owner from root to pi: sudo chown -R pi /var/www 
  10. Now lets configure the vsftpd by: sudo nano /etc/vsftpd.conf
    Search through the file and change the following lines:
    anonymous_enable=YES  Change To anonymous_enable=NO
    #local_enable=YES  Change To local_enable=YES
    #write_enable=YES Change To write_enable=YES
    For me on the current install most of the lines where already set.
    add a line to the bottom of the file:
    force_dot_files=YES
    Save file by Ctrl+x and the y.
  11. Now restart the FTP server with “sudo service vsftpd restart

Danzo. open up your favorite ftp client and log in user is pi and your pi-s password is the well.. password.

*Tutorial on Linux version 4.4.50/ Raspbian v. 8 (jessie)



6 Comments

  1. how do i do this on windows?

  2. This is nice, but does not work for me. Third day and countless tutorials and clean installations later (using 2017-09-07-raspbian-stretch.img) i’m getting stuck at point 3., where i get: php5-mysql : depends on: libmysqlclient18, but it can’t be installed

    libmysqlclient18 has no installation candidate

    Every time.

    Oh yes, using RPi, obviously.

    • BigJay

      September 25, 2017 at 7:54 pm

      Hi.

      Yes Raspbain Strech has some new repositorys and some of the steps may not work. One alternative is to try to install MariaDB and check if that works. I have written tutorial here.

Leave a Reply

Your email address will not be published.

*

© 2017 JakeMakes