Friday, March 16, 2012

INSTALL HOTSPOT YFI (part 1)

Note :
Source of the original article : 
http://sourceforge.net/apps/trac/hotcakes/wiki/yfi_setup_cake
I have edited some parts according to my experience
YFI Hotspot Manager network

 Set-up CakePHP

This is last experience and 100% working properly:
Component
Description
Operating System
Ubuntu 10.04 (Lucid Lynx)
Web Server
LAMP Stack
CakePHP
CakePHP version 1.2.11
Coova Chilli
Coovachilli 1.0.14
Radius
FreeRADIUS Version 2.1.12

Install the LAMP stack

  • It is assumed that you have sudo rights on the Ubuntu machine which you want to install YFi Hotspot Manager on. 
  • From the terminal enter the following command:
sudo tasksel
  • Selecting LAMP from the list will install all the required packages. 
  • You will be required to supply a password for the root mysql user. (Hitting Esc each time will create a blank password) 
  • Ensure the PHP command line program is also installed by issuing the following command:
sudo apt-get install php5-cli
  • Install imagemagick which is used to scale graphic files
sudo apt-get install imagemagick
  • Install the following two PHP packages for new enhancements:
sudo apt-get install php5-gd php5-curl

Install Language Packs (optional)

  • From release Beta-3 upwards, YFi Hotspot Manager supports multiple languages
  • Install the following optional language packs in order to ensure proper working for the supported languages.
Language
Command to install language pack
Afrikaans
sudo apt-get install language-pack-af
French
sudo apt-get install language-pack-fr
Indonesian
sudo apt-get install language-pack-id
Malay
sudo apt-get install language-pack-ms
Netherlands
sudo apt-get install language-pack-nl
Thai
sudo apt-get install language-pack-th
Spanish
sudo apt-get install language-pack-es
Portuguese
sudo apt-get install language-pack-pt
German
sudo apt-get install language-pack-de
Danish
sudo apt-get install language-pack-da

  • Or just install them all at once
sudo apt-get install language-pack-af language-pack-fr language-pack-id \
language-pack-ms language-pack-nl language-pack-th language-pack-es \
language-pack-pt language-pack-de language-pack-da

Install CakePHP

  • Download the latest version of CakePHP (version 1.2.11)
  • Copy and extract it inside the directory that Apache is serving its content from (/var/www by default on Ubuntu)
wget https://github.com/cakephp/cakephp/archive/1.2.11.tar.gz
sudo cp cake_1.2.11.tar.gz /var/www
cd /var/www
sudo tar -xzvf cake_1.2.11.tar.gz
sudo ln -s ./cake_1.2.11 ./c2
  • Enable the rewrite Apache module, also enable the compression module and the module that modifies the HTTP headers, they are used to vastly improve speed and performance of the web application. Reload Apache's configuration.
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod headers
sudo /etc/init.d/apache2 reload
  • Edit the following line in the '/etc/php5/apache2/php.ini' file 
sudo vi /etc/php5/apache2/php.ini
* Change [Line Number: 101]
output_buffering = Off
To
output_buffering = 4096
  • Also ensure short_open_tag is activated in '/etc/php5/apache2/php.ini' [Line Number: 83]
short_open_tag = On
  • Also ensure allow_call_time_pass_reference is set to On in '/etc/php5/apache2/php.ini' [Line Number: 164]
allow_call_time_pass_reference = On
  • Change Apache's configuration file to include the following: ('/etc/apache2/apache2.conf')
sudo vi /etc/apache2/apache2.conf
<Directory  /var/www/c2>
    AllowOverride All
</Directory>
#-------COMPRESS CONTENT-----------
# place filter 'DEFLATE' on all outgoing content
SetOutputFilter DEFLATE
# exclude uncompressible content via file type
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|jpg|png|pdf|zip|bz2|sit|rar)$ no-gzip
#dont-vary
# Keep a log of compression ratio on each request
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog /var/log/apache2/deflate.log deflate
# Properly handle old browsers that do not support compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
#----------------------------------
 
#------ADD EXPIRY DATE-------------
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
</FilesMatch>
#----------------------------------
 
#--------Remove ETags --------------------
FileETag none
#-----------------------------------------
  • Reload Apache
sudo /etc/init.d/apache2 reload

 Install YFi CakePHP Application

  • YFi Hotspot Manager consists of two components: A CakePHP application and a Viewer.
  • Download the latest version of the YFi Cake application. (yfi_cake-Beta-5.tar.gz)
  • Extract it inside the '/var/www/c2' directory.
