Menu

yfi_setup_centos_cake

Anonymous

WARNING: 4-4-2010

  • It came to our attention that the standard version of PHP that comes with CentOS 5.x does not work correct with YFi Hotspot Manager.
  • The standard version (5.1x) does not include the DateTime? function.
  • You need to upgrade to version 5.2 or higher
  • Use the following URL as a reference: http://blog.famillecollet.com/pages/Config-en
  • Another one howto from CentOS Wiki: http://wiki.centos.org/HowTos/PHP_5.1_To_5.2
  • Please be advised that the rest of this page still has to be revised to incorporate this change.
  • Sorry for the inconvenience!

Prepare a LAMP system

  • We assume a base CentOS install and will prepare a LAMP (Linux Apache MySQL PHP) server which is suitable for YFi Hotspot Manager.

Install required package groups

  • The package manager on CentOS is yum and features the install of package groups.

  • Package groups are like meta packages in Debian based distros.

  • You can get a list of available package groups as well as those already installed by issuing the following command:

    su -c 'yum grouplist'
    
  • Be sure you have an up to date system by issuing the following command:

    su -c 'yum update'
    
  • A LAMP setup requires the following groups of packages.

Command to install Package Group
Comment

yum groupinstall 'Web Server'
Installs Apache web server

yum groupinstall 'MySQL Database'
Install MySQL database server

yum groupinstall 'Development Tools'
We need to compile some software

Activate LAMP startup

  • This services needs to be activated as start-up services. We will use chkconfig to activate them.

    chkconfig httpd on
    chkconfig mysqld on
    service httpd start
    service mysqld start
    

Set MySQL password

  • You also should add a password to MySQL's root user.

    mysqladmin -u root password "great_secret"
    

Install ImageMagick

yum install 'ImageMagick'

Install MySQL support in PHP

yum install php-mysql

Include JSON support for PHP

  • YFi Hotspot Manager makes use of json functions available in version 5.2x of PHP.

  • The version of PHP (5.1x) that ships by default with CentOS does not support the json functions.

  • We have to do the following trick to include support for the json functions.

    yum install php-devel
    yum install php-pear
    pecl install json
    cd /etc/php.d/
    echo "extension=json.so" >> json.ini
    service httpd restart
    
  • TIP

If you are behind corporate firewall and need to configure a proxy, be sure to specify it for the pear set-up as well.

pear config-set http_proxy my_proxy.co.za:3128

Language Support

  • From release Beta-3 upwards, YFi Hotspot Manager supports multiple languages.

  • CentOS differ from Ubuntu by including the locale settings for all the supported languages by default (under /usr/lib/locale)

  • Install of extra packages is thus not required on CentOS.

Conclusion

  • The above procedure should leave the CentOS server with a working LAMP stack.

Install YFi Hotspot Manager's CakePHP application

  • Download the latest version of CakePHP (Version 1.2.5 as of this writing) Get CakePHP

  • Copy and extract it inside the directory that Apache is serving its content from (/var/www/html by default on CentOS)

    cp cake_1.2.5.tar.gz /var/www/html
    cd /var/www/html
    tar -xzvf cake_1.2.5.tar.gz
    ln -s ./cake_1.2.5 ./c2
    
  • Ensure the following modules are enabled in Apache (the /etc/httpd/conf/httpd.conf file)

    LoadModule rewrite_module modules/mod_rewrite.so
    LoadModule deflate_module modules/mod_deflate.so
    LoadModule headers_module modules/mod_headers.so
    
  • Ensure the following is specified in /etc/php.ini

    allow_call_time_pass_reference = On
    output_buffering = 4096
    short_open_tag = On
    
  • Change Apache's configuration file to include the following: (/etc/httpd/conf/httpd.conf)

    <Directory  /var/www/html/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/httpd/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
    #-----------------------------------------
    
  • Restart Apache

    service httpd restart
    

Install YFi CakePHP Application

  • Download the latest version of the YFi Cake application.

  • If you want to try the latest development source, follow this instructions: SVN Quick Help

  • Extract it inside the '/var/www/html/c2' directory.

    cp [ latest version of yfi_cake ].tar.gz /var/www/html/c2
    cd /var/www/html/c2
    tar -xzvf [ latest version of yfi_cake ].tar.gz
    chown -R apache. /var/www/html/c2/yfi_cake/tmp
    chown -R apache. /var/www/html/c2/yfi_cake/webroot/img/graphics
    

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 -p
    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 -p yfi < /var/www/html/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 and be sure that a login-page is displayed.

http://127.0.0.1/c2/yfi_cake/users/


Tweaking the configuration

  • Some settings may need further tweaking especially if you deviated from the standard.

  • They are all in one configuration file called (/var/www/html/c2/yfi_cake/config/yfi.php)

  • You also need to specify the SMTP server's detail.

  • This can be used to notify users about their usage via e-mail. YFi Hotspot Manager also features a message sending facility to inform permanent users about something.


Next Step


Related

Wiki: Home
Wiki: yfi_setup_centos_yfi
Wiki: yfi_setup_svn