Raspberry Pi How to install Web Server


  1. 1
    Because you are running a fresh version of Raspberry PI (Raspbian) , you will need to do some housecleaning, updating, and installing. First, we are going to update the clock, update our sources, then upgrade any pre-installed packages. Type the following at the command line (press return/enter after each line):
    sudo dpkg-reconfigure tzdata
    sudo apt-get update
    sudo apt-get upgrade
  1. 2
    Set the date and time. From the command line type (replace parts as necessary):
    sudo date --set="15 September 2014 11:13:00"
  1. 3
    To install Apache and PHP, execute the following commands:
    sudo apt-get install apache2 php5 libapache2-mod-php5
  1. 4
    Now restart the service:
    sudo service apache2 restart
    

    OR
    sudo /etc/init.d/apache2 restart
  1. 5
    To install MySQL, install a few packages with the following command:
    sudo apt-get install mysql-server mysql-client php5-mysql
  1. 6
    We will now install FTP to allow transferring files to and from your Raspberry Pi.
     
  2. 7
    Take ownership of the web root:
    sudo chown -R pi /var/www
    
     
  3. 8
    Next, install vsftpd:
    sudo apt-get install vsftpd
    
     
  4. 9
    Edit your vsftpd.conf file:
    sudo nano /etc/vsftpd.conf
    
     
  5. 10
    Make the following changes:
    • anonymous_enable=YES to anonymous_enable=NO
    • Uncomment local_enable=YES and write_enable=YES by deleting the #symbol in front of each line
    • then go to the bottom of the file and add force_dot_files=YES.
     
  6. 11
    Now save and exit the file by pressing CTRL-O, CTRL-X.
     
  7. 12
    Now restart vsftpd:
    sudo service vsftpd restart
    
     
  8. 13
    Create a shortcut from the Pi user's home folder to /var/www:
    ln -s /var/www/ ~/www
    
     
  9. 14
    You can now FTP using the Pi user and access the /var/www folder via a shortcut that should appear on login.
Read 7511 times