wget http://sourceforge.net/projects/hotcakes/files/YFi%20CakePHP%20Application/Beta-5/yfi_cake-Beta-5.tar.gz
sudo cp yfi_cake-Beta-5.tar.gz /var/www/c2/
cd /var/www/c2
sudo tar -xzvf yfi_cake-Beta-5.tar.gz
sudo chown -R www-data. /var/www/c2/yfi_cake/tmp
sudo chown -R www-data. /var/www/c2/yfi_cake/webroot/img/graphics
sudo chown -R www-data. /var/www/c2/yfi_cake/webroot/files

Configure the database

  • You need to create a database called 'yfi' and allow access to it for a username / password combination. 
  • It is good practice to change the default username / password combination. 
  • This can be changed inside the '/var/www/c2/yfi_cake/config/database.php' file. 
  • These sample commands assume the defaults.
mysql -u root
create database yfi;
GRANT ALL PRIVILEGES ON yfi.* to 'yfi'@'127.0.0.1' IDENTIFIED BY 'yfi';
GRANT ALL PRIVILEGES ON yfi.* to 'yfi'@'localhost' IDENTIFIED BY 'yfi';
exit;
  • Dump the sample database in the newly created yfi database.
mysql -u root yfi < /var/www/c2/yfi_cake/setup/db/yfi.sql

Test the CakePHP application

  • Verify that everything works as intended by doing the following test. 
  • Go to the followingURL.
http://127.0.0.1/c2/yfi_cake/users/
  • In my case, I can access from another computer, and browsing to
http://192.168.10.29/c2/yfi_cake/users/

Installing the YFi CakePHP Viewer Component

  • Get the latest viewer component of YFi Hotspot Manager. (version yfi-Beta-5.tar.gz).
  • Copy and extract it inside the directory that Apache is serving its content from (/var/www by default on Ubuntu)
wget http://nchc.dl.sourceforge.net/project/hotcakes/YFi%20Viewer%20Component/Beta-5/yfi-Beta-5.tar.gz
sudo cp yfi-Beta-5.tar.gz /var/www/
cd /var/www
sudo tar -xzvf yfi-Beta-5.tar.gz

Test the Viewer component

  • Go to the following URL http://127.0.0.1/yfi/  (you may need to replace 127.0.0.1 with the IP address of the server you installed the YFi Hotspot Manager on) 
  • You should get a splash page which, depending on the speed of your network connection, will change into a login page. 
  • Log in either as the administrator or as an Access Provider or as a permanent user. 
  • The following table displays the default username and password for each. 
Role
Username
Password
Administrator
root
admin
Access Provider
ap
ap
Permanent User
dvdwalt@ri
dvdwalt@ri

To be Continued ....  to part 2

