[GUIDE] Installing Chamillo LMS 1.9.10.2 on DietPi v107

Now I’ll publish how to install it, maybe some of you are interested on this topic. I’ve used this time an RPI 1 B, although it can be done on RPI 2, and, I suppose, in all the DietPi systems (Odroid, VMWare…).

Eveything has gone fine, very fine, and Chamilo seems to me to work better and faster on DietPi than using the Jessie Minimal Official Raspbian Image.

The only issue I’ve found has been using apache2-utils, ab command (see STEP 8 of the process), it seems not to work correctly, because this is the code I get:

Benchmarking 192.168.1.13 (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests


Server Software:        
Server Hostname:        192.168.1.13
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   0.518 seconds
Complete requests:      200
Failed requests:        111
   (Connect: 0, Receive: 0, Length: 0, Exceptions: 111)
Total transferred:      0 bytes
HTML transferred:       0 bytes
Requests per second:    386.34 [#/sec] (mean)
Time per request:       25.884 [ms] (mean)
Time per request:       2.588 [ms] (mean, across all concurrent requests)
Transfer rate:          0.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    7   8.6      2      31
Processing:     1    8   7.6      5      29
Waiting:        0    0   0.0      0       0
Total:          1   15  12.3     20      39

Percentage of the requests served within a certain time (ms)
  50%     20
  66%     23
  75%     25
  80%     26
  90%     30
  95%     33
  98%     35
  99%     37
 100%     39 (longest request)

It says there are a lot of failed requests, but when I use Chamilo (creating courses, whatever) it works smoothly and I don’t get any errors, so it seems to be something ab-realated.
Do you know why this is happening?

Thank you very much,

Based upon https://beeznest.com/blog/2015/01/02/chamilo-pi-installing-chamilo-lms-on-a-raspberry-pi-b/.

STEP 1- Install DietPi. I’ve modified dietpi.txt to have a static IP, and installed it from SSH.

STEP 2- Go to dietpi-software and install LEMP and, from Additional Software, Git.

STEP 3a-

sudo apt-get install php5-gd
sudo apt-get install php5-curl
cd /var/www/
git clone https://github.com/chamilo/chamilo-lms.git chamilo

STEP 4- While the command git clone is working you can optimize things. I open another SSH session and do all the “step 4”.

STEP 4a: Optimizing NGINX

cd /etc/nginx/sites-available/
cp default default.old
nano default

default file:

server {
 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;
 }
}

STEP 4b- Optimizing PHP-FPM

cd /etc/php5/fpm/pool.d/
cp www.conf www.conf.old
nano www.conf

The lines you have to modify:

pm.max_children = 32 
pm.start_servers = 4 
pm.min_spare_servers = 4 
pm.max_spare_servers = 8

The lines you have to add:

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
; I’m supposing you are in Europe
php_admin_value[date.timezone] = Europe/Brussels

STEP 4c- Optimizing Zen Optimizer

cd /etc/php5/fpm/conf.d/
cp 05-opcache.ini 05-opcache.ini.old
nano 05-opcache.ini

The 05-opcahe.ini

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

STEP 4d- Optimizing MySQL

cd /etc/mysql/
cp my.cnf my.cnf.old
nano my.cnf

The only lines you should modify:

max_connections = 40
query_cache_limit = 16M

And close this SSH session.

STEP 3b
When git clone has finished, we have to:

cd chamilo 
git checkout 1.9.x
service mysql restart
service php5-fpm restart
service nginx restart

STEP 5
Let’s prepare the Chamilo folders.

sudo chown -R www-data:www-data /var/www
sudo chmod -R 755 /var/www/chamilo/main/inc/conf/
sudo chmod -R 755 /var/www/chamilo/main/upload/users/
sudo chmod -R 755 /var/www/chamilo/main/default_course_document/images/
sudo chmod -R 755 /var/www/chamilo/archive/
sudo chmod -R 755 /var/www/chamilo/courses/
sudo chmod -R 755 /var/www/chamilo/home/
sudo chmod -R 755 /var/www/chamilo/main/css/
sudo chmod -R 755 /var/www/chamilo/main/lang/
sudo chmod -R 755 /var/www/chamilo/searchdb/

STEP 6
Normal installation procedure.
Go to your DietPi system by webpage. I have i ton the static IP 192.168.1.13 so I go to http://192.168.1.13

Special details:
On step 4 of 6,
database user: root
database password: dietpi
Check the user can connect to the database and “Next”.
On step 5 of 6,
Chamilo URL, http://192.168.1.13

STEP 7
Security issues:

rm -r /var/www/chamilo/main/install
chmod 555 /var/www/chamilo/main/inc/conf

STEP 8
Now you have Chamilo LMS 1.9.10.2 installed.

You can check its speed:

apt-get install apache2-utils
ab -n 200 -c 10 http://192.168.1.13/

Inside of Chamilo, you can go to the administration panel and select “Platform settings”, to increase efficiency:
• disable the “hot courses” block
• disable the display of “online users” (for the three types)
• disable online chat
• disable all unnecessary languages
You can install HTTPS.

You can improve security (you can find a security guide on Chamilo webpage).

If you want to go into it from the Internet, you will need to open web server ports (80) from your router and install NoIP (NoIP can be installed using dietpi-software).

You will have to configure e-mail settings, if you want the platform being able to send e-mails (for example, the welcome message to a new user).
In my case, I’ve used Gmail Server with my Gmail account.

cd /var/www/chamilo/main/inc/conf
sudo nano mail.conf.php

The mail.conf.php file:

$platform_email['SMTP_FROM_EMAIL']   = (isset($administrator['email'])?$administrator['email']:'mygmailname@gmail.com');
$platform_email['SMTP_FROM_NAME']    = (isset($administrator['name'])?$administrator['name']:'Admin');
$platform_email['SMTP_HOST']         = 'ssl://smtp.gmail.com';
$platform_email['SMTP_PORT']         = 465;
$platform_email['SMTP_MAILER']       = 'smtp'; // mail, sendmail or smtp
$platform_email['SMTP_AUTH']         = 1;
$platform_email['SMTP_USER']         = 'mygmailname@gmail.com';
$platform_email['SMTP_PASS']         = 'mypassword';
$platform_email['SMTP_CHARSET']      = api_get_system_encoding();

NOTE: You will have to go to your google account and say you want to activate the access to the “less secure applications”.

I answer myself to the “ab” question.

The command:
ab -n 200 -c 10 http://192.168.1.13/
“This will request 200 pages by simulating 10 different computers queuing simultaneously for an answer from the server.”

If I don’t want dropouts the most I can do is simulating 4 computers with RPI 1 B 512 MB.
I just get Requests per second: 0.97 [#/sec] (mean)

With RPI 2 B it goes up to 8.27 [#/sec] (mean), simulating 40 computers :smiley:

Thanks for your attention,


Trying to learn everyday a little bit more,
Skyfly555