[caption id="" align="alignright" width="300"] Raspberry Pi model B+[/caption]
We wanted to try out installing Chamilo LMS 1.9.10 (still in development at the time of writing) on a Raspberry Pi B+ and see if, to some extent, it might be enough to provide for a little institution's learning management system.
Installing Raspbian
First of all, installing Raspbian is one way to install an operating system on your Raspberry Pi. You can find the corresponding instructions on the Raspberry website here (you can choose either of the proposed options, but I chose a pre-installed Raspbian image).Installing the required software stack
sudo apt-get update; sudo apt-get upgrade; sudo apt-get install nginx-full mysql-server php5-fpm php5-mysql php5-gd php5-curl php5-intl gitDownloading Chamilo
The easiest (although slowest) way, for development installations, to download Chamilo is to download it from Github*:sudo -s cd /var/www/ git clone https://github.com/chamilo/chamilo-lms.git chamilo cd chamilo git checkout 1.9.x* Note that we added a patch in Chamilo LMS 1.9.10 to install on the basis of an IP addresses
Optimizing PHP
This is something I did *after* the load testing, but you might as well do it from the start. Because PHP 5.5 (and superior) comes with the Zend Optimizer+, and because it is famous for saving a lot of CPU by pre-interpreting PHP scripts, it is a good match for the Raspberry Pi which has low processing power and about 400MB of available memory. You can find information on how to compile PHP 5.6 on your Raspberry Pi here: https://nicolas.steinmetz.fr/blog/ as given by @nsteinmetz Compiling should take about 23 hours. Launch the apt-get source --compile php5 command from GNU Screen, so that you can disconnect and leave it to run, yet take it back later. To measure the total time it took (even if not watching it full-time), prefix the command with "time" to give you a report of the time taken when it finishes. After that, you should prefer php5-mysqlnd to php5-mysql (so "apt-get install php5-mysqlnd").Configuring Nginx, PHP-FPM, MySQL and Chamilo
Once you've got everything installed, you'll need to configure the distinct applications.Nginx
The first service you should configure is Nginx (the web server). sudo -s cd /etc/nginx/sites-available/ vim defaultserver { listen 80; # If you want to respond to any URL, don't define a server_name # server_name my.chamilo19.net your.chamilo19.net; access_log /var/log/nginx/chamilo-access.log; error_log /var/log/nginx/chamilo-error.log notice; root /var/www/chamilo; index index.php; location ~ \.php$ { client_max_body_size 200m; include /etc/nginx/fastcgi_params; expires 5m; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/chamilo$fastcgi_script_name; try_files $uri $uri/ @rewrite; } }Let's wait before reloading the configuration, because we also need to setup PHP-FPM and MySQL.
PHP-FPM
PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. It was first included in PHP version 5.3.3 and reached production grade as of 5.4. Configuring FPM is essential to get PHP running behind Nginx. There's nothing that requires a change in php.ini. Everything can be done in the corresponding "pool" of FPM. The excerpt below is only showing the lines you should modify.cd /etc/php5/fpm/pool.d/
vim www.conf
pm.max_children = 32 pm.start_servers = 4 pm.min_spare_servers = 4 pm.max_spare_servers = 8 php_admin_value[short_open_tag] = off php_admin_value[session.cookie_httponly] = on php_admin_value[upload_max_filesize] = 200M php_admin_value[post_max_size] = 200M php_admin_value[allow_url_fopen] = on php_admin_value[date.timezone] = Europe/BrusselsThe last setting (date.timezone) is very important to configure, as Chamilo will protest if you don't. Set it to your timezone. Enabling the Zend Optimizer has to be done manually by editing the opcache.ini file:
vim /etc/php5/fpm/conf.d/05-opcache.ini
; configuration for php ZendOpcache module ; priority=05 zend_extension=opcache.so opcache.enable=On opcache.memory_consumption=24 opcache.interned_strings_buffer=16 opcache.max_accelerated_files=3900 opcache.revalidate_freq=120 opcache.fast_shutdown=1 ; Special optimization: do not used cwd to cache files as on this install there's only one php app opcache.use_cwd=0
MySQL
There are only a few things that you can change to MySQL's config to make it more efficient in the Chamilo + Raspberry Pi context. Here are the only lines you should modify in the /etc/mysql/my.cnf file: vim /etc/mysql/my.cnf key_buffer = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 max_connections = 40 query_cache_limit = 16M query_cache_size = 16M In particular, we *reduce* the max_connections setting to 40 (instead of the default 100) because otherwise MySQL will use too much memory for FPM to be able to run its PHP processes efficiently.Chamilo
Once you got all this setup, you'll need to restart all these services... service mysql restart; service php5-fpm restart; service nginx restart and then install Chamilo following the normal installation procedure (this requires enabling a MySQL user for your Chamilo - preferably not root directly). Use your Raspberry's IP address to connect through your browser and be prompted by the installation procedure. Once you've done that, you'll have to edit the configuration file to get the name resolution right, even if you change IPs or domain names in the future. Find the "root_web" line, and replace it as follows (in this example, replace 192.168.178.24 by the IP of your Raspberry, or leave it if already configured correctly):vim /var/www/chamilo/main/inc/conf/configuration.php
// URL to the root of your Chamilo installation, e.g.: http://www.mychamilo.com/ $_configuration['root_web'] = 'http://192.168.178.24/'; if (!empty($_SERVER['HTTP_HOST'])) { $_configuration['root_web'] = 'http://'.$_SERVER['HTTP_HOST'].'/'; }This will allow any domain to be used to load Chamilo, but will force it into HTTP mode. If you want to use HTTPs (which we recommend), you'll have to make the necessary changes to this tutorial, which is limited to HTTP.
Starting up Chamilo
Now you can load Chamilo into your web browser (by pointing it to your Raspberry). The first things you'll need to configure (by going to the administration panel and selecting "Platform settings"), for increased efficiency, are:- disable the "hot courses" block (it requires a lot of processing for the voting starts)
- disable the display of "online users" (for the three types)
- disable all unnecessary languages (preferably keeping only one)
Comments
We will soon be testing the same with a Raspberry Pi 2, which features a much faster quad-core CPU, and 1GB RAM (instead of only 512MB).
Stay tuned!
Hello.
I've tried this using Raspbian Jessie Minimal on a Raspberry Pi 2, but there seems to be a problem installing nginx.
Have you tried this installtion method on a Raspberry Pi 2? Is this tutorial Wheezie or Jessie? You said on 20 March, 2015, that "We will soon be testing the same with a Raspberry Pi 2..."
Thank you
SOLVED with a fresh install of Jessie Pi. I could install NGINX correctly.
You say on your post:
"You can find information on how to compile PHP 5.6 on your Raspberry Pi here: https://nicolas.steinmetz.fr/blog/ as given by @nsteinmetz"
Now I'm here with my Jessie Lite Raspberry Pi 2 :-)
I've tried to find that post on Nicolas blog but I can't find it, do you have the link?
I've found just this, but for Cubieboard: https://nicolas.steinmetz.fr/blog/post/PHP-5.6.3-%28dotdeb%29-pour-cubi…
I did it! Chamilo's running on RPI 2B. Thank you for this post!
7,75 requests/second
Completed 100 requests
Completed 200 requests
Finished 200 requests
Server Software: nginx/1.6.2
Server Hostname: 192.168.1.13
Server Port: 80
Document Path: /
Document Length: 25197 bytes
Concurrency Level: 10
Time taken for tests: 25.790 seconds
Complete requests: 200
Failed requests: 0
Total transferred: 5118200 bytes
HTML transferred: 5039400 bytes
Requests per second: 7.75 [#/sec] (mean)
Time per request: 1289.517 [ms] (mean)
Time per request: 128.952 [ms] (mean, across all concurrent requests)
Transfer rate: 193.80 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 3
Processing: 620 1272 292.8 1283 2237
Waiting: 613 1252 288.2 1261 2209
Total: 620 1272 292.8 1283 2239
Percentage of the requests served within a certain time (ms)
50% 1283
66% 1404
75% 1503
80% 1554
90% 1638
95% 1682
98% 1810
99% 1861
100% 2239 (longest request)
Can I used this guides to setup chamilo on ubuntu 14??? Thank you.. i'm the beginner of the learner
Not really. This is specific to the Raspberry Pi B+. There are other guides to install Chamilo on Digital Ocean. I suggest you use these ones instead, or read the installation guide that comes in the documentation/ folder of any Chamilo zip package.
when the process of chamilo installation on step 2 : Requirements, i have prompted with this messages :
/var/www/chamilo/app/ Writable
/var/www/chamilo/main/default_course_document/images/ Writable
/var/www/chamilo/main/lang/ Writable
(Only required by the sub-languages feature)
/var/www/chamilo/vendor/ Readable
/var/www/chamilo/web/ Writable
A test course has been created successfully No
Permissions for new directories 0777
Permissions for new files 0666
how to solve : A test course has been created successfully NO??? what i'm doing wrong??? please help and guide me... thanks.
To create a test course, Chamilo creates one then tries to connect through HTTP to check if the course homepage is responding. If not, it considers the course creation has failed.
This requires the server (the Raspberry in this case) to know that itself should respond to the URL you've selected to install your Chamilo portal. For example, if it's an IP address that you use, it is likely that the Raspberry will have the same and understand that. However, if you have defined a domain on your computer and use it to connect to the Raspberry, but the Raspberry is not aware that it answers to that domain, it won't be able to check that the course is responding (it will try and load the domain but that won't match anything that translates through DNS).
To fix it, just add the domain name in the /etc/hosts file of your Raspberry and you should be able to validate the course creation.
Wow... with the Raspberri Pi 3 coming out now, and again pumping up the RAM en processing power, we're really getting to the point where this can manage a real (15 pupils or more) classroom at a feasible speed! Last thing I heard, was that the WiFi is even faster than the ethernet plug (because the Wifi isn't sitting on the USB-hub). So you just put it in the WiFi domain, and we're up and running...
Great post. I have a Raspberry 3 and am currently delivering static web pages via a router in an internet-less classroom. Looking forward to getting Chamilo up and running
Some classes have over 60 students so we will see what the Pi can do.
That sounds fantastic. Have you been able to get Chamilo running on the raspberry 3 yet?
Just set up a standard LAMP server ( finding the nginx install a little tricky). I have a sdcard only for boot and are running off a Maxell 8GB drive. The results for a Pi 3 running Jessie Lite was 14 Requests per second.
Given the initial result of 1.8 requests per second might be enough for about 10 computers that seems encouraging. I will back up the image and try again with some tweaking.
Tried the nginx version but it hangs on step 6 of the Chamilo install.
[…] Chamilo Pi Installing Chamilo LMS on a Raspberry Pi B […]