28 comments:

  1. Hi..as I am really newbie to ubuntu...I have manage to setup on this part 1..but I have a question on the this part
    " Test the Viewer component

    (you may need to replace 127.0.0.1 with the IP address of the server you installed the YFi Hotspot Manager on) "
    How do replace the my server ip address instead of 127.0.0.1..what files should I edit?

    ReplyDelete
  2. server ip = your computer ip, for my comp, it's 192.168.2.200
    so i can redirect 127.0.0.1 and 192.168.2.200

    ReplyDelete
  3. Hello. I'm trying to setup a hotspot following your tutorial step-by-step, but I have a doubt regarding this command:

    sudo ln -s ./cake_1.2.11 ./c2

    As far as I understand, you are establishing there a symbolic link named "c2", pointing to a file or directory named "cake_1.2.11". Well, I don't have such name, I only have "cakephp-1.2.11". Should the link point to this file? Or am I misunderstanding you?

    Thanks in advance.

    ReplyDelete
    Replies
    1. Great, that means that I'm undestanding what I'm doing... :) Thanks for your help.

      Delete
  4. Hello again. When I restart the apache service, I get this message:

    * Reloading web server config apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

    Is it a problem? Should I fix anything? Why is it using 127.0.1.1, instead of 127.0.0.1, which use to be "localhost"?

    ReplyDelete
  5. Also, I've got another doubt... Here are two commands from your guide:

    wget http://sourceforge.net/projects/hotcakes/files/YFi%20CakePHP%20Application/Beta-5/yfi_cake-Beta-5.tar.gz/download

    sudo cp yfi_cake-Beta-5.tar.gz /var/www/c2

    Regarding the first one, I think the correct one (as of 2013-04-09) should be like this:

    wget http://sourceforge.net/projects/hotcakes/files/YFi%20CakePHP%20Application/Beta-5/yfi_cake-Beta-5.tar.gz

    And for the second one, c2 in the /var/www is just a symlink. There is no c2 directory inside /var/www, so if you copy the downloaded file to /var/www/c2, couldn't there be a conflict between the symlink and the new file?

    ReplyDelete
    Replies
    1. So... after I enter this command:

      sudo cp yfi_cake-Beta-5.tar.gz /var/www/c2/

      The symlink is gone. Isn't it needed anymore?

      Delete
    2. Ah... Ok... Thank you very much. I didn't know a folder could be a symlink, and vice versa... I'm learning a lot! :)

      Delete
  6. My yfi login page is blank. No box for username and password enter. Please help me.

    ReplyDelete
  7. Thanks for your reply. After installing yfi cake PHP viewer, I went to the following URL http:///yfi/. Its splash loads after which the login box appears but without the login, password and language fields. I saw this error in http:///c2/yf_cake.

    Missing Controller
    Error: YfCakeController could not be found.

    Please kindly suggest me what is my error?
    Regards,
    Min Htut Win.

    ReplyDelete
  8. Hay, I got it now. My php version is 5.4.6 and it is not working with phpcake 1.2.8. After upgrade my phpcake version to 1.3.11. Everything is O.K. Thanks for your post.

    Regards,

    Min Htut Win.

    ReplyDelete
  9. Finally, I downgrade my php version to 5.3.10 and work perfectly with phpcake 1.2.8.
    Thanks.

    ReplyDelete
  10. This is my ubuntu server version.

    Description: Ubuntu 12.10
    Release: 12.10
    Codename: quantal


    Regards,

    Min Htut Win.

    ReplyDelete
  11. where is part 2 please ^^

    ReplyDelete
  12. when i try to access http://127.0.0.1/c2/yfi_cake/users/ i got error like this

    Warning: include(cake/bootstrap.php): failed to open stream: No such file or directory in /var/www/c2/yfi_cake/webroot/index.php on line 81 Warning: include(): Failed opening 'cake/bootstrap.php' for inclusion (include_path='/var/www/c2:/var/www/c2/yfi_cake/:.:/usr/share/php:/usr/share/pear') in /var/www/c2/yfi_cake/webroot/index.php on line 81 Fatal error: CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /var/www/c2/yfi_cake/webroot/index.php on line 82


    can help me? thanks

    ReplyDelete
    Replies
    1. error ini cakephp, try to reinstall again, in cakephp section. above cakephp version 1.2.11, you can try latest version 1.2.12.

      Delete
  13. hello. can you help me I'm trying to see the login page but will not let me, I get a blank page in: http://127.0.0.1/c2/yfi_cake/users/. And I get a box http://127.0.0.1/yfi and leaves me waiting. please help me and is desperate not to do

    ReplyDelete
  14. if i want set end of session on yfi hotspot , how i set it , example , if the user until 15 minute no action on the internet , i want the user back to home page , and insert an username and password again ..

    ReplyDelete
    Replies
    1. click spesific profiles menu, then select one of profiles. for example voucher 10M cap (voucher database). click edit, then you will find some attribute name. select idle-Timeout, on the value, enter 900 seconds. just that....

      Delete
  15. Hey Hoping you can assist, when i reach installing the Cake PHP, after downloading the file us wget.... it downloads as it should but as soon as i want to exctract it to /var/www/c2 - an error occurs stating that the file doesnt look like a tar archive file.

    Im stuck i hope you can assist, anyone!

    Thanks

    Lyle

    ReplyDelete
    Replies
    1. change file to extention tar.gz or zip (depending file that you choose for downloading)
      for example, after finish download, you find file 1.2.11
      mv 1.2.11 1.2.11.tar.gz
      then continue to extract
      tar -zxvf 1.2.11.tar.gz

      Delete
  16. I'm using ubuntu 14.04 desktop on line "allow_call_time_pass_reference" in php.ini file
    I dont find that line. What I have to do?
    BR

    ReplyDelete
  17. help in this error
    Not Found

    The requested URL /c2/yfi_cake/users/ was not found on this server.
    Apache/2.4.7 (Ubuntu) Server at 127.0.0.1 Port 80

    ReplyDelete
    Replies
    1. you should know how to fix it.
      c2/yfi_cake/users/ was not found... --->>> be sure the folder exist.
      you must be missing a step or something.
      Please follow the tutorial, step by step and carefully....

      Delete
  18. "Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"

    should I modify this date to 15 Apr 2016 ?
    ty

    ReplyDelete
  19. Bonsoir membre, je suis vraiment un novice mais quand je tape sudo tasksel on me demande mot de passe or j'ai pas mis de mot de passe. svp aider moi

    ReplyDelete