Activity Library/Devel/Installing

From Sugar Labs
Jump to navigation Jump to search

Activities.sugarlabs.org

Over the last several months, there have been on and off discussions about how to adapt the addons.mozilla.org server software to manage Sugar activities.

Background

Information about Remora, the codename for a.m.o version 3, is at https://wiki.mozilla.org/Update:Remora.

Why base a.s.o on a.m.o

Pros

  • The function of a.m.o is exactly the same as the desired functionality of a.s.o.

Cons

  • A.m.o is currently only used my mozilla.
  • A.m.o is written in cake-php (yet another web framework)

Installing activities.sugarlabs.org

Mozilla.org runs a.m.o on CentOS5.0. For capability reasons these instructions will also use CentOS5.2.

Install centOS5.2 as server

It is handy to set up a development system as a server-gui in a virtual machine.

Set up Apache

Apache is pre-installed on CentOS.

Configure Apache to start on system boot.

chkconfig --levels 235 httpd on

Create Apache test page

vim /var/www/html/index.php
<?php phpinfo(); ?>

Start Apache

service httpd start

Install Firefox

yum install firefox

Test 127.0.0.1

verify mod_rewrite and mod_expires are loaded

Set up php

look for PHP5.1.6

rpm -q php

look for php-gettext ( in php-common)

rpm -q php-common

install required php modules

install php-pear
install php-gd
install php-mbstring
pear config-set preferred_state beta 
pear install Archive_Zip

Install subversion

yum install subversion

Checkout amo trunk via svn

svn co http://svn.mozilla.org/addons/trunk /var/www

Set up server

Set permissions

chown -R apache:apache /var/www/site 

Edit DocumentRoot

vim /etc/httpd/conf/httpd.conf

Edit DocumentRoot /var/www/site/app/webroot
Edit AllowOverride All

Add to hosts

vim /etc/hosts
127.0.0.1 activities.sugarlabs.org

Test server

service httpd restart

mv /var/www/site/app/webroot/index.php /var/www/site/app/webroot/index.php.old
mv /var/www/html/index.php /var/www/site/app/webroot/index.php

open activities.sugarlabs.org in firefox

Install mysql

yum install mysql-server
yum install php-mysql

start mysql on system boot

chkconfig --levels 235 mysqld on 

Start mysqld

service mysqld start

Test server

service httpd restart

open activities.sugarlabs.org in firefox. Make sure mysql is enabled

Setup mysql

mysqladmin -u root password remora
mysqladmin -u root -p create remora
mysqladmin -u root -p create remora-test
mysql -u root -p
GRANT ALL ON *.* TO 'remora'@'localhost' IDENTIFIED BY 'remora';
exit; 

Populate tables

mysql -u remora -p -D remora </var/www/site/app/config/sql/remora.sql
mysql -u remora -p -D remora-test </var/www/site/app/config/sql/remora.sql
mysql -u remora -p -D remora </var/www/site/app/tests/data/remora-test-data.sql
mysql -u remora -p -D remora-test </var/www/site/app/tests/data/remora-test-data.sql


Configure aso

Edit config.php

cp /var/www/site/app/config/config.php.default /var/www/site/app/config/config.php
vim /var/www/site/app/config/config.php

Edit config-local.php

vim /var/www/site/app/config/config-local.php

<?php
define('DEBUG', 1);
define('DEV', true);
?>

chown apache:apache /var/www/site/app/config/config-local.php

This is necessary to generate debug message. Without it you get a somewhat disconcerting blankscreen.

Open activities.sugarlabs.org in firefox.


Create download directory

mkdir /var/www/downloads
chown -R apache:apache /var/www/downloads

Create repo directories

mkdir /var/www/files
mkdir /var/www/files/temp
mkdir /var/www/files/extracted
chown -R apache:apache /var/www/files

Install php-memcache

yum install php-devel
yum install gcc
yum install zlib-devel 
pecl install memcache
vim /etc/php.ini

You should add "extension=memcache.so" to php.ini

service httpd restart

Install memcached

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install memcached
service memcached start
chkconfig --levels 235 httpd on


Test activities.sugarlabs.org

open activities.sugarlabs.org/tests?case=installation.test.php in firefox.