Utilitats i trucs

Index

MS Windows 2000/NT i Linux

  1. A la instal·lació de Linux: posar el Lilo a la partició principal de Linux (NO al Master Boot Record). Si teniu problemes perquè la vostra partició comença en un cilindre més gran que 1024, proveu a afegir l'opció lba32 (una línia sola, cap al principi) al fitxer /etc/llilo.conf.
  2. Des de Linux: si la partició principal és, per exemple /dev/hda7 :
    dd if=/dev/hda7 of=/root/bootsec.lin bs=512 count=1
  3. Des de Linux: moure el fitxer creat a la partició MSWindows:
    cp /root/bootsec.lin /mnt/<partició de MSWindows>
    Si no podem muntar el disc de MSWindows (perquè sigui NTFS i no VFAT, per exemple), podem gravar el fitxer en un disquet (cp /root/bootsec.lin /mnt/floppy) i copiar-lo a c:\bootsec.lin des de MSWindows.
  4. Des de Windows 2000: afegir al fitxer c:\boot.ini la línia
    c:\bootsec.lin = "Linux"
  5. Si tot ha anat bé, quan arrenquem l'ordinador, el loader de W2000 ens demanarà si volem arrencar des de Linux o des de W2000.

Resin

  • La variable d'entorn JAVA_HOME ha de contenir l'adreça de la distribució del JDK:
    • csh: en el fitxer .cshrc
      setenv JAVA_HOME /usr/local/jdk1.2.2/
    • bash: en el fitxer .bashrc
      JAVA_HOME=/usr/local/jdk1.2.2/
      export JAVA_HOME

Resin i Apache

Per a fer servir el Resin amb l'Apache (assegureu-vos que teniu l'apache-devel) heu de posar aquestes opcions quan compileu el Resin (tot en una línia):
  • ./configure --with-apache-libexec=/usr/lib/apache --with-apache-include=/usr/include/apache --with-apache-conf=/etc/httpd/conf/httpd.conf

Resin i MS Internet Information Server

En el fitxer resin.conf una configuració d'aquest tipus no funciona:
  • <http-server>
    <http-port>8888<http-port/>
    <app-dir>doc<app-dir/>
    <http-server/>
Ha de ser tot en una sola línia:
  • <http-server port='8888' app-dir='doc'/>

Apache

  • Installation
  • Versions
  • Config files, service start/stop

    config
    modules config
    vhost config
    start/stop
    file
    default docs
    (DocumentRoot ...)
    default cgi-bin
    (ScriptAlias /cgi-bin/ ...)
    file
    file
    Mageia
    /etc/httpd/conf/http.conf
    /var/www/html/index.html
    /var/www/cgi-bin/

    /etc/httpd/conf/vhosts.d/*.conf
    # service httpd start
    CentOS
    /etc/httpd/conf/http.conf /var/www/html/index.html
    /etc/httpd/conf.d/*.conf

    • sudo systemctl start httpd.service
    • service httpd start
    • apachectl start
    Debian /Ubuntu
    /etc/apache2/apache2.conf
    /var/www/index.html (Apache 2.2)
    /var/www/html/index.html (Apache 2.4)
    /usr/lib/cgi-bin/
    /etc/apache2/mods-available/*.conf /etc/apache2/sites-available/* $ sudo service apache2 start
    Cygwin
    /etc/apache2/http.conf
    /srv/www/htdocs/



    $ /usr/sbin/apachectl2 -k start
    XAMPP
    c:\xampp\apache\conf\http.conf
    c:\xampp\htdocs\



  • Estructura de directoris de configuració / Configuration directory structure

    Apache 2.2
    Apache 2.4

    Mageia 1, 2
    Debian / Ubuntu
    Mageia 3, 4
    CentOS
    Debian / Ubuntu
    general
    /etc/httpd/ conf/
    • httpd.conf
    • magic
    • mime.types
    /etc/apache2/
    • apache2.conf
    • magic
    • ports.conf
    • envvars
    /etc/httpd/
    conf/
    • httpd.conf
      • # Include sites configuration
        Include conf/sites.d/*.conf
    • magic
    /etc/httpd/
    • conf/
      • httpd.conf
      • magic
    /etc/apache2/
    • apache2.conf
    • magic
    • ports.conf
    • envvars
    virtual hosts
    • vhosts.d/
      • 00_default_vhosts.conf
      • 00_default_ssl_vhost.conf
    • sites-available/
      • default
      • default-ssl
    • sites-enabled/
      • 000-default -> ../sites-available/default
    • vhosts.d -> sites.d
    • webapps.d -> sites.d
    • sites.d/
      • 00_default_vhosts.conf
      • 00_default_ssl_vhost.conf
      • ...
      • bugzilla.conf
      • mediawiki.conf

    a2ensite / a2dissite
    • sites-available/
      • default
      • default-ssl
    • sites-enabled/
      • 000-default -> ../sites-available/default
    webapps
    • webapps.d/
      • bugzilla.conf
      • mediawiki.conf
      • phpmyadmin.conf
      • timetracker.conf
      • your_app.conf
      • ...

    • conf.d/
      • mediawiki.conf
      • mediawiki.conf -> /etc/mediawiki/apache.conf
      • phpmyadmin.conf -> ../../phpmyadmin/apache.conf
      • your_app.conf
      • ...
      • charset
      • localized-error-pages
      • other-vhosts-access-log
      • security

    • conf-available/
      • mediawiki.conf
      • mediawiki.conf -> /etc/mediawiki/apache.conf
      • phpmyadmin.conf -> ../../phpmyadmin/apache.conf
      • your_app.conf
      • ...
      • charset
      • localized-error-pages
      • other-vhosts-access-log
      • security
    • conf-enabled/
      • ... -> ../conf-available/...

    • conf.d/
    • conf.d/
      • autoindex.conf
      • info.conf
      • languages.conf
      • mpm.conf
      • multilang-errordoc.conf
      • security.conf
      • ssl.conf
    • conf.d/
      • autoindex.conf
      • ssl.conf
      • userdir.conf
      • welcome.conf
    modules
    • modules.d/
      • 40_mod_ssl.conf
      • 70_mod_php.conf
      • 75_mod_perl.conf
    • mods-available/
      • actions.conf
      • actions.load
      • ...
    • mods-enabled/
      • ...
    • modules.d/
      • 00_base.conf
      • 00_mod_lua.conf
      • 00_mod_ssl.conf
      • 00_mod_systemd.conf
      • 00_mpm.conf
      • 00_mod_cgi.conf
    • conf.modules.d/
      • 00-base.conf
      • 00-dav.conf
      • 00-lua.conf
      • 00-mpm.conf
      • 00-proxy.conf
      • 00-ssl.conf
      • 00-systemd.conf
      • 01-cgi.conf
    a2enmod / a2dismod
    • mods-available/
      • actions.conf
      • actions.load
      • ...
    • mods-enabled/
      • ...

    • extramodules -> ../../usr/lib/apache-extramodules/
    • lib -> ../../usr/lib/
    • logs -> ../../var/log/httpd/
    • modules -> ../../usr/lib/apache/
      • mod_*.so


    • logs -> ../../var/log/httpd/
    • modules -> ../../usr/lib64/httpd/modules/
      • mod_*.so
    • run -> ../../run/httpd/
    • logs -> ../../var/log/httpd
    • modules -> ../../usr/lib64/httpd/modules/
      • mod_*.so
    • run -> /run/httpd


  • Utils
    • a2query
      • get the Apache version
        • a2query -v
    • a2ensite
    • a2dissite
    • a2enmod
    • a2...
  • Configuració / Configuration
    • Virtual hosts (vhosts.d, sites-available)
    • /etc/httpd/conf/httpd.conf or /etc/apache2/apache2.conf
      • ServerName your_ip_address
      • Logs
      • Variables d'entorn / Environment variables
        • SetEnv VARIABLE toto_value
        • test CGI to print them all
      • MPM
        • mpm_prefork_module
          • number of childs: StartServers, MinSpareServers, MaxSpareServers, MaxClients
            • number of requests per child: MaxRequestsPerChild
  • Rewriting
  • Scripts d'instal·lació / Installation scripts
    • Script d'instal·lació per a Django / Django installation script
    • estructura / structure:
      • webapp_name
        • apache_config
          • install_apache.sh
          • webapp_name.conf
        • index.html
        • js/
        • css/
        • ...
      • install_apache.sh
        • #!/bin/bash
          EXPECTED_ARGS=1
          if [ $# -ne $EXPECTED_ARGS ]
          then
              cat <<EOF
          Usage: `basename $0` webapp_name

          Example: `basename $0` hbbtv

          Actions:
          - copy webapp_name.conf to apache configuration directory (e.g. /etc/httpd/conf/webapps.d/)
          - recursively copy .. (parent directory, except apache_config) to apache directory (e.g. /var/www/webapp_name/)
          - change the owner and group of the files and directories to the right ones

          The following typical OS are automatically detected:
          - Red Hat, CentOS, Mageia, ...
          - Debian, Ubuntu, ...
          - MAC OSX (MAMP)
          EOF
              exit 1
          fi

          webapp_name=$1

          webapp_dir=/var/www/${webapp_name}

          # Red Hat, CentOS, Mageia, ...
          if [ -f /etc/httpd/conf/httpd.conf ]
          then
              httpd_config=/etc/httpd/conf/httpd.conf
              webapp_conf_dir=/etc/httpd/conf/webapps.d/
             
              grup_httpd=`grep "^Group" $httpd_config | awk '{print $2}'`
              usuari_httpd=`grep "^User" $httpd_config | awk '{print $2}'`
          fi

          # MAC OSX
          if [ -f /Applications/MAMP/conf/apache/httpd.conf ]
          then
              httpd_config=/Applications/MAMP/conf/apache/httpd.conf
              webapp_conf_dir=/Applications/MAMP/conf/apache/extra
              webapp_dir=~/sites/${webapp_name}
          fi

          # Debian, Ubuntu, ...
          if [ -f /etc/apache2/apache2.conf ]
          then
              httpd_config=/etc/apache2/apache2.conf
              webapp_conf_dir=/etc/apache2/conf.d/
             
              usuari_httpd=`awk -F= '/APACHE_RUN_USER/ {print $2}' /etc/apache2/envvars`
              grup_httpd=`awk -F= '/APACHE_RUN_GROUP/ {print $2}' /etc/apache2/envvars`
          fi

          # còpia recursiva de la webapp
          echo "copying application $webapp_name to $webapp_dir"
          mkdir -p $webapp_dir
          rsync -a --exclude='.git' --exclude='apache_config' .. $webapp_dir
          chown ${usuari_httpd}.${grup_httpd} -R $webapp_dir

          # webapp config
          echo "copying config file ${webapp_name}.conf to ${webapp_conf_dir}"
          cp ${webapp_name}.conf ${webapp_conf_dir}
  • Start server
    • Serveis / Service
    • apachectl / httpd
      • compiled in modules
        • apachectl -l
        • httpd -l
      • check syntax:
        • apachectl -t
        • httpd -t
      • loaded modules
        • apachectl -M
        • httpd -M
    • Logs
      • Apache Module mod_log_config
      • detailed log in error_log (or name specified by ErrorLog) file:
        • LogLevel debug
      • httpd.conf / apache2.conf
        • errors
          • ErrorLog "logs/error_log"
          • LogLevel debug
        • access
          • TransferLog  "logs/access_log"
          • # CustomLog with format nickname
            LogFormat "%h %l %u %t \"%r\" %>s %b" common
            CustomLog "logs/access_log" common
          • # CustomLog with explicit format string
            LogFormat "logs/access_log" "%h %l %u %t \"%r\" %>s %b"
          • # real remote ip when using AWS ELB load balancer (%a, %h give ELB ip address) LogFormat"%v %A %{X-FORWARDED-FOR}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" elb-ncsa
            CustomLog "logs/access_log" elb-ncsa
      • /etc/apache2/conf.d/other-vhosts-access-log
        • CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined
      • cat /etc/httpd/logs/error_log
      • grep httpd /var/log/messages
      • systemctl status httpd.service
      • httpd -e debug -E /tmp/toto.log
    • Problemes / Problems
      • /var/log/apache2/error.log
        • "Client denied by server configuration" / 403 Forbidden
          • Apareix al navegador com a: «Forbidden You don't have permission to access / on this server.»
          • Si feu servir Apache 2.4, comproveu que feu servir la directiva "Require all granted" i no "Order deny,allow", "Allow from all"
          • Comproveu que el directori dins de la directiva <Directory ...> és el correcte
          • Comproveu els permisos Unix amb / Check Unix permissions with:
            • namei -m /ful/path/to/index.html
        • ValueError: Unable to configure handler 'logfile': [Errno 13] Permission denied: .../logfile
          • Passa amb el log de Django. settings.py:
            • LOGGING = {
              ...
                  'handlers': {
                      'logfile': {
                          'filename': PROJECT_PATH + "/logfile",
          • Solució / Solution:
            • ...
      • CentOS / RHLE
        • "http dead but subsys locked" / /usr/sbin/httpd: Symbol lookup error: /usr/lib64/libaprutil-1.so.0: Undefined symbol: apr_os_uuid_get
  • Change listen ports
    • Debian
      • ports.conf
    • Mageia
      • /etc/httpd/conf/httpd.conf
        • Listen 8000 # can be specified in sites.d/toto.conf instead
      • /etc/httpd/conf/sites.d/00_default_vhosts.conf
        • Listen 8000
          <VirtualHost _default_:8000>
      • open firewall
    • RedHat / CentOS
      • SELinux: semanage (to avoid error "could not bind to address 127.0.0.1:12345 no listening sockets available, shutting down")
        • semanage port -l | grep -w http_port_t
        • semanage port -a -t http_port_t -p tcp 12345
      • Firewall / tallafoc
      • http.conf
        • Listen 12345
  • Directory index (per exemple: per a fer que serveixi index.html i no index.php, per omissió)
    • DirectoryIndex index.html
  • Accés des d'una subxarxa especificada / Access from a specified subnet
    • Allow from 192.168.1
      ErrorDocument 403 "Access denied per /etc/httpd/conf/webapps.d/my_webapp.conf"
  • CGI
    • mod_cgi
    • configuració / configuration
      • ScriptLog logs/cgi_log
      • ScripAlias /toto /var/www/cgi-bin/toto.cgi
    • /var/www/cgi-bin/
      • test_variables.cgi
        • #!/usr/bin/perl
          print "Content-type: text/html\n\n";
          foreach $key (keys %ENV) {
          print "$key --> $ENV{$key}<br>";
          }
    • http://localhost/cgi-bin/test.cgi
  • Directori addicional / Additional directory (/home/user1/other_dir to be accessed as http://server/new_dir/)
    • Option 1: in system directory
      • (cal? només usuari? només grup?) Check user and group permissions, according to directives in httpd.conf
        • # Mageia, CentOS, ... httpd_config=/etc/httpd/conf/httpd.conf
          usuari_httpd=`grep "^Group" $httpd_config | awk '{print $2}'`
          grup_httpd=`grep "^User" $httpd_config | awk '{print $2}'`
          chmod ${usuari_httpd}.${grup_httpd} -R ...
        • # Ubuntu
          usuari_httpd=`awk -F= '/APACHE_RUN_USER/ {print $2}' /etc/apache2/envvars`
          grup_httpd=`awk -F= '/APACHE_RUN_GROUP/ {print $2}' /etc/apache2/envvars`
          chmod ${usuari_httpd}.${grup_httpd} -R ...
    • Option 2: in user directory
      • Solution 1: symbolic link (no funciona / it does not work) (caldria FollowSymLinks?)
        • cd /var/www/html
        • ln -s /home/user1/parent_dir/other_dir new_dir
      • Solution 2: http.conf
        • Alias /new_dir /home/user1/parent_dir/other_dir <Directory "/home/user1/parent_dir/other_dir">
              Options -Indexes +FollowSymLinks +MultiViews
              AllowOverride None
              # Apache 2.2:
              #Order allow,deny
              #Allow from all
              # Apache 2.4:
              Require all granted
          </Directory>
      • Note: check the user permissions and owners of /home/user1/parent_dir/other_dir IMPORTANT: els passos següents no són necessaris si feu servir Apache 2.4 / next steps are not required when using Apache 2.4; check only that user running Apache has Unix permissions to read index.html
        IMPORTANT: parent directory must have execution permissions for group apache (or whatever group defined in Group directive in httpd.conf, or in APACHE_RUN_USER variable)
        • # usermod -a -G apache user1
        • # chgrp apache -R /home/user1/parent_dir/
        • # chmod g+x /home/user1/parent_dir/
        • # chmod g+rX -R /home/user1/parent_dir/other_dir
    • Option 3: in some other directory (e.g. a mounted external disk), owned by a user:
      • ...
  • Web Apps (webapps.d, sites.d, conf.d)
  • Cache
    • Controlar cache con Apache
    • <FilesMatch "\.(mpd|m4s)$">
        Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
      </FilesMatch>
  • CORS
    • httpd.conf or available-sites/default, ...:
      • #CORS
        Header set Access-Control-Allow-Origin "*"
        Header set Access-Control-Allow-Credentials "true"
        Header set Access-Control-Allow-Methods "POST,PUT,DELETE,GET, OPTIONS"
        Header set Access-Control-Allow-Headers "Content-Type"
        Header set Access-Control-Expose-Headers "Location"
  • HTTPS (see also: Seguretat en WWW / WWW security)
    • Apache modules installation:
      • urpmi apache-mod_ssl
    • Autenticació de servidor amb certificat autosignat / Server authentication with self-signed certificate
      • Mageia:
        • [cd /etc/httpd/conf/vhosts.d; cp 01_default_ssl_vhost.conf 02_hostname_ssl_vhost.conf]
        • canvi de port 443 -> 8443:
          • httpd.conf (diu quins ports obre per a escoltar)
            • Listen 8443
          • 01_default_ssl_vhost.conf (diu a quin dels ports on està escoltant fa referència)
            • <VirtualHost _default_:8443>
      • Ubuntu:
        • cd /etc/apache2/sites-enabled; sudo ln -s ../sites-available/default-ssl 001-default-ssl
        • cd /etc/apache2/mods-enabled; sudo ln -s ../mods-available/ssl.conf .; sudo ln -s ../mods-available/ssl.load .
        • canvi de port 443 -> 8443:
          • ports.conf (diu quins ports obre per a escoltar)
            • Listen 8443
          • default-ssl (diu a quin dels ports on està escoltant fa referència)
            • <VirtualHost _default_:8443>
        • sudo service apache2 restart
    • Autenticació de servidor / Server authentication:
      • Info
      • Passos / Steps:
        1. Creeu una CA amb OpenSSL / Create a CA with OpenSSL
        2. Creeu un certificat de servidor amb OpenSSL i / Create a server certificate with OpenSSL and:
          • mv /etc/pki/tls/newcert.pem /etc/pki/tls/certs/hostname_server.crt
          • mv /etc/pki/tls/newkey.pem /etc/pki/tls/private/tva_server.key
        3. Configuració del servidor Apache / Apache server configuration:
          • /etc/hosts
            • your_ip_address hostname
          • /etc/httpd/conf/httpd.conf
            • LoadModule ssl_module modules/mod_ssl.so
          • cp /etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf /etc/httpd/conf/vhosts.d/02_hostname_ssl_vhost.conf
          • /etc/httpd/conf/vhosts.d/02_hostname_ssl_vhost.conf
          • to avoid entering the passphrase every boot, create an unsecure version of your key file:
            • cd /etc/pki/tls/private; cp hostname.key hostname.key.orig; openssl rsa -in hostname.key.orig -out hostname.key; chmod 700 hostname.key
        4. Configuració del client / Client configuration
          • import CA
          • connect to server:
            • https://...
          • Si la resposta és sec_error_inadequate_key_usage:
            • comproveu que al certificat del servidor, a keyUsage hi ha keyEncipherment
          • Si sec_error_reused_issuer_and_serial:
            • Netegeu la memòria cau del navegador / Clean the cache on the browser
          • Si sec_error_unknown_issuer:
            • Descarregueu el certificat de la CA i doneu-li permís per a identificar servidors www: "Confia en aquesta CA per identificar llocs web"
          • ssl_error_rx_record_too_long
            • check /var/log/httpd/ssl_error_log
        5. Accés des de client / Access from client:
      • ...
        • mv newcert.pem hostnameCert.prm; cp /etc/pki/tls/hostnameCert.prm /etc/pki/tls/certs/hostname_server.crt
        • mv newkey.pem hostnameKey.pem; cp /etc/pki/tls/hostnameKey.pem /etc/pki/tls/private/hostname_server.key
    • Autenticació de client amb certificat / Client authentication with certificate
      • Info:
      • Passos / Steps:
        1. Creeu un certificat de client amb OpenSSL / Create a client certificate with OpenSSL (client.crt)
        2. Encapsuleu el certificat de client en un fitxer PKCS12 / Encapsulate client certificate into a PKCS12 file (client.p12)
        3. Configuració del servidor Apache / Apache server configuration:
          • import CA certificate
            • creat per nosaltres / created by us
              • cp ...
            • altres / others (e.g. for DNIe)
              • cd /etc/pki/tls/certs/
              • wget http://www.dnielectronico.es/ZIP/ACRAIZ-SHA1.zip
              • unzip ACRAIZ-SHA1.zip
              • conversion from DER to PEM:
                • openssl x509 -in ACRAIZ-SHA1.crt -inform DER -out ACRAIZ-SHA1.crt -outform PEM
          • Host based:
            • /etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf
              • SSLEngine on
                #CA certificate (PEM encoded) whose client certificates the server is prepared to accept
                SSLCACertificateFile
                /etc/pki/tls/certs/ACRAIZ-SHA1.crt
                SSLVerifyClient require
                SSLVerifyDepth  10
            • el navegador presentarà una llista dels certificats de client disponibles, però només aquells que hagin estat emesos per la CA especificada a SSLCACertificateFile (TLS: RFC 4336 7.4.4 "Certificate request")
          • Directory-based: Authentication with a certificate:
        4. Configuració de client / Client configuration:
          • Si el client es connecta amb un navegador / If the clients connects from a web browser:
          • Si el client es connecta per línia de comanda / If the client connects from command line:
            • la CA li ha de passar el certificat de client (client_pem.crt), la clau de client (client_pem.key) i el certifcat de la CA (root_ca_pem.crt)
            • el client es connecta de forma segura:
              • wget --certificate=client_pem.crt --private-key=client_pem.key --ca-certificate=root_ca_pem.crt https://...
          • Perquè el navegador oblidi el certificat de client amb què s'ha connectat:
            • Eines -> Neteja l'historial recent -> Sessions actives
          • Si quan el client es connecta apareix un error del tipus ssl_error_handshake_failure_alert, pot ser que:
            • el client no tingui instal·lat cap certificat de client (per exemple, el DNIe)
            • (el servidor no tingui el SSLCACertificate adequat)
          • Si ssl_error_unknown_ca_alert
            • el servidor no té el SSLCACertificate adequat
    • Autenticació de client sense certificat / Client authentication without certificate (basic authentication)
      • Info:
      • Passos / Steps:
        1. Configuració del servidor Apache / Apache server configuration:
          • Install mod_auth_basic, mod_auth_digest (mod_auth_cert?)
            • urpmi ...
          • mkdir /var/www/passwd
          • htpasswd -c /var/www/passwd/passwords user_name
          • /etc/httpd/conf/httpd.conf
            • <Directory "/var/www/html/protegit">
                AuthType Basic
                AuthName "Zona protegida"
                # (Following line optional)
                AuthBasicProvider file
                AuthUserFile /var/www/passwd/passwords
                Require valid-user
              </Directory>
          • http://server/protegit/
    • Certificate Revocation List (CRL)
  • WebDAV
    • urpmi apache-mod_dav
    • httpd.conf:
      • Listen 8080 (optional)
      • LoadModule dav_module modules/mod_dav.so
      • LoadModule dav_fs_module modules/mod_dav_fs.so
      • LoadModule dav_lock_module modules/mod_dav_lock.so
      • DAVLockDB /var/lock/apache2/DAVLock
        Alias /toto /var/www/toto
        <Location /toto>
          Dav on
        </Location>
        <Directory "/var/www/toto">
            Options -Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
    • client
  • Llengües / Languages
  • Balanceig de càrrega / Load balancing

OpenSSL

Nginx

  • Installation from packages
    • CentOS
      • nginx -V
        • nginx version: nginx/1.10.1
          built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
          built with OpenSSL 1.0.1e-fips 11 Feb 2013
          TLS SNI support enabled
          configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'
  • Installation from source
    • Add user nginx
      • CentOS, Mageia
        • sudo adduser --system --no-create-home --user-group -s /sbin/nologin nginx
      • Ubuntu
        • sudo adduser --system --no-create-home --disabled-login --disabled-password --group nginx
    • Dependències / Dependencies
      • module
        Mageia
        CentOS
        --with-http_xslt_module lib64xslt-devel
        libxslt-devel
        --with-http_ssl_module

    • Modules
    • Compilació / Compilation (Building nginx from Sources) ():
      1. nginx_version=1.16.1
      2. wget http://nginx.org/download/nginx-${nginx_version}.tar.gz
      3. tar xvzf nginx-${nginx_version}.tar.gz
      4. cd nginx-${nginx_version}
      5. additional modules
        • arut
          • git clone git://github.com/arut/nginx-rtmp-module.git
          • cd nginx-rtmp-module
          • nginx_rtmp_module_version=v1.2.1
          • git checkout ${nginx_rtmp_module_version}
          • cd ..
        • bbc (solves problem with Wirecast)
          • git clone git://github.com/bbc/nginx-rtmp-module.git
          • sed -i.bak '/#define NGINX_RTMP_VERSION/ c\#define NGINX_RTMP_VERSION  "1.2.1.bbc"' nginx-rtmp-module/ngx_rtmp_version.h
        • nginx-upload-module
          • wget -O nginx-upload-module-2.2.tar.gz https://github.com/vkholodkov/nginx-upload-module/archive/2.2.tar.gz
          • tar xvzf nginx-upload-module-2.2.tar.gz
      6. ./configure [--with-debug] --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/nginx.pid --user=nginx [--with-http_ssl_module] [--with-http_xslt_module] [--add-module=./nginx-rtmp-module] [--add-module=./nginx-upload-module-2.2] --with-cc-opt="-Wimplicit-fallthrough=0"
      7. make
      8. su; make install
    • Problemes / Problems
    • Nginx init scripts
      • CentOS
        • Systemd
          • save it to:
            • /usr/lib/systemd/system/nginx.service
      • Ubuntu
    • Starting, Stopping, and Restarting Nginx
      • /usr/local/nginx/sbin/nginx
      • Open port 1935 (?)
      • Start
        • /usr/local/nginx/sbin/nginx
      • Stop
        • /usr/local/nginx/sbin/nginx -s stop
      • Reload config
        • /usr/local/nginx/sbin/nginx -s reload
    • Test
      • cd nginx-1.9.2/nginx-rtmp-module/test/
      • edit nginx.conf
        • /path/to/
      • cp nginx.conf /usr/local/nginx/conf/
      • /usr/local/nginx/sbin/nginx
      • publish:
        • ./ffstream.sh
        • with ffmpeg
          • ffmpeg -loglevel verbose -re -i sintel-1024-stereo.mp4 -c copy -f flv rtmp://localhost/myapp/mystream
      • play:
        • ./play.sh
        • ffplay -loglevel verbose "rtmp://localhost/myapp/mystream"
      • statistics:
    • Config
      • Django wsgi
      • /usr/local/nginx/conf/
        • nginx.conf
          • ...
          •         location /stat.xsl {
                        # you can move stat.xsl to a different location
                        #root /usr/build/nginx-rtmp-module;
                        root /home/cesc/src/nginx-1.7.0/nginx-rtmp-module;
                    }
    • Debug and logs
    • Publish to server
      • ffmpeg -re -i sintel-1024-stereo.mp4 -c copy -f flv rtmp://localhost/myapp/mystream
    • Play from server:
      • ffplay rtmp://localhost/myapp/mystream
    • Status

Memcached

  • Instal·lació / Installation
  • Configuració / Setup
    • /etc/sysconfig/memcached
      • tcp port
        • PORT="11211"
          USER="memcached"
          MAXCONN="1024"
          CACHESIZE="64"
          OPTIONS=""
      • unix socket
        • ...
          OPTIONS="-s '/var/run/memcached/memcached.sock' -a 0766"
  • Ús / Usage
    • Django
    • Stats
      • memcached-tool 127.0.0.1:11211
      • memcached-tool 127.0.0.1:11211 stats
      • echo stats | nc localhost 11211

XAMPP

  • XAMPP
  • To be accessible from outside (and on port 8080) http://192.168.1.15:8080
    • <install_dir>\xampp\apache\conf\httpd.conf
      • Listen 8080
      • ServerName 192.168.1.15
    • <install_dir>\xampp\apache\conf\extra\httpd-xampp.conf
      • # Close XAMPP security section here
        <LocationMatch "^/(?i:(?:security))">
            Order deny,allow
            #Deny from all
            #Allow from ::1 127.0.0.0/8
            ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
        </LocationMatch>

        # Close XAMPP sites here
        <LocationMatch "^/(?i:(?:xampp|licenses|phpmyadmin|webalizer|server-status|server-info))">
            Order deny,allow
            #Deny from all
            #Allow from ::1 127.0.0.0/8
            ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
        </LocationMatch>
  • ...

Tomcat

  • Per a instal·lar-lo en MS Windows, falta el fitxer:
  • Axis2: name of the host behind a NAT (wdsl file) (*)
    • WEB-INF/conf/axis2.xml
      • <axisconfig name="AxisJava2.0">
              ...
            <!-- Following parameter will set the host name for the epr-->
            <parameter name="hostname" locked="true">myhost.com</parameter>

Django

Squid (HTTP Proxy)

  • Info
  • Server
    • Install
      • Mageia
        • urpmi squid
    • Setup
      • /etc/squid/squid.conf
        • acl localnet src <client_ip>/32
          http_access allow localnet
    • Start
      • sudo systemctl start squid.service
  • Client (<client_ip>)
    • export http_proxy='http://<server_ip>:3128'
      export https_proxy='http://<server_ip>:3128'
      export ftp_proxy='http://<server_ip>:3128'

DOS-UNIX

  • Per a canviar el tipus de fitxer de DOS (amb retorns de carro ^M) a UNIX (retorns de carro senzills): dos2unix
  • Noms de fitxer de majúscula a minúscula:
    • #! /bin/csh
      foreach f ( * )
      mv $f `echo $f | tr '[A-Z]' '[a-z]'`
      end
    • #! /bin/bash
      for f in *;
      do mv $f `echo $f | tr '[A-Z]' '[a-z]'`;
      done

Canvi de nom 

  • #! /usr/bin/bash
    comptador=1;
    while test $comptador -le $1
    do
    mv Imatge${comptador}.hist Imatge${comptador}_rgb_256d.hist
    let comptador=$comptador+1
    done

Conversió de MS-Word a PDF

  • Des d'OpenOffice:
    1. Obriu el fitxer .doc i feu "Exporta com a PDF".
    2. Per a generar vistes prèvies i hiperenllaços: extendedPDF
  • Des de MS Word:
    1. Assegureu-vos que a Windows teniu configurada una impressora PostScript. Si no, aneu a Inici/Configuració/Impressores i afegiu-ne una altra, del tipus PostScript (p.ex. qualsevol HP LaserJet, o bé una genèrica).
    2. Obriu el fitxer amb MS Word.
    3. Imprimir / A fitxer: toto (assegureu-vos que a les opcions d'impressora hi ha Opcions de Postscript / Màxima portabilitat; si està activa l'opció de màxima velocitat podeu tenir problemes de numeració de les pàgines en el fitxer PS generat). La impressora seleccionada ha de ser la de tipus PostScript.
    4. Des de l'explorador de Windows (o similar) canvieu el nom de fitxer de toto.prn a toto.ps
    5. Feu la conversió de Postscript a PDF.
  • Des de MS Word:

Conversió de Postscript a PDF

  • UNIX
    1. ps2pdf toto.ps toto.pdf
  • MS Windows
    1. Obriu toto.ps amb el GSView (assegureu-vos que utilitzi Ghostscript >=6.01; si no, algunes lletres poden quedar amb quadrets [format bitmap en lloc del desitjat vectorial])
    2. Imprimiu-lo a fitxer amb el dispositiu pdfwrite: toto.pdf

Múltiple pàgina en PostScript

  • psnup -2 toto.ps toto.2.ps

PDF

  • Manipulació
    • pdftk
      • Manipulación de ficheros PDF (CRySoL)
      • separa en pàgines individuals / split into single pages:
        • pdftk toto.pdf burst
      • uneix documents / join documents:
        • pdftk 1.pdf 2.pdf cat output 12.pdf
      • afegeix un peu de pàgina / add a footer:
        • pdftk input.pdf multistamp footer.pdf output input_with_footer.pdf
      • compilation (Mandriva)
        • urpmi fastjar gcc-java
        • modify Makefile.Base:
          • ... -I$(JAVALIBPATH) -I/usr/include/libgcj-4.4.3 ...
        • make -f Makefile.RedHat
    • PDF-Xchange viewer
  • Edició
    • Inkscape

X-face

  • giftoppm face.gif | ppmtopgm |pgmnorm |pnmscale -xy 48 48 |pgmtopbm > face.pbm
  • pbmmake -white 48 48 |pnmpaste face.pbm 0 0 |pbmtoicon |tail +3 |compface > face.xface

Registre MS Windows

  • Auto login: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\
    • AutoAdminLogon REG_SZ 1
    • DefaultUsername REG_SZ usuari
    • DefaultPassword REG_SZ contrasenya
    • DefaultDomainName REG_SZ
  • Auto login gràfic: control userpasswords2
  • Execució a l'inici: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Xerces

  • Xerces C++ samples
  • MS Visual / MFC:
    • To avoid errors of type "error LNK2001: unresolved external symbol" about a function containing wchar:
      • Project Poperties (All Configurations) / Configuration Properties / C/C++ / Language / Treat wchar_t as Built-in type: No
  • Ambiguous DOMDocument
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentFragment
    • #define WIN32_LEAN_AND_MEAN // to vaoid using MSxml.h
  • DOMWriter
    • delete of object LocalFileFormatTarget to close and release the file
  • Active-X: to avoid failed registration, copy all xerces .lib and .dll files into the same directory of .ocx file to be registered.
  • Memory leaks
    • cal alliberar sempre el resultat d'un transcode (or better: use std:string instead of char*):
      • char *pStringValorNode;
      • pStringvalorNode = XMLString::transcode( nodeAtribut->getNodeValue() );
      • XMLString::release(&pStringValorNode);
  • Avoid loading (downloading) external DTD:
  • Read from memory (parse a string):
    • string cadena;
    • const char*  gXMLInMemBuf = cadena.c_str();
    • static const char*  gMemBufId = "prodInfo";
    • MemBufInputSource* memBufIS = new MemBufInputSource(
              (const XMLByte*)gXMLInMemBuf,
              strlen(gXMLInMemBuf),
              gMemBufId,
              false );
    • XercesDOMParser *parser = new XercesDOMParser;
    • parser->parse(*memBufIS);
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc = parser->getDocument();
  • Copy of a node:
    • same document:
      • nodeA2 = nodeA1->cloneNode( true );
      • nodeRootA->appendChild( nodeA2 );
    • different documents (docA -> docB):
      • nodeB1 = docB->importNode( nodeA1, true );
      • nodeRootB->appendChild( nodeB1 );
  • Moving nodes from one document (docA, containing nodeA1) to another (docB, containing elB1), using fragments:
    • nodeA1_bis = nodeA1->cloneNode(true); (true: recursive; false: non recursive)
    • fragA1 = docA->createDocumentFragment();
    • nodeAi = fragA1->appendChild(nodeA1_bis);
    • elB2 = docB->createElement("tag");
    • nodeB3 = docB->importNode( fragA1, true );
    • elB2->appendChild(nodeB3);

VMWare / QEmu

  • Install RPM:
  • urpmi kernel-desktop-devel
  • Launch config:
    • /usr/bin/vmware-config.pl
  • Resize virtual disk size
    1. vmplayer
    2. select virtual machine -> Settings -> Utilities -> Expand disk
    3. start guest OS (eg Mandriva) in safe mode
    4. #drakdisk -> resize partition
    5. reboot
  • Resize virtual disk file (6GB -> 8GB) (NOTA: les noves versions de vmplayer ja permet el redimensionament dels discos):
    1. Install needed software
      1. urpmi qemu
      2. urpmi dkms-kqemu (plf) (needed to activate -kernel-kqemu option)
    2. resize disk from several parts (option 1, recommended):
      1. qemu-img convert WindowsXP-s001.vmdk -O raw WindowsXP-s001.raw
      2. qemu-img convert WindowsXP-s002.vmdk -O raw WindowsXP-s002.raw
      3. qemu-img convert WindowsXP-s003.vmdk -O raw WindowsXP-s003.raw
      4. qemu-img convert WindowsXP-s004.vmdk -O raw WindowsXP-s004.raw
      5. cat WindowsXP-s001.raw WindowsXP-s002.raw WindowsXP-s003.raw WindowsXP-s004.raw > WindowsXP_8G.raw
      6. dd bs=1 if=/dev/zero of=WindowsXP_8G.raw seek=8G count=0
      7. qemu-img convert WindowsXP_8G.raw -O vmdk WindowsXP_8G.vmdk
    3. resize disk from several parts (option 2):
      1. qemu-img convert WindowsXP-s004.vmdk -O raw WindowsXP-s004.raw
      2. dd bs=1 if=/dev/zero of=WindowsXP-s004.raw seek=2G count=0
      3. qemu-img convert WindowsXP-s004.raw -O vmdk WindowsXP-s004.vmdk
      4. edit WindowsXP-s004.vmdk:
        • RW 6144 SPARSE "WindowsXP-s004.vmdk" -> RW 4192256 SPARSE "WindowsXP-s004.vmdk"
    4. resize disk from one part
      1. qemu-img convert WindowsXP_6GB.vmdk -O raw WindowsXP_8GB.raw
      2. dd bs=1 if=/dev/zero of=WindowsXP_8GB.raw seek=8G count=0
      3. qemu-img convert WindowsXP_8GB.raw -O vmdk WindowsXP_8GB.vmdk
    5. resize partition with Gparted-LiveCD (select "force Vesa"):
      1. (modprobe kqemu)
      2. qemu -kernel-kqemu [-no-kvm] -m 512 -k es -cdrom gparted-livecd-xxx.iso -boot d -hda WindowsXP_8G.vmdk
    6. cp WindowsXP.vmx WindowsXP_8G.vmx and edit it:
      1. ide0:0.fileName = "WindowsXP_8G.vmdk"
    7. vmplayer WindowsXP_8G.vmx
  • serial device on file.vmx:
    • serial0.present = "TRUE"
    • serial0.fileName = "Auto Detect"
    • serial0.autodetect = "TRUE"
    • serial0.hardwareFlowControl = "TRUE"
  • Xarxa / Network

NFS/Samba

  • server SMBFS
    • urpmi samba-server
    • add user
  • server NFS (configure with MCC or use the folowing:)
    • install service
      • CentOS
        • Chapter 18. Network File System (NFS)
        • Sharing files with NFSv4 on Fedora (Server & Client configuration)
        • Setting Up NFS Server And Client On CentOS 7
        • yum install nfs-utils nfs-utils-lib
        • firewalld
          • systemctl start firewalld.service
          • NFSv4
            • firewall-cmd --permanent --add-service=nfs
            • firewall-cmd --permanent --add-service=rpc-bind
            • firewall-cmd --permanent --add-service=mountd
          • firewall-cmd --reload
        • SELinux (in server or in client?)
          • option 1: booleans
            • getsebool -a | grep -i nfs
            • setsebool -P <someboolean>=1 <someotherbool>=1 ...
          • option 2: policy
            • grep rpc.statd /var/log/audit/audit.log | audit2allow -M mypol
            • semodule -i mypol.pp
        • NFSv4
          • systemctl enable rpcbind.service nfs-idmapd.service nfs-server.service
          • systemctl start rpcbind.service nfs-idmapd.service nfs-server.service
          • Problemes / Problems
            • # systemctl enable nfs-idmap.service
              Failed to execute operation: No such file or directory
              • Solució / Solution
                • /usr/lib/systemd/system/nfs-idmapd.service
                  • [Install]
                    WantedBy=multi-user.target
                • systemctl enable nfs-idmapd.service
        • NFSv3
          • systemctl start rpc-statd.service
          • systemctl start rpcbind nfs-lock nfs-idmap
      • Mageia
        • urpmi nfs-utils
        • service nfs-server start
        • firewall (shorewall) (Réseau Linux avec NFS - Mandriva) (Configuring NFS under Linux for Firewall control)
          • /etc/sysconfig/nfs-common:
            • STATD_OPTIONS="--port 4000"
          • service nfs-common restart
          • /etc/sysconfig/nfs-server:
            • RPCMOUNTD_OPTIONS="--port 4002"
          • service nfs-server restart
          • /etc/modprobe.conf:
            • options lockd nlm_udpport=4001 nlm_tcpport=4001
          • reboot computer
          • open ports: 111/tcp 111/udp 2049/tcp 2049/udp 4000:4002/tcp 4000:4002/udp
          • check port attibution:
            • rpcinfo -p
    • configure idmap
      • /etc/idmapd.conf
        • [General]
          Domain = domain.tld

          [Mapping]
          Nobody-User = nfsnobody
          Nobody-Group = nfsnobody
    • configure permissions
      • /etc/hosts.allow
        • rpcbind: 172.16.11.0/255.255.255.0
    • configure export points
      • /etc/exports
        • /tmp 172.16.11.0/24(no_all_squash,async,secure,no_subtree_check,ro)
        • # NFSv4 (in client: mount -t nfs4 server_address:/var/toto)
          /var/toto 172.16.11.0/24(rw,sync)
        • # NFSv4(in client: mount -t nfs4 server_address:/)
          /var/toto 172.16.11.0/24(rw,sync,fsid=0)
        • # NFSv4 (in client: mount -t nfs4 server_address:/)
          # exported dir /mnt/vol1 is itself a mounted drive
          /mnt/vol1 172.31.0.0/16(rw,async,mountpoint=/mnt/vol1,fsid=0,no_root_squash)
      • Options
        • 21.6 NFS Server Configuration
        • 21.7 The /etc/exports Configuration File
        • Optimizing performance: Network File Systems (MythTV)



        • optimized
          (suggested by MythTV)
          general options ro, rw
          read only, read and write

          insecure
          allow connections from port 1024 and higher

          insecure_locks
          allow insecure file locking

          no_subtree_check
          disable subtree checking

          sync / async
          sync write operations on request
          async
          no_wdelay
          force sync of write operations immediately

          nohide
          do not hide filesystems beneath

          mountpoint[=/mnt/xxx]
          export only if mounted

          fsid=X
          set explicit filesystem ID

          tcp / udp

          udp
          user access
          no_root_squash
          remove map of root in client to anonymous in server (use carefully)

          all_squash
          map all users in client to anonymous in server

          anonuid
          specify uid of the anonymous user in server

          anongid
          specify gid of the anonymous group in server
    • manage export points
      • exportfs man page
      • list of export points
        • exportfs
      • reload (-r) all (-a) exports points
        • exportfs -rav
      • unexport (-u) all (-a) export points
        • exportfs -uav
  • client SAMBA from Unix (*):
    • urpmi mount-cifs [samba_client]
    • mount -t [cifs,smbfs] //server/dir /mnt/toto -o username=usuari_remot,password=contrasenya_remota
    • mount -t [cifs,smbfs] //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd
    • /home/usuari_local/.smbpasswd
      • username=usuari_remot
      • password=contrasenya_remota
    • server client
      mount /etc/fstab
      CIFS no UNIX ext mount -t cifs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd,
      uid=usuari_local,gid=grup_local
      //server/dir /mnt/toto cifs credentials=/home/usuari_local/.smbpasswd, uid=usuari_local,gid=grup_local 0 0
      UNIX ext mount -t cifs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd //server/dir /mnt/toto cifs credentials=/home/usuari_local/.smbpasswd 0 0
      Samba mount -t smbfs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd,
      uid=usuari_local,gid=grup_local,nounix
      //server/dir /mnt/toto smbfs credentials=/home/usuari_local/.smbpasswd, uid=usuari_local,gid=grup_local,nounix 0 0
    • cli
    • GUI
      • konqueror/dolphin: smb://usuari_remot@server/dir
    • if local computer is using UTF8:
      • ... iocharset=utf8,credentials=...
    • Explora / Browse
      • findsmb
        • Instal·lació / Installation
          • urpmi samba
      • nmblookup domain_name
        • nmblookup WORKGROUP
      • smbclient -L192.168.1.100
        • without password:
          • smbclient -L192.168.1.100 -N
          • smbclient -L192.168.1.100 -U ' % '
    • Exemples / Examples
      • 4geek
      • ZTE F680 (ONT)
        • /root/.smbpasswd
          • username=
            password=
        • sudo mkdir /mnt/ont
        • sudo mount -v -t cifs //192.168.1.1/samba /mnt/ont/ -o credentials=/root/.smbpasswd -o vers=1.0
    • Problemes / Problems
      • check dmesg
      • Server requested LANMAN password (share-level security) but 'client lanman auth = no' or 'client ntlmv2 auth = yes'
        tree connect failed: NT_STATUS_ACCESS_DENIED
        • Solució / Solution
          • a l'ordinador que fa de client:
            • /etc/samba/smb.conf
              • [global]
                client lanman auth = yes
                client ntlmv2 auth = no
      • only first character of filenames or directories is shown
        • No subject (Re: smbmount from Linux to an AS/400)
        • wireshark
          • a byte 00 is following any single character:
            • u 00 s 00 b 00 2 00 _ 00 1 00 _ 00 1 00/7
      • ??????????  ? ?       ?   ?                ? directory
        • Solution: umount -l /mnt/directory
    • Grups secundaris / Supplementary groups
      • feu servir CIFS / UNIX ext
      • a l'ordinador local heu de tenir el mateix user_id que al servidor
      • a l'ordinador local heu de pertànyer als mateixos grups secundaris que al servidor. Si pertanyeu a un grup secundari de forma local, però no al servidor, això no us donarà permisos addicionals al servidor! A la màquina local heu de fer:
        1. creeu els grups amb el mateix GID que al servidor:
          • # groupadd -g 8001 grup_secundari_1
          • # groupadd -g 8002 grup_secundari_2
          • ...
        2. assigneu a l'usuari aquests grups secundaris:
          • # usermod -a -G grup_secundari_1 grup_secundari_2 nom_usuari
        3. (opcional) si l'usuari no vol esperar a sortir i tornar a entrar, pot forçar l'actualització dels grups:
          • $ newgrp grup_secundari_1 grup_secundari_2
  • client NFS from Unix:
    • Mageia
      • urpmi nfs-utils-clients
      • needed?
        • service rpcbind start
        • service nfs-common start
      • Browse:
        • Dolphin: network NFS
    • CentOS
      • sudo yum install nfs-utils
    • Configure idmap
      • /etc/idmapd.conf
        • [General]
          Domain = domain.tld

          [Mapping]
          Nobody-User = nfsnobody
          Nobody-Group = nfsnobody
    • mkdir /mnt/toto
    • Mount temporarily:
      • mount -t nfs server:/var/toto /mnt/toto
      • mount -t nfs4 server:/var/toto /mnt/toto
    • Mount permanently:
      • /etc/fstab (see examples of present mounts at: /etc/mtab)
        • <ip-address-to-server>:/var/toto /mnt/toto nfs4 rsize=8192,wsize=8192,timeo=14,soft 0 0
        • Example (generated by manual mount in CentOS 7: mount -t nfs4 192.168.1.218:/ /mnt/nfs) in /etc/mtab
          • 192.168.1.218:/ /mnt/nfs nfs4 rw,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.236,local_lock=none,addr=192.168.1.218 0 0
      • Common NFS mount options



        • optimized
          general options
          hard / soft
          soft: not recommended when using a very busy server

          timeo=value_seconds
          default: 600

          actimeo=value_seconds

          actimeo=0
          sync / async

          async
          intr
          Makes I/O to a NFS mounted filesystem interuptable if the server is down intr
          nfsvers={2,3}


          vers=4.0


          nolock


          noexec


          namlen=255


          port=num


          rsize=num,wsize=num
          default for v2,v3: 8192; default for v4: 32768 (CentOS: 262144)
          rsize=32768,wsize=32768
          sec={sys,krb5,krb5i,krb5p}


          tcp / udp


          proto=tcp


          retrans=2


          relatime


          noatime


          user access
          nosuid

          noacl

      • Check real values:
        • cat /proc/mounts
    • User permissions
      • create a dir owned by a user with login:
        • su my_user -c "mkdir /mnt/nfs/my_dir"
        • the following variant cannot be called from userdata in aws cloudformation because you cannot use sudo in it (you will have the error "sudo: sorry, you must have a tty to run sudo"):
          • sudo su - my_user -c "mkdir /mnt/nfs/my_dir"
      • create a dir owned by a user without login:
        • su nginx -s /bin/bash -c "mkdir /mnt/nfs/my_dir; chmod 777 /mnt/nfs/my_dir; chmod g+s /mnt/nfs/my_dir"
    • Utils
      • List exported dirs in a remote server:
        • showmount -e <remote_server_ip_address>

Compartició de carpetes en MS Windows / MS Windows sharing folders

  1. Comparteix la carpeta / Share the folder
  2. Dóna permisos a l'usuari
    • Properties / Security / Add / Advanced options / Search now
    • if Security tab is not present:
      • Tools / Folder options / View / (don't use) Simple file sharing

Open Office / Libre Office

  • Configuració / Settings
    • ~/.config/libreoffice/
  • Línia d'ordres / Command line
  • Tipus de lletres generals / General fonts
    • Eines -> Opcions -> OpenOffice.org Writer -> Tipus de lletra bàsic
  • Plantilles / Templates (.ot*)
  • Writer
    • Estils i formatació / Styles and formatting
      • Estils -> Gestiona els estils (F11)
      • quan us situeu sobre un lloc del document se us ressaltarà el seu estil a la finestra del estils
      • des de qualsevol lloc, si aneu a Estils -> Edita l'estil..., editareu l'estil que hi ha aplicat en aquell punt, i totes les modificacions s'aplicaran automàticament a tots els altres elements que fan servir aquell estil
      • per a recuperar els valors originals d'un estil, editeu-lo i cliqueu sobre «Reinicialitza els valors heretats»
      • formatació directa
        • si voleu modificar puntualment l'estil d'una part (p.ex. una paraula) podeu fer servir alguna d'aquestes opcions:
          • Format -> ...
          • el tipus de lletra o mida des de la barra d'eines de formatació (apareix amb: Visualitza -> Barra d'eines -> Formatació)
        • per a tornar a l'estil que li tocaria:
          • (botó dret) Neteja la formatació directa
        • si voleu que l'estil passi a tenir les característiques puntuals:
          • Estils -> Actualitza l'estil seleccionat
      • Copying and moving styles
      • Aplicar estils d'una pàgina mestra (ooimpress)
        • A partir d'una pàgina mestra:
          • Plafó lateral dret: Pàgines mestres -> Disponibles per a ser utilitzades (les de ~/.ooo3/user/template/)
          • Si heu modificat la pàgina mestra d'una plantilla disponible, haureu de tancar i tornar a obrir l'OpenOffice perquè els canvis es recarreguin.
        • Per a tenir més pàgines mestres disponibles, a partir de plantilles (Load additional slide masters):
          • Format -> Disseny de la diapositiva -> Carrega -> Les meves plantilles (potser les que ja surten no són les de ~/.ooo3/user/template/)
        • Si es vol importar la pàgina mestra des d'una altra presentació, primer s'haurà de desar aquesta altra presentació com a plantilla, i després aplicar el procediment descrit en el punt anterior.
    • Portada
      • situeu-vos a la primera pàgina
      • Format -> Portada... -> Converteix les pàgines existents a portades
    • Numeració dels capítols (seccions i subseccions)
      • Eines -> Numeració de capítols
      • A la taula de continguts, per a afegir un espai entre el nombre i el títol
    • Taula de continguts / Table of content
      • Insereix -> Índexs i taules -> Taula de continguts, índex o bibliografia
      • Espai entre la numeració i el títol de secció
        • Insereix -> Índexs i taules -> Índexs i taules -> Entrades
          • A la casella en blanc que hi ha entre «E#» i «E» poseu-hi un espai (amb el teclat)
      • Make Table of Contents hyperlink?
        • (menú contextual) Edita l'índex o la taula -> Entrades
        • a la posició desitjada (casella en blanc), amb el botó Enllaç, incloure principi d'enllaç (LS); a la posició final, tornar a prémer el botó Enllaç per a posar un final d'enllaç (LE). El text així delimitat serà clicable.
    • Removing line breaks
      • Tools / AutoCorrect/AutoFormat
      • Options: Combine single line paragraphs if length is greater than 50%
      • Select text
      • Apply Style: Default
      • Format / AutoFormat / Apply
    • Peus / capçaleres
      • Per a distingir entre capçalera i peu per a la primera pàgina i la resta, assegureu-vos que el format de pàgina és el que correspon:
        • Visualitza -> Barra d'eines -> Formatació
        • Estils de pàgina -> Primera pàgina / Per defecte
      • Activeu capçalera/peu:
        • (Estil de pàgina -> Primera pàgina / Per defecte): menú -> Modifica -> Capçalera/Peu de pàgina -> Activa
      • Editeu-los normalment
      • Per a posar text a l'extrem dret i a l'esquerre, separeu-lo amb tabuladors.
    • Una sola pàgina horitzontal / One single horizontal page
      • Re: [libreoffice-users] How do I change page orientation for only ONE page in Writer?
      • On ha de començar la pàgina horitzontal:
        • Insereix -> Salt de pàgina
          • (click dret sobre el salt de pàgina) Edita el salt de pàgina
            •  Flux de text: Salts -> Insereix -> Amb estil de pàgina: Horitzontal
      • On han de començar una altra vegada les pàgines verticals:
        • Insereix -> Salt de pàgina
          • (click dret sobre el salt de pàgina) Edita el salt de pàgina
            • Flux de text: Salts -> Insereix -> Amb estil de pàgina: Estil de pàgina per defecte
    • Per a definir la llengua del text:
      • (impress) Format -> Caràcter -> Llengua
      • Per a tot el text:
        • Eines -> Opcions -> Language settings -> Languages -> Default languages for documents -> Només per al document actual
    • Per a activar la correcció ortogràfica automàtica:
      • Eines -> Opcions -> Configuració de la llengua -> Opcions: Revisa l'ortografia a mida que es teclegi
    • Per a activar/desactivar la substitució automàtica de paraules [suposadament] mal escrites:
    • Activeu el control de canvis: Edita -> Canvis -> Registra
    • L'estructura lògica s'ha de veure reflectida en la visió de l'estructura del document:
      • Edita -> Navegador
    • El cos de text ha de tenir l'estil "Cos de text".
    • Autofit text (Impress for Linux) equivalent:
      • Format -> Text -> Fit to frame
    • Per a incloure figures (dibuix fet amb Draw):
      • [creeu un marc]
      • Obriu la vostra figura amb el Draw, seleccioneu-la i copieu-la
      • Posicioneu-vos al lloc on la voleu enganxar (dins del marc si n'heu creat un)
      • Enganxeu la figura
      • Per a posar un peu:
        • [seleccioneu el marc]
        • menú contextual: Llegenda...
      • Posicionament del marc (marc = imatge+llegenda):
        • Alineació -> Centrada
        • Àncora -> Al paràgraf
        • Ajusta -> Sense ajustament (Cap)
      • Nota: si la lletra us surt massa grossa, l'haureu de canviar prèviament al Draw.
    • Per a incloure figures (imatge):
      • Insereix -> Imatge...
      • Si encara no té llegenda, afegiu-la amb el menú contextual: Insereix una llegenda...
      • Per a properes ocasions, si voleu que cada vegada que s'insereixi una imatge es posi automàticament una llegenda:
        • Eines -> Opcions -> OpenOffice.org writer -> Llegenda automàtica -> Imatge de l'OpenOffice Writer -> Categoria: Figura
      • Posicionament del marc (marc = imatge+llegenda) (NO de la imatge) amb el menú contextual:
        • Alinea els objectes -> Centrat
        • Àncora -> Al paràgraf
        • Ajusta -> Cap
      • Referència a una figura:
        • Insereix -> Referència creuada
          • Tipus: Figura
          • Consulteu utilitzant: Categoria i número
    • Inclusió de fitxers PDF:
      • si teniu un fitxer EPS, el podeu convertir a PDF amb: eps2pdf
      • Insereix -> Objecte -> Objecte OLE -> Crea'n un a partir de fitxer
      • es veurà bé a la pantalla i s'imprimirà en alta qualitat
    • Inclusió de fitxers EPS:
      • el fitxer EPS a inserir ha d'haver estat normalitzat amb eps2eps.
      • des de l'OpenOffice: Insereix -> Imatge -> Des d'un fitxer
      • es veurà bé a la pantalla i s'imprimirà en alta qualitat
    • Taules
      • Tipus de numeració:
        • ...
      • Peu automàtic de taules:
        • Eines -> Opcions -> OpenOffice.org writer -> Llegenda automàtica -> Taula de l'OpenOffice Writer -> Categoria: Taula
    • Per a eliminar les modificacions locals de format respecte el format de l'estil:
      • Format -> Formatació per defecte
    • Bibliografia
      • Base de dades
        • Eines -> Base de dades bibliogràfica
      • Referència des d'un paràgraf:
        • Insereix -> Índexs i taules -> Entrada bibliogràfica
      • Llista de les referències citades des del document
        • Insereix -> Índex i taules -> Taula de continguts, índex o bibliografia -> Tipus: Bibliografia
      • Perquè la secció Bibliografia aparegui a l'índex de continuguts:
        • Bibliografia (botó dret) Edita l'índex -> Estils
          • seleccioneu a l'esquerra: Títol [Encapçalament de la bibliografia]
          • seleccioneu a la dreta: Encapçalament 1
          • cliqueu sobre el botó <
            • a l'esquerra ara tindreu: Títol [Encapçalament 1]
    • Clipart (png, svg)
      • urpmi clipart-openclipart
      • Eines -> Galeria
    • Enllaços / Hyperlinks
      • Using hyperlinks
      • Edita / Edit:
        • Select hyperlink
        • Edit -> Hyperlink
      • Exportació a PDF
    • Conversió a PDF
      • Enllaços / Hyperlinks
      • Problemes
        • Si s'han importat fletxes grosses bidireccionals des d'un MSPowerPoint, l'OpenOffice petarà quan s'intenti fer una exportació a PDF.
        • Okular
          • no apareixen els enllaços
            • assegureu-vos que esteu en mode «Visualització» (i no en «Selecció de text»)
    • Signatura digital / Digital signature
      • Eines -> Opcions -> LibreOffice -> Seguretat -> Camí del certificat
        • assegureu-vos que és el mateix directori que fa servir Firefox
          • p.ex: firefox:default (~/.mozilla/firefox/xxxxxxxx.default/)
      • Comproveu que heu afegit els certificats arrel i hi confieu
        • ...
      • Per a signar un document open document (odt, ...)
        • Fitxer > Signatures digitals > Signatures digitals...
          • Signa el document...
            • us hauria de sortir una llista dels certificats disponibles; si us surt una llista buida, verifiqueu el «Camí del certificat»
            • seleccioneu-ne un
            • assegureu-vos que és vàlid fent «Mostra el certificat...»
              • si a la pestanya «General» us diu «No s'ha pogut validar el certificat»:
                • ...
            • «Signa»
              • si el cerificat no s'havia pogut validar, us apareixerà un avís: «Com a mínim una signatura té problemes: no se n'ha pogut validar el certificat»
      • Per a signar un document PDF generat a partir d'un open document:
        • Fitxer > Exporta com a PDF...
          • pestanya: Signatures digitals
            • Selecciona...
      • Per a signar un document PDF qualsevol (p.ex. okular)
      • Signing ODF and PDF documents with LibreOffice (Linux Kamarada)
        • Signing an ODF document
        • Checking the digital signature of an ODF document
        • Modifying a signed ODF document
        • Exporting a document as a signed PDF
        • Checking the digital signature of a PDF document
        • Checking the digital signature of a PDF document
        • Setting up LibreOffice to use Chromium certificates
      • ...
  • Impress
    • Pàgines mestres / Master pages
      • Visualitza -> Mestra -> Elements mestres...: data/hora, peu, número de diapositiva (cal tancar la mestra per a actualitzar)
      • Es poden afegir tantes pàgines mestres com calgui (com si fos una presentació normal): títol, contingut,...
    • Número de pàgina
      • A la diapositiva mestre cal que hi aparegui (Elements mestres)
      • i, a més, cal activar Visualitza -> Capçalera i peu
      • Es poden desactivar també amb si trieu Format - Disseny de la diapositiva i desactiveu la casella de selecció Objectes al fons.
    • Esquema / Outline
    • Numeració de les capçaleres / Heading numbering
      • Eines -> Numeració d'esquemes...
    • Nom de la diapositiva / Slide name
    • Text al voltant d'una imatge (adapta el text a un polígon) / Wrap text around an image (adapt text to a polygon)
      • creeu el rectangle principal
      • creeu el rectangle on posareu la imatge (es menjarà una part del rectangle principal)
      • seleccioneu: el rectangle principal, maj + rectangle secundari
      • Formes -> Resta
      • feu doble clic al polígon principal
      • escriviu el text
      • seleccioneu tot el text
      • menú amb el botó dret: Text...
        • Ajusta a la vora
      • per a modificar la forma del polígon:
        • seleccioneu-lo
        • menú botó dret: activeu Punts
  • Draw
    • Text alineat amb els connectors / Text aligned to the connectors:
      • Adjusting text to suit the connecting line
      • Configuració:
        • Visualitza -> Barres d'eines -> Formatació de text
          • (clic dret sobre la barra d'eines de formatació de text) Personalitza la barra d'eines... -> Categoria: Formata -> Fontwork -> (fletxa cap a la dreta)
        • Eines -> Personalitza -> Barres d'eines -> Barra d'eines: Dibuix -> Afegeix -> Formata -> Fontwork
      • Ús / Usage:
        • Seleccioneu el connector i cliqueu sobre la icona que acabeu d'afegir (Fontwork)
  • Calc
    • Congelació de files i columnes en un full de càlcul / Freeze rows and columns in a spreadsheet (*):
      • Seleccioneu la primera fila o columna o cel·la que volgueu que es pugui moure
      • Finestra -> Congela / Window -> Freeze
    • Entrada automàtica / Auto completion
    • Amaga i mostra files i columnes
      • Format -> {Fila,Columna,Full} -> {Amaga. Mostra}
    • Ordenació alfabètica / Alphabetic sort
      • Dades -> Ordena
    • Text a columnes / Text to column
    • Ordinals
      • Eines -> Opcions de correcció automàtica... -> Opcions de llengua -> Formata els sufixos dels nombres ordinals (1r -> 1^r)
    • Funcions del full de càlcul
      • CONSULTAV / VLOOKUP
        • poseu el 4t paràmetre a 0 per a trobar el valor exacte (no el primer que se li assembli)
    • Base de dades
    • Histograma / Histogram
    • Impressió / Print
      • límit de la pàgina
        • Visualitza > Salt de pàgina
  • Problemes amb Mandriva i KDE/Qt:
  • Bugs
    • Impress 2.1.7
    • un cop desada una plantilla, la llista de la diapositiva mestra no s'actualitza (aquesta mestra inactualitzable seguirà així en els documents creats a partir d'aquesta plantilla). Però l'estil, que és el que compta, es modificarà bé i serà el que s'aplica als documents creats a partir d'aquesta plantilla.
    • per a tornar a aplicar la mateixa plantilla un cop modificada, cal aplicar una altra plantilla, desar el document, tancar i obrir l'OpenOffice, i aplicar de nou la plantilla que hem modificat.

Google Docs

x264 compilation

  • Dependencies
    • Alma
      • sudo dnf install git nasm gcc make
  • git clone https://code.videolan.org/videolan/x264.git
  • cd x264
  • git checkout stable
  • ./configure --enable-shared
  • make
  • sudo make install
  • if you will want to compile ffmpeg with x264 support:
    • sudo make install-lib-shared
    • and configure ffmpeg with:
      • ...
  • if ...:
    • sudo make install-lib-static

x265 compilation

  • dependències / dependencies
    • Mageia
      • urpmi task-c++-devel
  • one of the following
    • x265.org
      • hg clone https://bitbucket.org/multicoreware/x265
    • Videolan x265
      • hg clone http://hg.videolan.org/x265
  • cd x265/build
  • cmake ../source
  • make
  • sudo make install
  • to avoid "ERROR: x265 not found" when configuring ffmpeg with --enable-x265, check that /usr/local/lib/pkgconfig is on pkg-config path:
    • pkg-config --list-all | grep x265
    • if nothing appears, then:
      • export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
      • to make it permanent:
        • ...

libav / ffmpeg compilation on Linux

  • See also GPAC compilation
  • How-To Build FFmpeg on Debian Squeeze
  • Dependencies
    • General
      • Mageia
        • 64 bits (x86_64)
          • urpmi glibc-devel libstdc++-devel gcc lib64SDL-devel lib64sdl2.0-devel lib64raw1394-devel lib64dc1394-devel lib64gsm-devel lib64speex-devel lib64zlib-devel yasm
        • 32 bits
          • urpmi libSDL-devel libdc1394-devel libgsm-devel libspeex-devel zlib-devel yasm
      • Mandriva:
        • urpmi libSDL-devel libdc1394-devel libgsm-devel libspeex-devel zlib1-devel yasm
      • Ubuntu
        • 32/64 bits
          • sudo apt-get install gcc make yasm
      • CentOS
        • CentOS 8
          • sudo dnf -y install epel-release
          • sudo dnf config-manager --set-enabled powertools
          • sudo dnf -y install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm
        • CentOS 7
          • sudo yum install http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
        • sudo yum install gcc make yasm
    • Specific

      • ffmpeg
        dependencies
        configure
        src Mageia
        Ubuntu
        CentOS / Alma

        --enable-gpl --enable-nonfree
        32-bit
        64-bit


        general






        gcc make yasm
        lib64freetype6-devel

        gcc make yasm gcc make yasm
        ffplay

        [--disable-ffplay]



        libsdl2.0-devel
        lib64sdl2.0-devel


        tls
        --enable-openssl




        libssl-dev openssl-devel
        pulse audio
        --enable-libpulse




        libpulse-dev pulseaudio-libs-devel
        audio codecs

        MP3
        --enable-libmp3lame


        liblame-devel lib64lame-devel libmp3lame-dev lame-devel
        AAC
        (native)







        --enable-libvo-aacenc


        libvo-aacenc-devel lib64vo-aacenc-devel libvo-aacenc-dev
        --enable-libfaac
        x

        libfaac-devel


        --enable-libfdk-aac
        x
        fdk-aac
        lib64fdk-aac-devel
        libfdk-aac-dev
        fdk-aac-devel
        AAC+
        --enable-libaacplus







        --enable-libfdk-aac
        x




        fdk-aac-devel
        HE-AAC
        --enable-libfdk-aac
        x




        fdk-aac-devel
        Opus
        --enable-libopus




        lib64opus-devel

        opus-devel
        Vorbis




        libvorbis-devel

        libvorbis-devel
        video codecs
        AV1








        Dirac
        --enable-libschroedinger


        libdirac-devel
        libschroedinger-devel
        lib64dirac-devel
        lib64schroedinger-devel
        libschroedinger-dev
        Theora
        --enable-libtheora


        libtheora-devel lib64theora-devel libtheora-dev libtheora-devel
        VPX (VP8, VP9)
        --enable-libvpx

        libvpx
        libvpx-devel lib64vpx-devel libvpx-dev libvpx-devel
        H.264 / AVC
        --enable-libx264 x

        x264 libx264-devel lib64x264-devel libx264-dev x264-devel
        H.265 / HEVC
        --enable-libx265

        x265


        x265-devel
        Xvid
        --enable-libxvid x


        libxvid-devel lib64xvid-devel lib64xvidcore-devel
        libxvidcore-dev
        image
        JPEG




        jpeg-devel



        JPEG 2000
        --enable-libopenjpeg



        libopenjpeg-devel lib64openjpeg-devel

        PNG




        libpng-devel


        WebP --enable-libwebp



        lib64webp-devel
        libwebp-dev
        libwebp-devel
        filters
        drawtext
        --enable-libfreetype [--enable-fontconfig]







        subtitles
        --enable-libass






        transport
        https
        --enable-openssl

        x






        SRT --enable-libsrt

        srt



        muxers DASH --enable-demuxer=dash --enable-libxml2






        hardware acceleration
        ./configure --list-hwaccels
        CUDA [--enable-cuvid]
        (auto enabled if devel libraries are installed)








        nvenc [--enabled-nvenc] (auto enabled)



        nv-codec-headers (ffnvcodec) libffmpeg-nvenc-dev
        nv-codec-headers

        OpenMAX --enable-omx
        --enable-omx-rpi




        ...


        v4l M2M








        VA API (Intel) [--enable-vaapi]
        (auto enabled if devel libraries are installed)




        lib64va-devel


        VDPAU (Nvidia) [--enable-vdpau] (auto enabled if devel libraries are installed)



        lib64vdpau-devel

      • ffmpeg >= 0.6.1:
        • urpmi tetex-texi2html libjack-devel libvpx-devel jpeg-devel libpng-devel bzip2-devel rtmp-devel vdpau-devel libva-devel libfaad2-devel opencore-amr-devel [x264-devel]
  • Baixada / Download
    • ffmpeg
      • releases
        • version="4.2.3"
          wget http://ffmpeg.org/releases/ffmpeg-${version}.tar.gz
          tar xvf ffmpeg-${version}.tar.gz
      • development (git repository):
        • git clone git://git.ffmpeg.org/ffmpeg.git (git clone git://github.com/FFmpeg/FFmpeg.git ffmpeg)
          • libvpx-decoder >=0.9.1
          • libx264 >= 0.99 (/usr/include/x264.h: #define X264_BUILD 99)
    • libav
      • versions
        • 9.8
          • wget http://www.libav.org/releases/libav-9.8.tar.gz
        • 0.8.7
          • wget http://www.libav.org/releases/libav-0.8.7.tar.gz
      • development (git repository):
        • first time:
          • git clone git://git.libav.org/libav.git libav
        • cd libav
        • not the first time:
          • git pull
  • Compilació / Compilation
    • Passos / steps
      1. configuration
        • License:
          configure option
          resulting license
          (no option)
          LGPL v3 or later
          --enable-nonfree nonfree and unredistributable
          --enable-gpl GPL v3 or later
        • Acceleració per maquinari / Hardware acceleration (Linux graphics (Intel))
        • AAC audio (MPEG-4)
          • option 1:
            • use native embedded aac encoder (not experimental any more)
            • if you are coding your own client, you need to allow experimental codecs:
              • p_codec = avcodec_find_encoder_by_name("aac");

                AVDictionary *opts = NULL;
                av_dict_set(&opts, "strict", "experimental", 0);
                if (avcodec_open2(p_codec_ctx, p_codec, &opts) < 0) {
                ...
          • option 2:
            • use an external coder:
              • ./configure ... --enable-libfdk-aac --enable-nonfree ...
                • p_codec = avcodec_find_encoder_by_name("libfdk_aac");
              • ./configure ... --enable-libvo-aacenc ...
                • p_codec = avcodec_find_encoder_by_name("libvo_aacenc");
          • Exemples / Examples:
        • Configuration examples:
          • H264 + AAC (native) + [https]
            • ./configure --enable-gpl --enable-libx264 --enable-shared [--enable-nonfree --enable-openssl]
          • H264 + HE-AAC (Fraunhofer)
            • ./configure --enable-nonfree --enable-libfdk-aac --enable-gpl --enable-libx264 --enable-shared
          • Usual codecs
            • ./configure [--enable-nonfree --enable-libfdk-aac] [--enable-gpl --enable-libx264 --enable-libxvid] --enable-libtheora --enable-version3 --enable-libschroedinger --enable-libmp3lame --enable-libvpx --enable-shared
          • SRT (srt.pc is installed in /usr/local/lib64/pkgconfig/)
            • PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig/:/usr/local/lib/pkgconfig/ ./configure --enable-libsrt ...
          • close to dextop for CentOS
            • --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'
              --enable-nonfree
              --enable-libfdk-aac
              --enable-gpl --enable-libx264 --enable-libx265
              --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads
              --disable-static --enable-shared --shlibdir=/usr/lib64 --enable-runtime-cpudetect
          • CentOS dextop
            • ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
                built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
                configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
      2. make
      3. sudo make install
      4. update ld:
        • echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
        • ldconfig
    • Problemes / Problems:
      • compatibility with gstreamer compilation
        • ffmpeg must be installed after gstreamer, because gstreamer is going to install its own version of ffmpeg headers in /usr/local/include/libavcodec ... and a missmatch between (minor) versions will occur:
          • installed by gstreamer:
            • grep "define LIBAVCODEC_VERSION_" /usr/local/include/libavcodec/version.h
          • installed by ffmpeg:
            • grep "define LIBAVCODEC_VERSION_" ~/src/ffmpeg-4.2.3/libavcodec/version.h
        • if gstreamer were installed after ffmpeg, janus will not be able to be compiled with postprocessing option --enable-post-processing
      • libavcodec/libavcodec.so: undefined reference to `x264_encoder_open_160'
        • ls -l /usr/local/lib64/ | grep libx264
          • lrwxrwxrwx. 1 root root        14 15 març 18:47 libx264.so -> libx264.so.160
            -rwxr-xr-x. 1 root root   9014288 15 març 18:42 libx264.so.160
      • missing some libx264-*ffpresets

ffmpeg compilation on MSWindows

  • using cygwin
    • [Mplayer-cygwin] list
    • setup Cygwin. Install packages:
      • make
      • gcc
      • diffutils (cmp)
      • patch
    • install and compile yasm (nasm not always works)

    • static dynamic
      x264
      (*)
      svn co svn://svn.videolan.org/x264/trunk x264

      patch -p0 < dll.patch
      ./configure ./configure --enable-shared
      modify config.mak:
      delete all -mno-cygwin occurences

      make libx264.a make
      install -m 644 libx264.a /usr/local/lib
      install -m 644 x264.h /usr/local/include
      make install
      ffmpeg svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
      modify libavcodec/mpegaudiodec.c. Add line:
      #define llrint lrint or apply a patch

      ./configure --enable-libx264 --enable-gpl ./configure --enable-shared --disable-static --enable-libx264 --enable-gpl
      make
      make install
  • using MinGW
    • ffmpeg Windows help
    • setup MinGW
      • install MSYS in c:\msys (from minGW / Download / Current)
        • MSYS_1.0.10.exe
      • install MinGW in c:\MinGW (from minGW / Download / Current) (use f.i. 7zip to untar)
        • MinGW Runtime: mingw-runtime-3.9.tar.gz
        • Windows API: w32api-3.6.tar.gz
        • binutils: binutils-2.15.91-20040904-1.tar.gz
        • GCC: gcc-core-3.4.2-20040916-1.tar.gz, gcc-g++-3.4.2-20040916-1.tar.gz
      • copy needed tools from MS Visual:
        • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\bin\lib.exe, link.exe -> c:\MinGW\bin
        • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Common7\IDE\mspdb71.dll -> c:\MinGW\bin
      • Start / MinGW / MSYS / msys.exe
    • install and compile yasm (nasm not always works)
    • compile x264
    • compile ffmpeg
    • cd /c/.../gpac_extra_libs/ffmpeg
    • ./configure --enable-shared --disable-debug --enable-memalign-hack
    • make

GPAC

  • Linux compilation
    • fmpeg / libav gpac



      ffmpeg configure
      errors when compiling gpac
      solutions
      dashcast problems
      library
      version
      ./configure
      gpac modifications from mpeg2video source

      extra_lib







      libav 9
      9.8





      9.10
      --enable-debug --enable-gpl --enable-libx264 --enable-version3 --enable-shared audio_decoder.c:215:58: error: ‘AVFrame’ has no member named ‘channels’: solved in r4959

      ok
      incorrect mp2 output audio (estrident) from aac input
      10





      git
      git





      ffmpeg 1.2
      1.2.4





      2.0
      2.0.2
      --enable-debug --enable-gpl --enable-libx264 --enable-version3 --enable-shared
      (no errors)
      ok incorrect mp2 output audio (estrident) from aac input
      2.1
      2.1.1 --enable-debug --enable-gpl --enable-libx264 --enable-version3 --enable-shared
      (no errors)
      -
      ok
      incorrect mp2 output audio (estrident) from aac input
      2.1.2

      2.1.3



      2.2
      2.2 --enable-debug --enable-gpl --enable-libx264 --enable-libx265 --enable-version3 --enable-shared --enable-avresample



      2.3
      2.3.3
      --enable-debug --enable-gpl --enable-libx264 --enable-libx265 --enable-version3 --enable-shared --enable-avresample --enable-libfreetype




      2.4






    • step 1: install needed libraries
      • to compile your own version of libav/ffmpeg, choose one of the following:
        • ffmpeg from source
        • libav from source
          • libav 9.10
            • cd libav-9.10; ./configure --enable-debug --enable-gpl --enable-libx264 --enable-version3 --enable-shared
          • GPAC rev >=4772 (22nd sep 2013): install and compile libav from git (55)
          • GPAC rev >= 4731: install or compile libav 9.8 (54) (only libs are needed):
          • GPAC rev < 4731: install or compile libav version 0.8.7 (53) (only libs are needed):
            • cd ~/src/libav-0.8.7/
            • make install-libs
        • gpac_extra_lib (ffmpeg and other libraries, provided by gpac)
          • steps
            • urpmi automake (to avoid aclocal not found)
            • cd gpac/extra_lib
            • wget https://sourceforge.net/p/gpac/code/HEAD/tree/trunk/gpac_extra_libs/gpac_extra_libs.zip
            • unzip gpac_extra_libs.zip
            • chmod +x compile.sh */configure */bootstrap
            • ./compile.sh
          • problems
            • configure.in:27: error: 'AM_CONFIG_HEADER': this macro is obsolete.
                  You should use the 'AC_CONFIG_HEADERS' macro instead.
      • Paquets / Packages
        • CentOS
          • sudo yum install ...
        • Mageia 2/3/4, 64bit:
          • if you have compiled your own version of libav/ffmpeg:
            • urpmi lib64pulseaudio-devel lib64xv-devel lib64xmlrpc-c-devel lib64cairo-devel lib64wxgtku2.8-devel lib64openjpeg-devel lib64faad2-devel lib64mad-devel lib64a52dec-devel [lib64sdl2.0-devel]
          • if you use the system libav/ffmpeg:
            • urpmi lib64pulseaudio-devel lib64xv-devel lib64xmlrpc-c-devel lib64cairo-devel lib64wxgtku2.8-devel lib64openjpeg-devel lib64faad2-devel lib64mad-devel lib64a52dec-devel lib64ffmpeg-devel[lib64sdl2.0-devel]
        • Ubuntu (*)
          • if you have compiled your own version of libav/ffmpeg:
            • sudo apt-get install make pkg-config g++ zlib1g-dev libsdl1.2-dev [libsdl2-dev]
          • if you use the system libav/ffmpeg:
            • sudo apt-get install make pkg-config g++ zlib1g-dev firefox-dev libfreetype6-dev libjpeg62-dev libpng12-dev libopenjpeg-dev libmad0-dev libfaad-dev libogg-dev libvorbis-dev libtheora-dev liba52-0.7.4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxv-dev x11proto-video-dev libgl1-mesa-dev x11proto-gl-dev linux-sound-base libxvidcore-dev libssl-dev libjack-dev libasound2-dev libpulse-dev libsdl1.2-dev dvb-apps libavcodec-extra-53 libavdevice-dev libmozjs185-dev
        • Mageia 1:
          • urpmi libmad-devel libxvid-devel libjs-devel libopenjpeg-devel libjpeg-devel liba52dec-devel libSDL-devel libcairo-devel libwxgtku2.8-devel libpulseaudio-devel libxmlrpc-c-devel libxulrunner-devel libxv1-devel libffmpeg-devel libdirectfb-devel
        • Mandriva 2010.2:
          • add plf to your distribution sources (Easy URPMI)
          • urpmi libmad-devel libxvid-devel libjs-devel libopenjpeg-devel libjpeg-devel liba52dec-devel libSDL-devel libwxgtku2.8-devel libpulseaudio-devel libxmlrpc-c-devel libxulrunner-devel xulrunner-headless-devel libxv1-devel libffmpeg-devel
        • Mandriva 2008.x:
          • from 2008.1: urpmi libfaad2-devel libffmpeg-devel (liblame-devel libfaac-devel libmpeg4ip-devel liba52dec-devel libmrnb-devel libtheora-devel libvorbis-devel libx264-devel libmrwb-devel) libglib2.0-devel libmesaglut3-devel
          • from 2008.0: urpmi libfreetype6-devel libjs-devel libmad0-devel libopenjpeg1-devel libopenssl0.9.8-devel libpng-devel libSDL1.2-devel libwxgtk2.8-devel (libxml2-devel) libwxgtku2.8-devel 
        • Mandriva 2007.x:
          • urpmi libfaad2_0-devel libffmpeg51-devel libfreetype6-devel libjpeg62-devel libjs1-devel libmad0-devel libogg0-devel libopenjpeg1-devel  libopenssl0.9.8-devel libpng3-devel libSDL1.2-devel libtheora0-devel  libvorbis0-devel libwxgtk2.6-devel libwxgtku2.6-devel libxml2-devel libxvid4-devel zlib1-devel libmesaglut3-devel
          • ln -s /usr/include/js-1.5 /usr/include/js
    • step 2: get GPAC source:
    • step 3: compile gpac (Compiling GPAC on Ubuntu)
      • Problemes / Problems
      • Dashcast modifications
      • modify GPAC code according to libav / ffmpeg versions used:
        • ffmpeg 2.2 (compiled with --enable-avresample)
          • gpac/applications/dashcast/Makefile (GPAC svn > r5237)
            • CFLAGS+=-DDC_AUDIO_RESAMPLER
              LINKLIBS+=-lavresample
        • ffmpeg 2.1
          • (no modifications needed on latest svn gpac)
        • libav git
          • if using GPAC rev>=4772 (2013-09-22)
            • ffmpeg_decode.c:112:7: error: ‘CODEC_ID_SVQ3’ undeclared (first use in this function)
              ...
              • Solució / Solution:
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' modules/ffmpeg_in/ffmpeg_decode.c
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' modules/ffmpeg_in/ffmpeg_demux.c
            • modules/ffmpeg_in/ffmpeg_decode.c:633: undefined reference to `avcodec_decode_audio3'
              • Solution:
                • use libav 9.x
          • if using GPAC rev. >= 4731 (2013-09-05)
            • error: ‘AV_CH_LAYOUT_STEREO’ undeclared
              • Solució / Solution:
                • audio_muxer.h
                  • #include "libavcodec/version.h"
                    #if (LIBAVCODEC_VERSION_MAJOR>53)
                    #include "libavutil/channel_layout.h"
                    #endif
            • error: ‘AVStream’ has no member named ‘r_frame_rate’
              • libavformat/avformat.h
              • solució / solution
                • video_decoder.c
                  • comment if statament where r_frame_rate appears
            • error: ‘CODEC_ID_RAWVIDEO’ undeclared
              • solució / solution
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' video_decoder.c
            • error: ‘CODEC_ID_H264’ undeclared
              • sol:
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' video_encoder.c
            • video_encoder.o: In function `dc_video_encoder_encode':
              video_encoder.c:(.text+0x26b): undefined reference to `avcodec_encode_video'
              • in libav from git, avcodec_encode_video has changed to avcodec_encode_video2 and parameters are different (libavcodec/avcodec.h)
              • sol:
                • use libav 9.1
          • make sure that extra_lib is not refrenced by configure:
            • rm -rf extra_lib
          • error: ‘CODEC_ID_MPEG4’ not declared in this scope
            • Solució / Solution:
              • cd modules/ffmpeg_in/
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' ffmpeg_decode.c
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' ffmpeg_demux.c
                • sed -i 's/av_close_input_file/avformat_close_input/g' ffmpeg_demux.c
                • sed -i 's/av_open_input_stream/avformat_open_input/g' ffmpeg_demux.c
                • ...
          • applications/dashcast/audio_encoder.h
            • #include "libautil/channel_layout.h"
          • ‘AVStream’ has no member named ‘r_frame_rate’
            • it is an issue in libav from repository; use libav-9.1 instead
        • libav 9.10
          • ...
        • libav 9.8
          • if using GPAC rev. >= 4731 (2013-09-05)
            • error: ‘AV_CH_LAYOUT_STEREO’ undeclared
              • Solució / Solution:
                • audio_muxer.h
                  • #include "libavcodec/version.h"
                    #if (LIBAVCODEC_VERSION_MAJOR>53)
                    #include "libavutil/channel_layout.h"
                    #endif
        • libav 53 / 0.8.7 / ffmpeg
          • no GPAC modifications needed
      • ./configure [--enable-debug] [--use-js=no]
      • make
      • make install
      • update ld.so:
        • new fashion (e.g. Mageia 3):
          • echo /usr/local/lib > /etc/ld.so.conf.d/local32.conf
          • ldconfig
        • old fashion
          • add lines to /etc/ld.so.conf
            • /usr/local/lib
            • /usr/lib/xulrunner-1.9.../
      • ldconfig
      • MP4Box usage
    • Problemes / Problems
      • durant la compilació / during compilation
        • with libav
        • problems with libavformat/avio.h
          • error: ‘URL_WRONLY’ was not declared in this scope
        • compilation with libav (>0.8.7) instead of ffmpeg or libav 0.8.7
          • /usr/bin/ld: /usr/local/lib/libavcodec.a(allcodecs.o): relocation R_X86_64_32 against `ff_a64multi_encoder' can not be used when making a shared object; recompile with -fPIC
            • Solució / Solution:
              • assegureu-vos que libav s'ha compilat amb l'opció: /make sure that libav was compiled with option:
                • --enable-shared
          • problems with ffmpeg libavcodec/avcodec.h (*) and libav (ffmpeg fork)
        • /usr/bin/ld: /usr/local/lib/libavcodec.a(allcodecs.o): relocation R_X86_64_32 against `ff_a64multi_encoder' can not be used when making a shared object; recompile with -fPIC
        • ../../bin/gcc/libgpac.so: undefined reference to `JSVAL_NULL'
          ../../bin/gcc/libgpac.so: undefined reference to `JSVAL_VOID'
          • solution:
            • ??
        • undefined reference to JS_ClearNewbornRoots
        • DirectFB not found by configure
          • solution:
            • bug: in configure file, you shoud have:
              • directfb_inc="/usr/include/directfb"
      • després de la compilació / after compilation
        • confirm that the following files point to the right place (/usr/local/lib/libav...):
          • ldd /usr/local/lib/gpac/gm_ffmpeg_in.so
            • libavcodec.so.54 => /usr/local/lib/libavcodec.so.54
              ...
          • ldd /usr/local/bin/DashCast
          • ldd /usr/local/bin/MP4Client
          • if not:
            • /etc/ld.so.conf.d/local32.conf
              • /usr/local/lib
            • ldconfig
        • ldd DashCast apunta a libavcodec.53, i heu compilat amb la versió 54:
          • Solució:
            • comproveu que els fitxers a bin/gcc/DashCast i altres .so són recents. Si no, esborreu-los i feu make
      • en execució / on execution
        • DashCast
          • si feu servir l'ffmpeg (o bé altres paquets de la distribució), us podeu trobar que DashCast us dóna errors del tipus "Cannot open video file", perquè es barregen versions de l'ffmpeg i libav / if you are using ffmpeg or libav packages from your distribution, you may find errors like "Cannot open video file", because several versions of the libraries are mixed (confirm with "ldd DashCast")
            • Solució / Solution:
              • desinstal·leu els paquets de la distribució, perquè gpac agafi els que acabeu de compilar / uninstall distribution development packages, so as gpac takes the newly compiled files:
                • ubuntu:
                  • sudo apt-get remove libavcodec-dev libavformat-dev libavutil-dev
              • comproveu ldd / check ldd
          • "Cannot open output audio codec" / "Cannot open output audio stream"
            • us hi podeu trobar si feu servir aac com a còdec àudio de sortida amb el DashCast
            • solució / Solution:
          • "Cannot find a video stream"
            • Solution:
              • make sure that ./configure gives:
                • FFMPEG: system
          • L'àudio de sortida (mp2) és soroll estrident / Output audio (mp2) is an annoying noise:
          • dashcast.conf file is not generated
            • if -conf option is not used, a generic dashcast.conf file should be generated and written, but only after DashCast is cleanly closed (q)
          • "Rep v1 UTC diff at segment close: 7769 is lower than cumulated segment duration 15000 (diff -7231) - frame rate is probably not correct or frames were lost !!"
            • occurs with libav-9.10
            • Solution
              • ??
    • compile osmozilla (plug-in for Firefox)
      • urpmi libxulrunner-devel
      • cd applications/osmozilla
      • make
      • make install (as user)
      • Desenvolupament / Development
        • applications/osmozilla/osmo_npapi.{cpp,h}
        • applications/osmozilla/osmozilla.cpp
      • Utilització / Usage
      • Problems:
    • compile MP4Client (ja es compila en la compilació general / already compiled in general compilation):
      • cd applications/mp4client
      • modify Makefile:
        • comment line:
          • #rm...
      • make
      • make install
      • MP4Client usage
    • compile gpac with OpenSVC (gpac/modules/opensvc_dec)
      • compile and install OpenSVC libraries
      • modify modules/Makefile (solved in rev 3686):
        • PLUGDIRS=aac_in ... opensvc_dec
      • compile gpac
      • usage
        • ~/.gpacrc
          • You can directly use ctrl+(H,L) or add shortcuts to ~/.gpacrc (during playback, they are taken into account when the MP4Client window has the focus: WINDOW SHORTCUTS):
            • [Shortcuts]
              QualityDown=1
              QualityUp=2
              TemporalIdDown=8
              TemporalIdUp=9
          • In [System] section, check that "codec_04_21" is not associated to "FFMPEG decoder". It must be associated to "OpenSVC Decoder":
            • codec_04_21="FFMPEG decoder"
            • codec_04_21="OpenSVC Decoder"
          • In [PluginsCache] section, check that opensvc_dec is not an invalid module.
        • MP4Client toto_svc.mp4 (amb fitxers .264 no funciona bé)
        • To change layer:
          • Ctrl+H
          • Ctrl+L
      • Problems
        • Segmentation fault
        • [Thread MediaManager] Couldn't set priority(2) for thread ID 0x00000000
          [Thread MediaManager] Couldn't set priority(2) for thread ID 0xb1077b70
          • Solution:
            • ??
    • compile hbbtvplayer
      • cd applications/hbbtvplayer/hbbtvbrowserplugin
        • chmod +x autogen.sh
        • ./autogen.sh
        • ./configure
        • make install
      • cd applications/hbbtvplayer/hbbtvterminal
        • (webkit-1.0 >= 1.5.2)
        • chmod +x autogen.sh
        • ./autogen.sh
        • ./configure
        • make install
    • compile with OpenHEVC decoder (HEVC)
    • compile gpac
      • [chmod +x configure]
      • run configure:
        • cvs: ./configure
        • svn (portivity): ./configure --disable-ipv6 (to avoid error in utils/os_net.c: sin_port)
        • 0.4.2-rc2: ./configure --use-ffmpeg=local
      • to prepare for debugging:
        • ./configure --enable-debug
        • to get an unstripped installed /usr/local/lib/libgpac-xx-DEV.so (to be used by gdb):
          • src/Makefile: INSTFLAGS= (not INSTFLAGS=-s, which installs a stripped version in /usr/local/lib)
      • make
      • (gcc -O3  -fno-strict-aliasing -Wno-pointer-sign -Wall -I/home/fpinyol/src/svn-portivity/trunk/wp5/gpac_0.4.4/include -DGPAC_HAS_SPIDERMONKEY -DXP_UNIX -I/usr/include/js -c -o laser/lsr_[dec,enc,tables].o laser/lsr_[dec,enc,tables].c)
      • make install
      • add line to /etc/ld.so.conf:
        • /usr/local/lib
      • ldconfig
    • using kdevelop
      • Import project: C (?with automake)
    • using Eclipse (Indigo) and subversion (SVN)
      • Setup Eclipse with Subversion
      • From scratch:
        • ...
      • From existing and working svn tree:
        • File -> Import...
        • C/C++ / Existing Code as Makefile project
        • Existing code location: Browse...
        • Toolchain for Indexer Settings: Linux GCC
      • Config for using debug:
        • ./configure --enable-debug
      • Build targets
    • using Eclipse and CVS
      • CVS
        • File / New / Project: CVS / Projects from CVS
        • Create a new repository location
          • Host: gpac.cvs.sourceforge.net
          • Repository path: /cvsroot/gpac
          • User: anonymous
          • Password:
          • Connection type: pserver
        • Use specified module name: gpac
        • Check Out As: Check out as a project configured using New Project wizard
        • Select tag: HEAD
        • Select a wizard: C / C Project
        • Project name: gpac_cvs
        • Project types: Makefile project
        • Configuration: Default
        • cd gpac_cvs; chmod +x configure; ./configure --enable-debug
        • Project / Build All
      • Build targets
    • Build on Eclipse
      • ./configure --enable-debug
      • Make Targets: applications / testapps / broadcaster
        • gpac
          • select "gpac"
          • Add make target:
            • Project -> Make target -> Create...
              • Target name: "gpac_all"
              • Make target: "all"
              • (?) Deactivate "Run all project builders"
          • Build make target:
            • Project -> Make target -> Build...
        • broadcaster
          • Add make "broadcaster_all" target:
            • Target name: broadcaster_all
            • Make target: all
            • Deactivate "Run all project builders"
          • Build:
            • Select "broadcaster_all" / Build Make target
          • Add make "broadcaster_clean" target:
            • Target name: broadcaster_clean
            • Make target: clean
            • Deactivate "Run all project builders"
          • Build:
            • ...
      • Launch an application on debug mode:
        • Run -> Debug Configurations...
        • C / C++ Application
        • New
          • Name: "DashCast_toto"
          • Main
            • C / C++ Application: bin/gcc/DashCast
            • Project: gpac
          • Arguments
            • "-av toto.mp4 -live-media -seg-dur 10000"
        • New
          • Name: "MP4Box_1"
          • Main
            • C / C++ Application: bin/gcc/MP4Box
            • Project: gpac
        • New
          • Name: "MP4Box_add"
          • Main
            • C / C++ Application: bin/gcc/MP4Box
            • Project: gpac
          • Arguments
            • "-add toto.h264 toto.mp4"
      • Debug
        • Open Debug Dialog / C/C++ Local Application
        • Environment:
          • Variable: LD_LIBRARY_PATH
          • Value: .../gpac_cvs/bin/gcc
  • DashCast usage
  • DashCast modifications (gpac/applications/dashcast)
    • audio transcode to AAC (instead of MP2) (needed by HbbTV 1.5):
      • dashcast.conf
        • [a1]
          type=audio
          bitrate=192000
          samplerate=48000
          channels=2
          codec=aac
      • applications/dashcast/audio_muxer.h (not needed anymore?)
        • #include "libavcodec/version.h"
          #if (LIBAVCODEC_VERSION_MAJOR>53)
          #include "libavutil/channel_layout.h"
          #endif
      • applications/dashcast/audio_muxer.c, in function dc_gpac_audio_moov_create:
        • //esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_MPEG1;
          esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_AAC_MPEG4;
        • //acfg.base_object_type = GF_M4A_LAYER2;
          acfg.base_object_type = GF_M4A_AAC_LC;
        • //audio_stream->codec->sample_fmt = AV_SAMPLE_FMT_S16;
          audio_stream->codec->sample_fmt = audio_codec_ctx->sample_fmt;
      • applications/dashcast/audio_encoder.c, in function dc_audio_encoder_open:
        • //p_aout->p_codec = avcodec_find_encoder_by_name("mp2"); p_aout->p_codec = avcodec_find_encoder_by_name(p_adata->psz_codec);
        • //audio_output_file->codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;
          if( strcmp(audio_data_conf->codec, "aac") == 0 ) {
              audio_output_file->codec_ctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
          }
          else {
              audio_output_file->codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;
          }
        • /* open the audio codec */
          AVDictionary *opts = NULL;
          if( strcmp(audio_data_conf->codec, "aac") == 0 ) {
            av_dict_set(&opts, "strict", "experimental", 0);
          }
          //if (avcodec_open2(audio_output_file->codec_ctx, audio_output_file->codec, NULL) < 0) {
          if (avcodec_open2(audio_output_file->codec_ctx, audio_output_file->codec, &opts) < 0) {
              /*FIXME: if we enter here (set "mp2" as a codec and "200000" as a bitrate -> deadlock*/
              GF_LOG(GF_LOG_ERROR, GF_LOG_DASH, ("Cannot open output audio codec\n"));
              return -1;
          }
    • avc1 vs avc3 (revision >=4726)
      • controler.c
        • avc1:
          • #define VIDEO_MUXER GPAC_INIT_VIDEO_MUXER_AVC1
        • avc3:
          • #define VIDEO_MUXER GPAC_INIT_VIDEO_MUXER_AVC3
    • applications/dashcast/video_encoder.c, in function dc_video_encoder_open (needed for having SPS and PPS available on video_muxer.c) (solved on revision 4726: avc1)
      • p_voutf->p_codec_ctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
    • applications/dashcast/video_muxer.c, in function dc_gpac_video_moov_create
      • avccfg = gf_odf_avc_cfg_new();
      • SPS and PPS on init mp4 (modification on video_encoder.c needed. see above) (solved on revision 4726: avc1)
        • int sps_size, pps_size, nal_separator_size;
          nal_separator_size = 4; // 00 00 00 01
          pps_size = 4;
          sps_size = p_video_codec_ctx->extradata_size - 2*nal_separator_size - pps_size;

          /*SPS*/
          GF_AVCConfigSlot *sl_sps;
          sl_sps = (GF_AVCConfigSlot*)gf_malloc(sizeof(GF_AVCConfigSlot));
          sl_sps->size = sps_size;
          sl_sps->data = (char *)gf_malloc(sizeof(char) *sl_sps->size);
          memcpy(sl_sps->data, p_video_codec_ctx->extradata + nal_separator_size, sizeof(char)*sl_sps->size);
          gf_list_add(avccfg->sequenceParameterSets, sl_sps);

          /*PPS*/
          GF_AVCConfigSlot *sl_pps;
          sl_pps = (GF_AVCConfigSlot*)gf_malloc(sizeof(GF_AVCConfigSlot));
          sl_pps->size = pps_size;
          sl_pps->data = (char *)gf_malloc(sizeof(char) * sl_pps->size);
          memcpy(sl_pps->data, p_video_codec_ctx->extradata + sps_size + 2*nal_separator_size, sizeof(char)*sl_pps->size);
          gf_list_add(avccfg->pictureParameterSets, sl_pps);
      • avc1 instead of avc3 (inband). (Needed by HbbTV 1.5) Comment the following fragment: (solved on revision 4726: avc1)
        • /*
          gf_odf_avc_cfg_del(avccfg);
          //printf("time scale: %d \n",
          //        p_video_codec_ctx->time_base.den);
          ret = gf_isom_avc_set_inband_config(p_voutf->p_isof, track, 1);
          if (ret != GF_OK) {
              fprintf(stderr, "%s: gf_isom_avc_set_inband_config\n",
                      gf_error_to_string(ret));
              return -1;
          }
          */
      • size on [tkhd] and [avc1]:
        • u32 width, height;
          width=640;
          height=360;
        • // set size in [tkhd]
          gf_isom_set_track_layout_info(p_voutf->p_isof, track, width<<16, height<<16, 0<<16, 0<<16, 0);
        • // set size in [avc1]
          // requires adding GF_EXPORT before "GF_Err gf_isom_set_visual_info(GF_ISOFile...",
          // in file src/isomedia/isom_write.c
          ret = gf_isom_set_visual_info(p_voutf->p_isof, track, di, width, height);
      • alternate brand:
        • // set alternate brand
          gf_isom_modify_alternate_brand(p_voutf->p_isof, GF_4CC('a','v','c','1'), 1);
      • other modifications to avccfg:
        • // other modifications to avccfg
          avccfg->AVCLevelIndication = 31;
          ret = gf_isom_avc_config_update(p_voutf->p_isof, track, di, avccfg);
      • ret = gf_isom_finalize_for_fragment(p_voutf->p_isof, 1);
  • Linux usage
    • Fonts
      • import MSWindows fonts
        • Mandriva Control Centre / System / Manage Windows fonts / Obtain Windows fonts 
      • modify ~/.gpacrc:
        • [FontEngine]
          FontDirectory=/usr/share/fonts/drakfont/ttf
  • MS Windows compilation
    • compile gpac_extra_libs
    • compile ffmpeg
    • MSYS_1.0.10.exe
    • MinGW Runtime: mingw-runtime-3.9.tar.gz
    • Windows API: w32api-3.6.tar.gz
    • binutils: binutils-2.15.91-20040904-1.tar.gz
    • GCC: gcc-core-3.4.2-20040916-1.tar.gz, gcc-g++-3.4.2-20040916-1.tar.gz
    • copy needed tools from MS Visual:
    • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\bin\lib.exe, link.exe -> c:\MinGW\bin
    • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Common7\IDE\mspdb71.dll -> c:\MinGW\bin
    • Start / MinGW / MSYS / msys.exe
    • some checks
    • cd /c/.../gpac_extra_libs/lib
    • mkdir w32_deb w32_rel
    • edit /c/.../gpac_extra_libs/libavformat/Makefile and fix the bug:
    • cp avcodec... should be: cp avformat...
    • cd /c/.../gpac_extra_libs/ffmpeg
    • ./configure --enable-shared --disable-debug --enable-memalign-hack
    • make
    • compile the rest of gpac_extra_libs with MS Visual:
    • Open build\msvc6\BuildAll.dsw
    • Batch Build
    • compile gpac with MSVisual 6.0
      • Open gpac\build\msvc6\gpac.dsw
      • set gpac_dll as active (StartUp) project
      • Build libgpac_dll
    • compile gpac with MSVisual 2005 (svn portivity)
      • open build/win32/win32.sln
      • check "Solution Platforms": Win32
      • for computers with HT or dual core: set 1 parallel process
      • Build solution
  • MS Windows Mobile compilation
    1. Be sure you have VS2005 and WM 5.0 Developer Resource Kit installed
    2. From the VS2005 open the solution file for WM5 located at: <download folder>\build\wm5\wm5.sln 
    3. Select the correct solution configuration and platform (Debug/Release and Windows Mobile 5.0 Pocket PC SDK (ARMV4I) 
    4. Connect you device using the USB cable and verify that you can communicate with it (Explore from the ActiveSync) 
    5. Compile and deploy as usual

libdash

  • How to use (libdash README.md)
  • Dependencies
    • Mageia
      • urpmi cmake lib64curl-devel
  • Download
    • git clone git://github.com/bitmovin/libdash.git libdash
  • Compilation(libdash)
    • cd libdash/libdash
    • mkdir build
    • cd build
    • cmake ..
    • make
    • cd bin
    • ./libdash_networpart_test
  • sampleclient compilation
    • Dependencies
      • Mageia
        • urpmi lib64SDL-devel
    • Problems
      • error: ‘UINT64_C’ was not declared in this scope
        • Solution
        • mv sdl sdl_old
        • Renderer/SDLRenderer.h
          • #include <SDL/SDL.h>
            #include <SDL/SDL_thread.h>
        • Renderer/IVideoObserver.h
          • #ifdef __cplusplus
            #define __STDC_CONSTANT_MACROS
            #ifdef _STDINT_H
            #undef _STDINT_H
            #endif
            # include <stdint.h>
            #endif

            #ifndef UINT64_C
            #define UINT64_C(c) (c ## ULL)
            #endif
      • error : Sleep was not declared in this scope
        • Solution
          • Decoder/LibavDecoder.cpp
            • #include <unistd.h>
              ...
              sleep...
    • cd libdash/libdash
    • CMakeLists.txt
      • add_subdirectory(sampleplayer)
    • cd build
    • cmake ..
    • make
  • qtsampleplayer compilation
    • Dependencies
      • Mageia
        • urpmi lib64qt5widgets-devel lib64qt5multimedia-devel lib64qt5network-devel lib64qt5multimediawidgets-devel lib64qt5opengl-devel
    • cd libdash/qtsampleclient
      • CMakeLists.txt
        • set(CMAKE_PREFIX_PATH /usr/lib64/qt5/lib/cmake/)
    • cd libdash/libdash
    • CMakeLists.txt
      • add_subdirectory(qtsampleplayer)
    • cd build
    • cmake ..
    • make
    • Problems
      • error: ‘usleep’ was not declared in this scope
        • Solution
          • libdashframework/Portable/MultiThreading.h
            • #include <unistd.h>
  • Usage
    • ..

Butterflow

  • Motion interpolated videos
  • Instal·lació / Installation
    • Dependències / Dependencies
      • Mageia
        • urpmi task-c++-devel lib64ffmpeg-devel python-numpy-devel
    • git clone https://github.com/dthpham/butterflow.git
    • cd butterflow
    • setup.py
      • np_includes = '/usr/lib64/python2.7/site-packages/numpy/core/include'
    • virtualenv env; source env/bin/activate
    • python setup.py develop

Bento4

  • Get the source (choose one of the following methods)
  • Prerequisites
    • urpmi gcc-c++ scons
  • Compile
    • cd ~/src/Bento4
    • scons
  • Binaries
    • ~/src/Bento4/Build/Targets/x86_64-unknown-linux/Debug/
  • Installation
    • cd /usr/local/bin
    • su; ln -s ~/src/Bento4/Build/Targets/x86_64-unknown-linux/Debug/* .
  • Documentation
    • ~/src/Bento4/Documents/SDK/Bento4_SDK_documentation.pdf
    • unzip ~/src/Bento4/Documents/Doxygen/Bento4-HTML.zip
    • ~/src/Bento4/Documents/Doxygen/Bento4-HTML/index.html

LASeR reference software

  1. Install eclipse
  2. Download ref_software_2007-01-26.zip (w8869) from MPEG site (access needed)
    1. mv LASeRCodec1206 LASeRJPlayer1206 ~/workspace
  3. Download and install Sun's J2ME Wireless Toolkit (WTK)
  4. Download and install eclipseme, a J2ME plugin from eclipse. On the web site, there are detailed instructions for setting up the plugin and for linking it with the WTK.
  5. From Eclipse, create a new Java Project, and give it the name of the directory you put into the workspace (eg. LaserJPlayer, J2ME_Renderer). Eclipse will import the project (the source files and the libraries). It is recommended to have different source/output directories (see "Window/Preferences/Java/Build path" before creating the project)
  6. Convert the newly created project into a J2ME project (right click on the project, J2ME/Convert to J2ME Midlet Suite). Select the MIDP 2.0 Platform
  7. Change the build settings as following. Right click on the project, Properties, Java Build Path, Order and Export - check library.jar.
  8. Add some .lsr input files. For doing that, create a new source directory - eg res (right click on your project, New Source Folder). Put inside the .lsr files, and rebuild
     (if you have automatic build turned on - which is the case by default - right click on the directory, and click Refresh)
  9. In the file iso.mpeg.streamezzo.player.tool.SceneLoader, you should change the INIT_LASER_URL attribute according to the input file you wish to play.
  10. For executing / debugging, right click on iso.mpeg.streamezzo.player.tool.LASeRPlayer, Run as / Debug as Emulated J2ME Midlet

OpenSVC

  • mplayer compilation
    • RTSP/RTP streaming support for MPlayer (Live555)
    • dependencies
      • Mageia 1:
        • urpmi make libvdpau-devel live-devel live libdirac-devel libxv1-devel libopenjpeg-devel libjpeg-devel libSDL-devel libpulseaudio-devel liba52dec-devel
      • Mandriva
      • urpmi libvdpau-devel libfaac-devel live-devel live libdirac-devel libxv1-devel libopenjpeg-devel libjpeg-devel libSDL-devel libpulseaudio-devel liba52dec-devel
    • get the code
      • svn co https://opensvcdecoder.svn.sourceforge.net/svnroot/opensvcdecoder opensvcdecoder
      • [svn update]
    • compile
      • cd opensvcdecoder/Mplayer
      • ./configure --enable-svc --enable-menu
      • make
    • installation
    • with Eclipse:
      • ./configure --enable-svc --enable-menu --enable-debug
      • In C/C++ Perspective -> Make Target (second tab on right panel) -> select Mplayer -> New...
        • Target name: all
    • usage
  • compilació de només les biblioteques / only libraries compilation (per a ser utilitzades, per exemple, amb GPAC MP4Client)
    • dependencies
      • Mageia 1
        • urpmi cmake gcc-c++ libSDL-devel
    • compilation
      • cd opensvcdecoder/Libs
      • cmake CMakeLists.txt
      • make
    • installation
      • make install (it will install /usr/local/lib/libOpenSVCDec.so)
    • with Eclipse:
      • In C/C++ Perspective -> Make Target (second tab on right panel) -> select Libs -> New...
        • Target name: all
    • player usage
  • GPAC with OpenSVC

SVC reference software (JSVM)

  • Modules:
    • DownConvertStatic
    • H264AVCEncoderLibTestStatic
    • H264AVCDecoderLibTestStatic
    • AvcRewriter
    • BitStreamExtractorStatic
    • QualityLevelAssignerStatic
    • MCTFPreProcessor
    • PSNRStatic
    • FixedQPEncoderStatic
    • SIPAnalyser
    • YUVCompareStatic
  • Compilació / Compilation
    • dependencies
    • get the code
      • GitHub
        • floriandejonckheere/jsvm
      • cvs (outdated)
        • cvs -d :pserver:jvtuser:xxxxx@garcon.ient.rwth-aachen.de:/cvs/jvt login
        • cvs -d :pserver:jvtuser@garcon.ient.rwth-aachen.de:/cvs/jvt checkout jsvm
        • cvs update
    • compile
    • cd jsvm/JSVM/H264Extension/build/linux
    • make
  • Utilització / Usage
    • H264AVCEncoderLibTestStatic -pf encoder.cfg
    • example configuration files:
      • JSVM/H264Extension/data
      • JSVM0-config-samples
    • AVC / MVC:
      • encoder.cfg
        • AVCMode 1
        • InputFile toto.yuv
        • OutputFile toto_avc.264
        • ReconFIle toto_recon.yuv
        • SourceWidth win
        • SourceHeight hin
        • FrameRate fps
        • FramesToBeEncoded frames
        • SequenceFormatString (A: IDR intra; I: non-IDR intra; P: predicted: B: bidirectional) (upper case: to be used as reference; lower case: not to be used as reference):
          • A0*2{P2b0b1}
          • A0*1{P2P5P8b0b1b3b4b6b7b9b10}
          • ...
        • GOPSize, IntraPeriod, IDRPeriod not working? Only for SVC (AVCMode 0)?
    • SVC
      • Number of layers:
        • Spatial or CGS quality (D):
          • NumLayers
        • MGS quality (Q):
          • MgsVectorMode
          • MGSControl
        • Temporal (T)
          • log_2(GOPSize) + 1
      • Preparation:
        • DownConvertStatic win hin toto.yuv w1 h1 toto_w1xh1.yuv method t skip frames
        • DownConvertStatic win hin toto.yuv w2 h2 toto_w2xh2.yuv method t skip frames
      • encoder.cfg
        • [AVCMode 0]
        • OutputFile toto_svc.264
        • GOPSize
        • IntraPeriod
        • IDRPeriod
        • NumLayers
        • LayerCfg cfg/layer0.cfg
        • LayerCfg cfg/layer1.cfg
        • ...
      • cfg/layer0.cfg
        • InputFile orig/toto_w1xh1.yuv
        • IntraPeriod
        • IDRPeriod
      • cfg/layer1.cfg
        • InputFile orig/toto_w2xh2.yuv
        • IntraPeriod
        • IDRPeriod
      • ...
  • info about an SVC file (DTQ)
    • jsvm/bin/BitStreamExtractorStatic toto.264
  • IDR (to be able to switch layers more often):
    • layer cfg file (section INPUT/OUTPUT):
      • IDRPeriod     8

Flameproject

  • urpmi libgnome2_0-devel

Biblioteques compartides / Shared libraries

  • Per a afegir un camí amb biblioteques compartides / To add a path which contains shared libraries:
    • edit /etc/ld.so.conf
    • ldconfig

Llengua / Language


Servei / Service

  • UbuntuBootupHowto
  • /etc/init.d/toto:
    • #!/bin/sh
      #
      # Startup script for the toto daemon
      #
      # chkconfig: 2345 26 59
      #
      # description: toto daemon
      #
      ### BEGIN INIT INFO
      # Provides: toto
      # Should-Start: xxxx
      # Required-Start: xxx
      # Required-Stop: xxx
      # Default-Start: 2 3 4 5
      # Short-Description: Toto daemon
      # Description: Toto daemon
      ### END INIT INFO

      . /etc/init.d/functions

      case "$1" in
        start)
              gprintf "Starting toto daemon: "
              daemon "/usr/bin/toto -i 172.16.11.5" -d
              RETVAL=$?
              echo
              [ $RETVAL -eq 0 ] && touch /var/lock/subsys/toto
              ;;
        stop)
              gprintf "Shutting down toto daemon: "
              killproc toto
              RETVAL=$?
              echo
              [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/toto
              ;;
        status)
              status toto
              RETVAL=$?
              ;;
        restart|reload)
              $0 stop
              $0 start
              ;;
        condrestart)
              [ -f /var/lock/subsys/toto ] && restart || :
              ;;
        *)
              gprintf "Usage: %s {start|stop|status|restart}\n" "$0"
              RETVAL=1
              ;;
      esac

      exit $RETVAL
  • ln -s /etc/init.d/toto /etc/rc5.d/S99toto
  • service toto start
  • Configuració / Setup
    • chkconfig
      • chkconfig -list
    • install a service:
      • update-rc.d to make all the links from /etc/rc?.d/ to /etc/init.d/toto (start: 90, kill: 10)
        • sudo update-rc.d toto defaults 90 10
    • uninstall a service:
      • sudo rm /etc/rc*/*toto

Logitech Harmony

  • concordance
    • Harmony 700
      • concordance >= 0.22
    • Codi font / Source code
    • old cvs instructions
      • [cvs -d:pserver:anonymous@concordance.cvs.sourceforge.net:/cvsroot/concordance login]
      • [cvs -z3 -d:pserver:anonymous@concordance.cvs.sourceforge.net:/cvsroot/concordance co -P concordance]
      • urpmi autoconf automake make gcc-c++ libtool-base libusb-compat0.1-devel
      • cd concordance/libconcord
        • autoreconf --install
        • ./configure
        • make
        • make install
      • cd concordance/libconcord/bindings/python
        • urpmi libpython2.6-devel
        • python setup.py install
      • cd concordance/concordance
        • autoreconf --install
        • ./configure
        • make
        • make install
      • Add /usr/local/lib to the library path
  • congruity (GUI)
    • Instal·lació / Installation
      • Mageia
        • sudo urpmi congruity
  • http://members.harmonyremote.com/ (it will call Congruity)

SVG

  • Include scalable SVG into HTML (Inkscape ViewBox bug, Bug #168261) (feedicons examples):
    • .svg
      • <svg ...
        width="..."
        height="..."
        ViewBox="0 0 200 100">
        ...
    • .html (figure scaled to 40x20 pixels)
      • <object type="image/svg+xml" data="figure.svg" width="40" height="20">
        You cannot display SVG files.
        </object>

QR

Dropbox

  • Dropbox
  • The Unofficial Dropbox wiki
  • Linux installation (Dropbox: Painless and Free Backup)
    • from package
      • Mageia
        • urpmi nautilus-dropbox (will also install dropbox package)
    • from code:
      • Mageia
        • urpmi gcc make lib64nautilus-devel python-docutils
      • wget https://linux.dropbox.com/packages/nautilus-dropbox-1.6.1.tar.bz2
      • tar xjf nautilus-dropbox-1.6.1.tar.bz2
      • cd nautilus-dropbox-1.6.1
      • ./configure; make;
      • su; make install
    • (as user): dropbox start -i
    • nautilus will open /home/user/Dropbox/ folder
    • rm -f ~/.dropbox-dist/libz.so.1
      dropbox start
    • (run dropbox again and follow the displayed URL to sync your Dropbox account to your PC)
  • Problems:
    • Plasma / KDE5 (e.g. Mageia 6)
      • "isn't running"
      • Solució provisional / Workaround
        • CTRL + ALT F2 to open a text console
          • $ dropbox start
        • or use Gnome instead of Plasma
    • Dropbox Not Syncing On Ubuntu Linux
      • Solution:
        • kill the dropbox process
        • dropbox start
  • Website host

Google Drive

  • Grive
    • Installation [Grive]
      • Dependències / Dependencies
        • urpmi cmake lib64json-devel
      • yajl
        1. git clone git://github.com/lloyd/yajl yajl
        2. cd yajl
        3. ./configure
        4. cmake .
        5. make
        6. su; make install
      • grive
        1. git clone https://github.com/Grive/grive.git
        2. cd grive
        3. cmake .
        4. make
        5. su; make install
    • Usage
      • ...

Media Tomb (UPnP server)

  • urpmi mediatomb
  • /etc/mediatomb.conf
    • MT_INTERFACE="eth0"
  • service mediatomb start
  • /etc/mediatomb/
    • config.xml
      • <name>Servidor MediaTomb</name>
  • add supoort for mts (MPEG-2 TS) files:
    • config.xml
      • <map from="mts" to="video/mpeg"/>
        <map from="ts" to="video/mpeg"/>
        <map from="m2ts" to="video/mpeg"/>
  • Administració / Administration

DirectFB

Emacs 

  • Paquets / Packages
  • Meta key (M-)
    • ESC (and release)
    • Alt (and keep)
  • xemacs indent tutorial
  • c-set-style java
  • Instal·lació d'un mode / Mode installation
    • set ~/.emacs.d as part of load-path
      • ~/.emacs
        • (add-to-list 'load-path "~/.emacs.d")
    • put your file in:
      • ~/.emacs.d/toto.el
    • load it from ~/.emacs
      • ~/.emacs
        • (require 'toto)
  • carregar un fitxer .el / load a .el file
    • M-x load-file
    • .emacs:
      • (load "~/nxml-mode-200YMMDD/rng-auto.el")
  • carregar un mode / load a mode
    • M-x [sh-mode c-mode xml-mode...]
    • .emacs:
      • (setq auto-mode-alist
                (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
                      auto-mode-alist))
  • informació sobre un mode / information about a mode
    • M-x describe-mode
  • newline in replace:
    • C-q C-j
  • Inverted colours (reverse video):
    • emacs -rv
  • printf colors
    • Ansi Color (built-in)
      • M-x load-library ansi-color
        M-: (ansi-color-apply-on-region (point-min) (point-max))
  • columnes / columns
    • M-x column-number-mode
    • .emacs
      • (setq column-number-mode t)
  • parèntesis
  • cerca
    • tornar al lloc després de la cerca:
      • C-x C-x
  • Índex a partir d'una cerca:
    • M-occurs
  • HTML tags
    • cerca el tag de tancament a partir del tag d'obertura / search corresponding ending tag
      • C-c C-f
    • cerca el tag d'obertura a partir del tag de tancament / search corresponding opening tag
      • C-c C-b
    • elimina el tag / remove tag
      • C-c Backspace
  • .emacs:
    • disable bell
      • (setq visible-bell t)
    • font
      • (set-default-font "6x13")
  • auto-fill (automatic introduction of newlines for long lines):
    • mouse-3 button over (Text) at bottom to activate or deactivate it
  • posar bé un paràgraf / fill paragraph:
    • M-q
  • eliminar els retorns de carro / join line:
    • aneu a la darrera línia del paràgraf i aneu fent una de les següents opcions:
      • M-^ (cal fer un espai, perquè ^ és una tecla morta)
      • M-x join-line
  • conflictes / conflicts (text diff)
  • envoltar un text seleccionat
    • wrap-region.el
      • dependencies
        • M-x package-install
      • cd ~/.emacs.d/
      • wget https://raw.githubusercontent.com/rejeep/wrap-region.el/master/wrap-region.el
      • i18n in Smarty
        • (wrap-region-add-wrapper "{t}" "{/t}" "/")     ; hit / then region -> {t}region{/t}
      • .emacs
        • (add-to-list 'load-path "~/.emacs.d/wrap-region.el")
      • usage
        • M-x html-mode
        • M-x wrap-region-mode
        • select text
        • type '/'
  • Indentation
  • Macros
  • tabs
    • Show white space
      • WhiteSpace
        • install
          • ~/.emacs
            • (require 'whitespace)
        • activate
          • C-u 1 M-x whitespace-mode RET
        • deactivate
          • C-u 0 M-x whitespace-mode RET
    • usage


      only for this session permanently, in ~/.emacs
      display

      M-x set-variable RET tab-witdth RET 4 (setq tab-width 4);
      insert
      CCMode
      c-basic-offset


      perl
      cperl-indent-level





    • inserting
      • (setq tab-stop-list 4);
    • (setq default-tab-width 4);
    • (setq-default indent-tabs-mode t);
    • tabs -> spaces
      • M-x untabify
    • spaces -> tabs
      • M-x tabify

Fitxers de text / Text files

  • Codificació de text / Text encoding
    • Per a saber en quina codificació està un fitxer .tex (*):
    • Per a canviar la codificació del fitxer (d'iso-8859-1 a UTF-8):
      • iconv -f iso-8859-1 -t utf8 toto.tex > toto2.tex
      • recode UTF-8 toto.tex
      • convert_html_encoding.sh
        • #!/bin/bash

          # defaults
          output_encoding=utf-8

          EXPECTED_ARGS=1
          if (( $# != $EXPECTED_ARGS ))
          then
              cat <<EOF
          Usage: `basename $0` html_filename

          Converts html_filename to ${output_encoding}, by modifying the file text encoding and setting:
            <meta content="text/html; charset=${output_encoding}" http-equiv="Content-Type">
          EOF
              exit 1
          fi

          # parameters
          input_path=$1

          input_basename=$(basename ${input_path})
          input_name=${input_basename%.*}
          input_extension=${input_basename##*.}
          input_dirname=$(dirname ${input_path})

          output_basename=${input_name}.${output_encoding}.${input_extension}
          output_path=${input_dirname}/${output_basename}

          # get present mime-type
          mime=$(file -bi ${input_path})
          echo "file mime: ${mime}"

          # get present text encoding charset
          charset=${mime##*=}
          echo "file charset: ${charset}"

          if [[ $charset != $output_encoding ]]
          then
              echo "converting file to $output_encoding"
             
              # convert file encoding
              iconv -f ${charset} -t ${output_encoding} ${input_path} >${output_path}
             
              # convert html charset
              sed -i "/<meta.*charset/ c\  <meta content=\"text/html; charset=${output_encoding}\" http-equiv=\"Content-Type\">" ${output_path}
             
              # rename output file
              rm -f ${input_path}
              mv ${output_path} ${input_path}
          else
              echo "file already in $output_encoding"
          fi

          exit 0
  • Per a canviar la codificació del nom del fitxer:
    • convmv -f ascii -t utf8 --notest [filename] > [newfilename]
  • Diferències / Differences

eyeOS

  1. urpmi php-curl php-mbstring php-mcrypt php-mysqli php-sqlite3 php-pdo_mysql php-pdo_sqlite openoffice.org-pyuno
  2. Download the latest version
  3. untar it
  4. /etc/httpd/conf/vhosts.d/eyeos.conf:
    • Alias /eyeOS /var/www/eyeOS
      <Directory "/var/www/eyeOS">
          Options -Indexes FollowSymLinks MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
      </Directory>
  5. Open http://localhost/eyeOS/install

LDAP (Lightweight Directory Access Protocol)

  • Info
  • Servidor / Server
    • OpenLDAP
      • slapd (server)
      • modes
      • install
        • urpmi openldap-servers
      • config:
      • afegir entrades / add entries
        • ldapadd
          • -x: simple authentication
          • -W: prompt for password
          • -D: bind dn
        • general:
          • edit general.ldif:
            • dn: dc=example,dc=com
              dc: example
              objectClass: top
              objectClass: domain

              dn: ou=usuaris,dc=example,dc=com
              ou: usuaris
              objectClass: top
              objectClass: organizationalUnit

              dn: ou=grups,dc=example,dc=com
              ou: grups
              objectClass: top
              objectClass: organizationalUnit
          • ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f general.ldif
        • grups / groups:
          • grups.ldif (or generated by a script)
            • dn: cn=example,ou=grups,dc=example,dc=com
              objectClass: posixGroup
              cn: grup1
              gidNumber: 10000
          • ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f grups.ldif
        • persones / people:
          • usuaris.ldif (or generated by a script)
            • ...
              objectClass: posixAccount
              ...
          • ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f usuaris.ldif
    • Apache DS
  • Clients
    • command line
      • openldap client
        • urpmi openldap-clients
        • usage:
          • ldapsearch -x -b 'dc=example,dc=com' '(objectclass=*)'
          • ldapsearch [-h ldap_server] -xLLL -b 'dc=example,dc=com' '(objectclass=posixGroup)' cn gidNumber
      • shelldap
        • urpmi shelldap
      • smbldap-tools
        • urpmi smbldap-tools
        • /etc/smbldap-tools/smbldap.conf
          • ...
        • usage:
          • smbldap-...
          • smbldap-passwd
          • ...
    • GUI tools (Samba & LDAP)
    • Apache Directory Studio
      • Bind DN or user:
        • cn=Manager,dc=example,dc=com
    • LUMA browser
    • Mandriva Directory Server - MDS
  • Integration with:
    • Bugzilla
    • DHCP
    • MMC (Pulse2)
    • OpenSSH
      • /etc/ssh/sshd_config
        • PAMAuthenticationViaKbdInt yes
    • PAM (Pluggable Authentication Module) in Unix
      • Mageia
        • drakauth (urpmi drakxtools-curses) (MCC: Sistema -> Autenticació)
        • [urpmi nss_ldap pam_ldap autofs nss_updatedb pam_ccreds]
    • Samba
    • Subversion

MMC Mandriva Management Console

  • Mandriva Management Console
  • Packages

    • MMC
      (3.0.4)
      Pulse2
      (1.3.1)
      Mandriva Directory Server (2.4.2.2)
      core
      plugins

      source
      mmc-core-3.0.3.2.tar.gz
      mmc-core-3.0.3.2.tar.gz
      pulse2-1.3.1.1.tar.gz mds-2.4.2.2.tar.gz
      server
      MMC web interface

      • mmc-web-base
      • mmc-web-ppolicy
      • mmc-web-pulse2
      • mmc-web-dyngroup
      • mmc-web-glpi
      • mmc-web-imaging
      • mmc-web-inventory
      • mmc-web-msc
      • mmc-web-pkgs
      • mmc-web-bulkimport
      • mmc-web-mail
      • mmc-web-network
      • mmc-web-proxy
      • mmc-web-samba
      • mmc-web-sshlpk
      • mmc-web-userquota
      MMC agent
      • mmc-agent
      • python-mmc-core
      • python-mmc-base
      • python-mmc-ppolicy

      • python-mmc-pulse2
      • python-mmc-dyngroup
      • python-mmc-glpi
      • python-mmc-imaging
      • python-mmc-inventory
      • python-mmc-msc
      • python-mmc-pkgs
      /usr/share/doc/python-pulse2-common/ contrib/<PLUGIN>/sql/install.sh
      /etc/mmc/plugins/
      • python-mmc-bulkimport
      • python-mmc-mail
      • python-mmc-network
      • python-mmc-proxy
      • python-mmc-samba
      • python-mmc-sshlpk
      • python-mmc-userquota
      servers


      • pulse2-common
      • pulse2-imaging-server
      • pulse2-inventory-server
      • pulse2-launcher
      • pulse2-package-server
      • pulse2-scheduler
      /etc/mmc/pulse2

      client


      • pulse2-imaging-client

  • Pre-install
    • Get MMC source
      • wget http://mds.mandriva.org/pub/mmc-core/sources/3.0.2.1/mmc-core-3.0.2.1.tar.gz
      • tar xvzf mmc-core-3.0.2.1.tar.gz
    • Get MMC / Pulse2 packages
      • Debian Squeeze
        • /etc/apt/sources.list
          • deb http://pulse2.mandriva.org/pub/pulse2/server/debian squeeze 1.3.1.1
          • [deb http://mds.mandriva.org/pub/mds/debian squeeze main]
        • sudo apt-get update
        • dpkg-reconfigure debconf
          • medium
        • sudo apt-get install slapd mysql-server
        • sudo apt-get install mmc-agent python-mmc-dyngroup python-mmc-imaging python-mmc-inventory python-mmc-msc python-mmc-pkgs python-mmc-pulse2 mmc-web-base mmc-web-dyngroup mmc-web-imaging mmc-web-inventory mmc-web-msc mmc-web-pkgs mmc-web-pulse2
      • Mandriva / Mageia
        • urpmi php-xmlrpc php-gd python-sqlalchemy python-mysql python-OpenSSL python-ldap
  • Install from source (README, INSTALL)
    • cd mmc-core-3.0.2.1
    • ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
    • make
    • make install
      • ### MMC LDAP schema must be added to your LDAP directory in order for
        ### mmc-agent to run.
        ### If using dynamic backend (from OpenLDAP 2.3), schema must be converted
        ### in LDIF format.
        ### You can use "mmc-add-schema" to convert and add the schema.
        ### Schema file is available in: /usr/share/doc/python-mmc-base/contrib/ldap
  • Install from package
    • Debian:
      • LDAP and MySQL root password will be configured after package installation
  • Post-install
    • LDAP ("slapd using LDAP based configuration") (INSTALL)
      • Debian
        • dpkg-reconfigure slapd
          • DN: example.com (must match baseDN in /etc/mmc/plugins/base.ini)
        • [slappasswd -s secret]
        • [sudo debconf-show slapd]
        • sudo apt-get install ldap-utils
        • mmc-add-schema /usr/share/doc/python-mmc-base/contrib/ldap/ /etc/ldap/schema/
        • sudo /etc/init.d/slapd restart
      • Mageia
        • mmc-add-schema /usr/share/doc/python-mmc-base/contrib/ldap/ /usr/share/openldap/schema/
        • service slapd restart
    • MMC agent
      • /etc/mmc/plugins/base.ini
        • baseDN = dc=example, dc=com
        • password = secret
        • [computers]
          method = inventory
      • mkdir /home/archives
      • /etc/default/mmc-agent
        • ENABLE=yes
      • /etc/init.d/mmc-agent start
      • If you get a "failed", try with debugging:
        • mmc-agent -d
    • Apache
      • Debian
        • ln -s /etc/mmc/apache/mmc.conf /etc/apache2/conf.d/
        • sudo /etc/init.d/apache2 restart
      • Mandriva / Mageia
        • ln -s /etc/mmc/apache/mmc.conf /etc/httpd/conf.d/
        • service httpd restart
  • MMC usage

Pulse2




  • latest (1.3.1) 1.3.0
    download
    http://pulse2.mandriva.org/pub/pulse2/
    Pulse2 Downloads Pulse2 Downloads (Previous releases)
    documentation
    install
    from source

    from packages
    Pulse2-Install-Debian-Lenny.pdf
    user

    User manuals
    development



  • Architecture
    • Services
      • Inventory
      • Launcher
      • Package
      • Scheduler
    • MMC (Mandriva Management Console) plugins
      • Dyngroup
      • Inventory
        • Fusion Inventory agent for Android
          • "FusionInventory agent for other platforms (Linux, Windows, ...) can also be used as a drop-in in replacement of OCSInventory agent for inventory part."
      • GLPI (when Inventory is not used)
      • MSC
      • Pkgs
  • General
  • Pulse2 Documentation (Previous documentation)
  • Documentation
  • Prerequisites
    • MMC
    • urpmi python-sqlalchemy python-mysql
  • Installation from package
  • Installation from source (README, INSTALL)
    • Info
      • /usr/share/doc/pulse2/
    • Compilation and installation
      1. wget pulse2-1.3.1.1.tar.gz
      2. tar xvzf pulse2-1.3.1.1.tar.gz; cd pulse2-1.3.1.1
      3. ./configure --disable-nsis --prefix=/usr --sysconfdir=/etc --localstatedir=/var
      4. make
      5. make install
    • Post-install (choose one of the following)
      • pulse2-setup
      • manual MySQL config:
        • setup
          • mysql -u root -p
          • create database pulse2;
          • create database msc;
          • create database imaging;
          • create database inventory;
          • create database dyngroup;
          • create user 'mmc'@'localhost' identified by 'mmc';
          • grant all on pulse2.* to 'mmc'@'localhost';
          • grant all on msc.* to 'mmc'@'localhost';
          • grant all on imaging.* to 'mmc'@'localhost';
          • grant all on inventory.* to 'mmc'@'localhost';
          • grant all on dyngroup.* to 'mmc'@'localhost';
          • flush privileges;
        • installation
          • cd /usr/share/doc/pulse2-common/contrib/
          • ./pulse2/sql/install.sh
          • ./msc/sql/install.sh
          • ./imaging/sql/install.sh
          • ./inventory/sql/install.sh
          • ./dyngroup/sql/install.sh
    • usage

FLUTE

DSM-CC

  • redbutton
    • Installation
      • urpmi redbutton-download redbutton-browser
    • Compilation
      • Compiling and using MHEG Engine Redbutton
      • rb-download
        • urpmi zlib1-devel
        • get it (one of the following):
          • svn checkout https://redbutton.svn.sourceforge.net/svnroot/redbutton/redbutton-download/trunk/ redbutton-download
          • wget http://sourceforge.net/projects/redbutton/files/current/redbutton-download-20090727.tar.gz
        • make
        • usage:
          • you need a channels.conf file correctly generated. The last field in each line corresponds to the service_id
          • dvbtune -f 658000 -qam 64 -gi 4 -cr AUTO -bw 8 -tm 8 && rb-download -vv
          • dvbtune -f 818000 -qam 64 -gi 4 -cr AUTO -bw 8 -tm 8 && rb-download -vv -c 35490 (TVE La1)
          • dvbtune -f 650000 -qam 64 -gi 32 -cr AUTO -bw 8 -tm 8 && rb-download -vv [-c carousel_id] service_id
          • ...
      • rb-browser
        • urpmi libexpat1-devel libfreetype6-devel libffmpeg-devel libxrender1-devel libxft-devel libpng-devel
        • get it:
          • svn checkout https://redbutton.svn.sourceforge.net/svnroot/redbutton/redbutton-browser/trunk/ redbutton-browser
        • make

dvbsnoop

  • Compilació / Compilation
    • Get the source:
      • ...
    • Get and apply patches
    • Compile

Diccionaris per a Netscape

  • Aquests són alguns diccionaris:
  • Linux: poseu-los a /usr/lib/netscape/spell
  • MS Windows: poseu-los a ...\Netscape\Communicator\Program\SpellChk\

Diccionaris per a ispell

  1. Obteniu els diccionaris (de català: ispell-ca, Softcatalà)
  2. Modifiqueu [/usr/share/emacs/20.7/lisp/]ispell.el per a afegir el català i compilar-lo (menú Emacs-Lisp/Byte-compile this file) Amb això ens funcionarà ispell-change-disctionary (accessible també des del menú Edit/Spell/Change dictionary)
  3. Modifiqueu [/usr/share/emacs/20.7/lisp/]loaddefs.el per a afegir el català i compilar-lo (menú Emacs-Lisp/Byte-compile this file) Amb això funcionarà el menú Edit/Spell/Select Catala.

Internacionalització de Netscape

Per a tenir el Netscape internacionalitzat des de UNIX us heu d'instal·lar:
  1. netscape-communicator
  2. (algun netscape-llengua)
Després establiu la variable d'entorn LANG al valor desitjat:
  • ca -> català
  • es -> castellà
I el netscape se us engegarà en aquella llengua.

Diccionari català per a MS Word

Descarregueu-vos aquest fitxer i seguiu les instruccions del fitxer HTML:

Defunció del ratolí en Linux

Si el ratolí se us ha mort mentre utilitzàveu Linux, proveu el següent:
  1. CTRL+ALT+F1 per anar a una sessió de text.
  2. Mogueu el ratolí i veureu el cursor (quadrat blanc) que belluga.
  3. CTRL+ALT+F7 per a tornar allà on éreu. El ratolí hauria d'anar bé.

Ratolí estrany en MSWindows 2000 sota VMWare

  • Dins de MSWindows: mireu si teniu dues petites icones a baix a la dreta que siguin "VMWare tools". Elimineu la que té el martellet i deixeu la del logotip de VMWare.
  • Més informació a vmware.for-linux.configuration: Jumpy mouse

CVS

  • server (computer_name)
    • urpmi cvs xinetd
    • cvs -d /usr/local/cvsroot/repository_name init
    • chown cvs.cvs /usr/local/cvsroot
    • sticky group (els nous fitxers i directoris es crearan amb el grup cvs / new files and directories are created as group cvs): 
      • chmod 2775 /usr/local/cvsroot
    • edit/etc/cvs/cvs.conf:
      • CVS_REPOS="/usr/local/cvsroot/repository_name"
    • start cvspserver (as root): 
      • (urpmi xinetd)
      • chkconfig cvs on
      • service xinetd restart
    • tallafoc / firewall:
      • mcc:
        • 2401/tcp
    • client: cvs -d :pserver:usuari@computer_name:/usr/local/cvsroot/repository_name login
  • Per a fer servir el WinCVS:
    • La primera vegada
      • CVSROOT -> :pserver:username@dev.isoco.com:/usr/local/cvs-repository
      • Identification: password on CVS server
      • Admin / Login
      • Create / Checkout del projecte que ens interessa:
        • Local directory: BackOfficeCVS (o un altre qualsevol)
        • CVS directory: BackOfficeRepository
      • Globals / read-only deshabilitada
    • Les altres vegades
      • per a pujar un fitxer que hem modificat: commit
      • per a baixar-nos l'última versió que hi ha al CVS: update
  • Si els fitxers es pugen per primera vegada al CVS en mode binary es baixaran com a tals quan es faci checkout o update.
  • L'inconvenient de fer-ho en binari és que si es modifica localment una versió més antiga que la que hi havia al CVS, no es fa el merge automàticament quan es puja.
  • Les combinacions text/binary són:
    PC local (commit) CVS (update) PC local fitxer final
    paraula^M -(bin)-> paraula^M -(-kb)-> paraula^M PC



    -(-ko)-> paraula^M^M Netscape
    paraula^M -(text)-> paraula -(-kb)-> paraula UNIX



    -(-ko)-> paraula^M PC
  • Per a eliminar "-kb" d'un fitxer (*):
    • cvs admin -kkv toto.txt
    • cvs update -A toto.txt (des de lincvs: "Treure opcions locals (-kx")
  • Per a eliminar "-kb" de tots els fitxers d'un directori (*):
    • find . -type f -maxdepth 1 -print | xargs -n1 cvs admin -kkv
    • find. -type f -maxdepth 1 -print | xargs -n1 cvs update -A
  • Els finals de línia es fan de les formes següents, depenent del sistema operatiu (aquesta nomenclatura és la que fa servir TextPad):
    PC ^M \r \n CR LF
    UNIX      \n    LF
    Mac ^M \r CR
    Netscape ^M^M \r \r \n CR CR LF
    CR: 0D, LF: 0A
  • Vigileu que el rellotge del vostre ordinador estigui ben configurat (GMT+1) i a l'hora. Si no, pot ser que no es detectin diferències entre els fitxers locals i els corresponents al CVS.
  • Canvi de log en un commit:
    • crear nou_log.txt amb els nous comentaris per a la versió 1.35 de fitxer.cpp (que conté uns comenatris erronis)
    • Linux:
      • cvs admin -m 1.35:"`cat nou_log.txt`" fitxer.cpp
    • Cygwin:
      • /cygdrive/c/Archivos\ de\ programa\LinCVS\cvs admin -m 1.35:"`cat nou_log.txt`" fitxer.cpp
    • MS Windows (amb text de comentari simple):
      • "c:\Archivos de programa\LinCVS\cvs.exe" admin -m 1:35:"canvis de l'actual versió" fitxer.cpp

WinCVS -> LinCVS

  • CVS/Root:
    • :pserver;username=usuari;hostname=maquina:/cvsroot -> :pserver:usuari@maquina:/cvsroot

Subversion

  • servidor (maquina)
  • Sincronització / Synchronisation
  • GUI client
    • Eclipse
    • esvn
      • File / Options / Other / Authentication / User and Password
      • ~/.qt/esvnrc
    • TortoiseSVN
  • Client
    • List of modules:
      • svn list svn://maquina/repo1 --verbose --non-interactive
      • ~/.subversion
    • Creació de directoris / Creation of directories
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/ -m "added module_name"
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/trunk/ -m "added module_name trunk"
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/tags/ -m "added module_name tags"
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/branches/ -m "added module_name branches"
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/trunk/dir1/ -m "added dir1"
    • Pujada de codi per primera vegada / First time upload
      • cd module_name_local_dir_no_svn
      • svn import . svn://host/repo1/module_name_remote/trunk/
    • Baixada de codi per primera vegada / First time download:
      • svn co svn://host/repo1/module_name_remote/trunk/ /local/dir/module_name_local
    • Estat local / Local status
      • svn status
    • Estat remot / Remote status
      • svn status -uv
    • Actualització / Update
      • svn update
    • Afegir / Add
      • svn add file1 file2 ...
      • svn delete --keep-local file1 file2 ...
      • un directori, però sense el seu contingut / a directory without its contents
        • svn add --depth=empty name_dir
    • Pujada / Commit
      • svn commit [fitxer_local] -m "comentari"
    • Diferències locals / Local differences
      • svn diff
      • svn diff | kompare -on -
      • meld .
    • Diferències remotes / Remote differences
      • svn diff -r HEAD
    • Dóna un conflicte per resolt / Mark a conflict as resolved
      • svn resolved toto.txt
    • Etiquetes / Tags
      • svn copy http://svn.example.com/repos/calc/trunk http://svn.example.com/repos/calc/tags/release-1.0 -m "Tagging the 1.0 release of the 'calc' project."
    • Propietats / Properties
      • Estableix les propietats / Set properties (*)
        • directament / directly:
          • svn propset svn:ignore dirname .
        • editant-les / editing:
          • svn propedit svn:ignore . --editor-cmd emacs
        • des de fitxer / from file:
          • svn propset svn:ignore -F file.txt .
          • on / where file.txt
            • dir1
              dir2
      • Unset
        • svn pdel svn:ignore .
      • Get properties
        • svn proplist
        • svn propget svn:ignore
      • List of properties
        • svn:ignore
        • svn:external
      • Eclipse
    • Remote dump:
      • svnrdump (v>=1.7)
        • urpmi subversion-tools
      • rsvndump
      • Creació del dump:
        • svnrdump dump http://server_name/repository_name/ > repository_name.dump
      • Recuperació del dump:
        • svnrdump load http://new_server_name/new_repository_name/ < repository_name.dump
        • Problemes / Problems:
          • svnrdump: E165006: Repository has not been enabled to accept revision propchanges;
          • Solució / Solution (*):
            • al servidor / on server (new_server_name):
              • cd /var/lib/svn/repositories
              • echo '#!/bin/sh' > new_repository_name/hooks/pre-revprop-change
              • chmod 755 new_repository_name/hooks/pre-revprop-change
    • Canvi de servidor:
      • svn sw --relocate old_url new_url
    • svn+ssh
      • NOTE: if you don't generate the pair of keys, you can use svn+ssh schema with login/password, but you need to specify the absolute path.
      • ssh-keygen -t rsa -C remoteserver_name -f ~/.ssh/id_rsa_remoteserver
      • edit file ~/.ssh/config
        • Host hostname
              HostName hostname
              User username
              IdentityFile ~/.ssh/id_rsa_remoteserver
      • chmod 600 ~/.ssh/config
      • send ~/.ssh/id_rsa_hostname.pub to hostname and put it under ~username/.ssh/authorized_keys. All this is done by simply:
        • ssh-copy-id -i .ssh/id_rsa_remoteserver.pub username@remoteserver
      • svn list svn+ssh://username@hostname/absolute_path/to/repo1
      • if you want to avoid the specification of the absolute path, edit the file on the server:
        • ~username/.ssh/authorized_keys
          • command="/path/to/svnserve -t -r /virtual/root" ssh-rsa KEY COMMENT (where /virtual/root could be, e.g. /var/lib/svn/repositories/)
        • then you can access the repository with:
          • svn list svn+ssh://username@hostname/repo1
  • cvs2svn
    • urpmi cvs2svn
    • Documentation
    • without options file
      • cvs2svn -s /var/lib/svn/repositories/repo2 --encoding latin_1 /usr/local/cvsroot/repository_name/module_name (/usr/local/cvsroot/repository_name/CVSROOT exists)
      • cvs2svn --dumpfile DUMPFILE CVSREPOS
    • with options file
        • (cd /home/cvs)
        • wget http://cvs2svn.tigris.org/source/browse/*checkout*/cvs2svn/tags/2.3.0/cvs2svn-example.options
        • cp cvs2svn-example.options your_file.options
      • your_file.options:
        • ctx.cvs_author_decoder = CVSTextDecoder(['latin1',],)
          ctx.cvs_log_decoder = CVSTextDecoder(['latin1',],)
          ctx.cvs_filename_decoder = CVSTextDecoder(['latin1',],)
        • ctx.output_option = DumpfileOutputOption(
              dumpfile_path=r'toto.dump', # Name of dumpfile to create
              )
        • run_options.add_project(
          'my/cvsrepo/project_a',
          trunk_path='project_a/trunk',
          branches_path='project_a/branches',
          tags_path='project_a/tags',
          symbol_transforms=[
          #...whatever...
          ],
          symbol_strategy_rules=[
          #...whatever...
          ] + global_symbol_strategy_rules,
          )
        • run_options.add_project(
          'my/cvsrepo/project_b',
          trunk_path='project_a/trunk/dir_b',
          branches_path='project_a/branches/dir_b',
          tags_path='project_a/tags/dir_b',
          symbol_transforms=[
          #...whatever...
          ],
          symbol_strategy_rules=[
          #...whatever...
          ] + global_symbol_strategy_rules,
          )
      • cvs2svn --options=your_file.options
    • Importar el fitxer dump.

Git

  • Problemes / Problems
    • fatal: unable to access 'https://github.com/...': Peer reports incompatible or unsupported protocol version.
      • Check if the problem is the same with curl:
        • bad response:
          • $ curl -v -I -X GET https://github.com/meetecho/janus-gateway/
            * About to connect() to github.com port 443 (#0)
            *   Trying 192.30.253.112...
            * Connected to github.com (192.30.253.112) port 443 (#0)
            * Initializing NSS with certpath: sql:/etc/pki/nssdb
            *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
              CApath: none
            * NSS error -12190 (SSL_ERROR_PROTOCOL_VERSION_ALERT)
            * Peer reports incompatible or unsupported protocol version.
            * Closing connection 0
            curl: (35) Peer reports incompatible or unsupported protocol version.
        • good response:
          • $ curl -v -I -X GET https://github.com/meetecho/janus-gateway/
            * About to connect() to github.com port 443 (#0)
            *   Trying 192.30.253.112...
            * Connected to github.com (192.30.253.112) port 443 (#0)
            * Initializing NSS with certpath: sql:/etc/pki/nssdb
            *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
              CApath: none
            * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
            * Server certificate:
            *       subject: CN=github.com,O="GitHub, Inc.",L=San Francisco,ST=California,C=US,postalCode=94107,STREET="88 Colin P Kelly, Jr Street",serialNumber=5157550,incorporationState=Delaware,incorporationCountry=US,businessCategory=Private Organization
            *       start date: Mar 10 00:00:00 2016 GMT
            *       expire date: May 17 12:00:00 2018 GMT
            *       common name: github.com
            *       issuer: CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US
            > GET /meetecho/janus-gateway/ HTTP/1.1
            > User-Agent: curl/7.29.0
            > Host: github.com
            > Accept: */*
            >
            < HTTP/1.1 200 OK
            ...
      • Solució / Solution
        • update nss (3.19 -> 3.28):
          • CentOS
            • sudo yum install nss
  • Pujar un projecte a un servidor central / Import a project into a central server
    • on server (user connected via ssh), create the repository:
      • $ cd /opt/git
        $ mkdir project.git
        $ cd project.git
        $ git --bare init [--shared=group]
      • shared for group members:
        • git config core.sharedRepository true
        • chgrp unix_project_group -R /opt/git/project.git/
        • find /opt/git/project.git/ -type d -exec chmod 2770 {} +
        • find /opt/git/project.git/ -type f -exec chmod660 {} +
    • on client computer with the original code:
      • $ cd myproject
        $ git init
        $ echo -e "*.pyc\n*~\n.project\n.pydevproject" > .gitignore
        $ git add .
        $ git commit -m 'initial commit'
        $ git remote add origin git@gitserver:/opt/git/project.git
        $ git push origin master
    • on other client computer:
      • $ git clone git@gitserver:/opt/git/project.git
        $ cd project
        $ vim README
        $ git commit -am 'fix for the README file'
        $ git push origin master
  • backup

    • config copied all branches to local working branch usable as local (working) git usable as origin git sync with original size typical usage
      git clone remote_repo_url.git local_repo [core]
              repositoryformatversion = 0
              filemode = true
              bare = false
              logallrefupdates = true
      [remote "origin"]
              url = remote_repo_url.git
              fetch = +refs/heads/*:refs/remotes/origin/*
      [branch "master"]
              remote = origin
              merge = refs/heads/master
      all refs (?) master (HEAD) yes
      git fetch size of repo (.git) + size of working branch
      working developer
      git clone --bare remote_repo_url.git local_repo.git [core]
              repositoryformatversion = 0
              filemode = true
              bare = true
      [remote "origin"]
              url = remote_repo_url.git
      all refs

      no
      yes, but not in sync with the original one
      (not possible)
      size of repo
      git clone --mirror remote_repo_url.git local_repo [core]
              repositoryformatversion = 0
              filemode = true
              bare = true
      [remote "origin"]
              url = remote_repo_url
              fetch = +refs/*:refs/*
              mirror = true
      all refs

      no
      when up to date, identical to the original one
      • git remote update
      • git --git-dir project.git remote update
      size of repo to copy an entire repo to a new git server
      git bundle create local_bundle_file --all


      no
      no -
      size of repo create a single file from a local git repo (--all: backup)
      git copy







    • ...
    • Backup a GitHub repository
    • Git Repository Backup
    • Fully backup a git repo?
    • What's the difference between git clone --mirror and git clone --bare
    • git bundle
      • create a bundle file (--all: with all heads) from inside a local git repo
        • git bundle create reponame.bundle --all
      • incremental
        • (see: man git bundle)
      • inspect:
        • git bundle list-heads reponame.bundle
      • regenerate a git repo from a bundle file:
        • git clone [-b master] reponame.bundle reponame_from_bundle
        • git clone --bare reponame.bundle reponame_from_bundle
    • git clone --mirror
      • ...
    • Passos / Steps
      • from a computer with access to the origin git
        • first time: create a mirror and a bundle file from it
          • git clone --mirror git@some.origin/reponame.git /path/to/reponame.git
          • cd /path/to/reponame.git
          • git bundle create /path/to/backups/reponame.bundle --all
        • next times (periodically): update the mirror and create a bundle file from it
          • git --git-dir /path/to/reponame.git remote update
          • cd /path/to/reponame.git
          • git bundle create /path/to/backups/reponame.bundle --all
  • bare
  • pujar des de local a servidor remot (p.ex. GitLab)
    • Git global setup:
      • git config --global user.name "My Name"
      • git config --global user.email "myusername@toto.org"
    • Create a new repository:
      • git clone git@gitlab.com:mygroup/myproject.git
      • cd myproject
      • touch README.md
      • git add README.md
      • git commit -m "add README"
      • git push -u origin master
    • Push an existing folder:
      • cd existing_folder
      • git init
      • git remote add origin git@gitlab.com:mygroup/myproject.git
      • git add .
      • git commit -m "Initial commit"
      • git push -u origin master
    • Push an existing Git repository:
      • cd existing_repo
      • git remote rename origin old-origin
      • git remote add origin git@gitlab.com:mygroup/myproject.git
      • git push -u origin --all
      • git push -u origin --tags
  • GitHub / GitLab
  • GUI
    • until HEAD (yellow circle)
      • gitk
    • all (HEAD is yellow circle)
      • gitk --all
    • history of all modifications for a specific file (See changes to a specific file using git):
      • gitk [--all] <filename>
    • simplificat / simplified
      • gitk --simplify-by-decoration --all
  • info
    • git status
      • do not show untracked files:
        • git status -uno
    • git remote -v
      • project_name=$(git remote -v | head -n1 | awk '{print $2}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')
    • git remote show [remote-name]
    • git show
      • git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%C(yellow)%h|%C(red)%ai|%C(blue)%an|%C(green)%d %C(reset)%s"
      • git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%h | %ai | %an | %d %s"
      • git_date=$(git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%aI")
    • git show-ref
    • git describe
      • git describe --tags --long --abbrev=7
    • git branch -a
      • git_branch=$(git branch | grep \* | awk '{print $2}' | tr -d '(')
    • git log
      • options
        • --oneline: one line per commit
        • --decorate: add HEAD, branch, tag information
        • --graph: print as a graph
        • --all: print all commits (not only until HEAD)
      • examples
        • logs until HEAD:
          • git log --oneline --decorate --graph
          • git log --pretty=oneline
        • all logs:
          • git log --oneline --decorate --graph --all
        • with dates and authors:
          • git log --pretty=format:'%C(yellow)%h|%C(red)%ad|%C(blue)%an|%C(green)%d %C(reset)%s' --date=short --graph --all
    • git reflog
    • Inclusió de la informació del git en el codi font / Include git info in source files:
    • list files
    • git blame <filename>
      • show who modified lines in filename
    • git bisect
      • Use binary search to find the commit that introduced a bug
  • Change log
  • build a local repository (fetch) and a working copy (...) from a remote repository:
    • git clone [--depth=...] nom_usuari@origin_server:/full/path/to/repository.git
    • git clone [--depth=...] nom_usuari@origin_server:/full/path/to/repository.git <local_repository_name>
    • des d'un git en un altre directori local:
      • git clone /full/path/to/repository.git
      • git clone /full/path/to/repository
    • branca específica (branch_name) en un directori diferent (repository-branch_name):
      • git clone -b branch_name nom_usuari@origin_server:/full/path/to/repository.git repository-branch_name
    • Problemes / Problems
      • fatal: '/home/git/toto.git' does not appear to be a git repository
        fatal: The remote end hung up unexpectedly
        • Solució / Solution
          • make sure that user/group has the right permissions for all the subdirectories. For instance, if all the users from a given group must have write access to the origin repository:
            • chmod g+wX -R /home/git/toto.git
    • only a specific directory (dir_in_project) inside a project:
      • git init ~/my_dir
      • cd ~/my_dir
      • git remote add -m branch_name origin https://github.com/user/project.git
      • git config core.sparsecheckout true
      • echo dir_in_project >> .git/info/sparse-checkout
      • git pull origin branch_name
      • git checkout branch_name
  • commit to local repository
    • option 1:
      1. add selected modified files to stage:
        • git add fitxer1 fitxer2
      2. commit files that are on stage:
        • git commit -m "comentari"
    • option 2:
      1. add all modified files to satge ans commit them in a single step:
        • git commit -a -m "comentari"
    • modify comment:
  • diferències / differences
    • entre les modificacions locals i el repositori (per exemple, abans de fer l'add) / between local modifications and repo (e.g. before making add)
      • git diff toto_file | kompare -
      • git difftool -d -t kompare
      • git difftool -d -t meld
    • entre dues branques / between two branches:
    • entre dues versions del mateix fitxer:
    • entre dues version de dos fitxers diferents:
      • git diff <revision_1>:<file_1> <revision_2>:<file_2>
      • git difftool revision_1:file_1 revision_2:file_2
  • sync with remote
    • 3.5 Git Branching - Remote Branches
    • Syncing a fork (GitHub)
    • How to keep two Git repositories in sync
      • setup
        • if your primary_repo is not bare, you may want to checkout every remote branch to convert them to local
        • git clone --mirror https://primary_repo_url/primary_repo.git
        • cd primary_repo.git
        • git remote add --mirror=fetch secondary https://secondary_repo_url/secondary_repo.git
      • sync primary -> secondary
        • git fetch origin
        • git push secondary --all
      • sync secondary -> primary
        • git fetch secondary
        • git push origin
      • sync primary <-> secondary
        • mkdir ../workdir
        • git fetch origin
        • git --work-tree=../workdir/ checkout branch_name file_name1
        • git fetch secondary
        • git --work-tree=../workdir/ checkout branch_name file_name2
        • git push secondary
        • git push origin
    • show the remotes:
      • git remote -v
    • remove the remote "origin"
      • git remote remove origin
      • git remote remove <remote_name>
    • add a new remote (default to "origin"):
      • git remote add origin remote_user@remote_server.org:/home/user/toto.git
      • git remote add <remote_name> remote_user@remote_server.org:/home/user/toto.git
    • check remote changes:
    • get the remote (default to "origin") changes into the local repository (e.g. to get new branches), without merging:
      • git fetch
      • git fetch <remote_name>
      • all remotes:
        • git fetch --all
    • pull (= git fetch + git merge FETCH_HEAD) the remote changes to local repository:
    • discard local changes
    • push the local repository to a remote (default to "origin"):
      • git push
      • git push <remote_name>
      • push only a branch
        • git push origin +<branch_name>
        • git push <remote_name> <branch>
        • git push <remote_name> <local_branch>:<remote_branch>
      • replace a remote branch by local version of the branch (e.g. after a squash)
        • git push --force origin <branch_name>
        • alternative:
          • git push origin :<branch_name> # to delete remote branch
          • git push origin <branch_name> # to push the local branch
    • Problemes / Problems
  • change the remote origin (e.g. to GitLab):
    • git remote -v
    • git remote remove origin
    • git remote add origin git@gitlab.com:<your_group>/<your_project>.git
    • git branch --set-upstream-to=origin/master master
    • git pull
  • get a given branch or commit
    • git checkout master
    • git checkout remotes/git-svn
    • git checkout c8a1
  • ignore
    • gitignore
    • gitignore.io (create .gitignore file for a lot of languages/frameworks)
    • user
      • $HOME/.config/git/ignore
    • repository
      • .gitignore
    • exemples / examples:
      • *.pyc
  • submodules
  • revert / reset
    • revert will add new commits
    • reset will not add new commits
    • Undo commit
      • not pushed yet (all local commits will be discarded):
        • git reset --hard origin/<branch_name>
      • already pushed:
        • git revert ...
        • only last commit:
          • git revert HEAD
          • git push
        • last two commits:
          • git revert HEAD~1
          • git push
        • ...
    • Undoing Merges
      • local:
        • git reset --hard <hash_of_commit_previous_to_merge>
      • local and remote:
        • git revert -m 1 <hash_of_merge_commit>
        • redo merge
          • git revert <hash_of_first_revert>
    • Rolling back changes with revert
    • reset remote branch
      • to the same commit as in local
        • Resetting remote to a certain commit
        • steps
          • you may need to temporarily configure repo to accept forced push:
            • GitLab
              • Settings -> Repository -> Protected Branches
                • master: Allowed to force push
          • then, from local at the commit of your branch (e.g. master) you want the remote (e.g. origin) to be reset to:
            • git push --force origin <commit_sha>:master
  • branch
    • Git - Branches in a nutshell
    • clone a given branch
      • git clone -b branch_name nom_usuari@origin_server:/full/path/to/repository.git repository-branch_name
    • list all local branches
      • git branch
    • list all available (local and remote) branches
      • git branch -a
      • sort by date
        • git branch -v --sort=committerdate
        • git branch -a -v --sort=committerdate --no-merged
        • git for-each-ref --sort=-committerdate refs/heads/
    • get current branch
      • git rev-parse --abbrev-ref HEAD
      • git symbolic-ref --short HEAD
    • branch management
      • git branch
      • git branch -v
      • git branch --merged
      • git branch --no-merged
      • git branch -v --sort=committerdate --no-merged
    • create a new branch:
      • git branch <branch_name>
    • switch to the new branch:
      • git checkout <branch_name>
    • create a new branch and switch to it:
      • git checkout -b <branch_name>
    • create a local branch based on a remote one (a previous fetch was done) and switch to it:
      • git checkout <branch_name>
      • git checkout --track <remote_name>/<branch_name>
      • git checkout -b <local_branch_name> <remote_name>/<remote_branch_name>
    • rename a local branch (*)
      • git branch -m <old_branch_name> <new_branch_name>
    • rename a remote branch (*)
      • git branch -m <old_branch_name> <new_branch_name>
      • git push origin :<old_branch_name>
      • git push --set-upstream origin <new_branch_name>
      • other users:
        • git fetch origin --prune
    • upstream (connect to/track a remote branch)
      • set the upstream:
        • git branch -u <remote_name>/<remote_branch_name>
        • git branch --set-upstream-to=<remote_name>/<remote_branch_name>
      • get the upstream:
        • git branch -vv
      • delete the upstream:
        • git ...
    • push a local branch
      • git push origin <branch_name>
      • undo a push (recently done)
        • git reset --hard HEAD~1
        • git push --force
    • get new branches from origin
      • git fetch
    • merge master into your branch
      • git checkout <branch_name>
      • git merge --no-ff master
      • Abort merge
        • git reset --merge
    • merge your branch into master
      • git checkout master
      • git merge --no-ff <branch_name>
    • discard local merge, not pushed yet
    • dry-run merge (Is there a git-merge --dry-run option?)
      1. git merge --no-commit --no-ff <branch_name>
      2. git status -uno
      3. git merge --abort
    • revert / undo a merge
    • conflicts
      • solve conflicts
        • manually, or
        • git mergetool
      • git add <file_with_resolved_conflicts>
      • git status
      • git commit -m ...
    • delete branch
      • git branch -d <branch_name>
      • to force deletion:
        • git branch -D <branch_name>
      • delete branch in origin
    • rebase branch (sense canviar-ne el nom / without changing name)
      • git checkout my_branch
      • git rebase master
      • git push --force-with-lease origin my_branch
      • other users should remove their local versions of the branch and checkout the rebased one:
        • git branch -D my_branch
        • git fetch
        • git checkout my_branch
    • rebase branch (canviant-ne el nom / changing name)
      • git checkout my_branch
      • git rebase master
      • git branch -m my_branch my_branch_rebased
      • git branch --unset-upstream my_branch_rebased
      • git push --set-upstream origin my_branch_rebased
      • other users
        • git fetch origin --prune
  • squash
  • tag
    • Git - Tagging
    • Semantic versioning 2.0.0
    • crea una etiqueta / create a tag:
      • git tag -a nom_tag [-m "my comments"]
      • lightweight
        • git tag lw_nom_tag
      • git push origin nom_tag
    • etiqueta un commit anterior / tag a previous commit:
      • git log --pretty=oneline
        • 9fceb02...
      • git tag -a v1.2 9fceb02
    • llista d'etiquetes / list of tags:
      • git tag
    • detalls sobre una etiqueta / details about a tag
      • git show nom_tag
    • puja a origin
      • una etiqueta
        • git push origin nom_tag
      • totes les etiquetes
        • git push origin --tags
    • afegeix un comentari a una etiqueta existent / add a comment to an existing tag:
      • git tag -f existing_tag existing_tag -m "my comments"
    • esborra una etiqueta / delete a tag:
      • local
        • git tag -d old_tag
      • origin
        • git push --delete origin old_tag
    • reanomena una etiqueta / rename old_tag -> new_tag:
      • git tag new_tag old_tag
      • git tag -d old_tag
      • git push origin new_tag
    • get
  • cherry-pick
    • Aplicar un commit a otra rama con git cherry-pick
    • apply changes from a hotfix to preproduction branch:
      1. git checkout branch_with_hotfix
      2. git log --pretty=oneline
        • note the commit_id of the commit you want to apply to preproduction branch
      3. git checkout preproduction
      4. git cherry-pick <commit_id>
  • patch
    • 5.3 Distributed Git - Maintaining a Project
    • Option 1: to be applied with classical patch
      • Creació / Creation
        • git diff -p v1.0.0 >0001.patch
      • Aplicació / Application
        • patch -p1 <0001.patch
    • Option 2: to be applied to a git repo
      • Creació / Creation
        • diferències entre el git local (amb els commits fets) i l'origin:
      • Aplicació / Application
        • git apply 0001-toto-description.patch
        • git am ...
      • Desfer l'aplicació / Undo application
        • git apply -R 0001-toto-description.patch
  • archive
  • git - svn
    • 9.1 Git and Other Systems - Git as a Client
    • Git and Subversion
    • git-svn(1)
    • Howto Use Git and Svn Together
    • git-svn tutorial
    • Git Diff between HEAD and SVN Master
    • Bitbucket
    • Exemples / Examples
      • rèplica de tot el repositori (s'hi pot estar una bona estona):
        • git svn clone svn://svn.code.sf.net/p/gpac/code/ [-T trunk -b branches -t tags] [local_name]
        • you can replace "-T trunk -b branches -t tags" by the equivalent, shorter one "-s"
        • només una part de la història:
          • git svn clone -s -r 4000:HEAD svn://svn.code.sf.net/p/gpac/code/
      • baixa només la darrera versió de trunk:
        • primera vegada / first time
          • cd /path/to/; mkdir gpac; cd gpac
          • git svn init svn://svn.code.sf.net/p/gpac/code/trunk/gpac
          • git svn fetch -rHEAD (or specific revision, obtained with "svn log svn://svn.code.sf.net/p/gpac/code/trunk/gpac")
          • git svn clone -rHEAD svn://svn.code.sf.net/p/gpac/code/trunk/gpac
          • or a range of revisions (from r4000 to HEAD)
            • git svn clone -r 4000:HEAD svn://svn.code.sf.net/p/gpac/code/trunk/gpac
      • actualitza el git a partir de l'svn / update git from svn:
        • git svn rebase
      • des d'un altre ordinador, sincronitza cap a aquest nou git creat / attach another client computer to this newly created git
        • git clone user@server:/path/to/gpac.git
        • o bé, des del matiex ordinador, en un altre directori / or, from the same computer, on another directory:
          • git clone /path/to/gpac/
      • a l'ordinador que sincronitza l'svn, mira les diferències que hi ha entre el git local (master) (amb els commits fets) i la versió que s'ha baixat de l'svn remot (remotes/git-svn):
        • comprova les branques existents
          • git branch -a
        • git diff remotes/git-svn..
        • crea un patch amb aquestes diferències:
          • git format-patch remotes/git-svn
    • Migració / Migration svn -> git
      • 8.2 Git and Other Systems - Migrating to Git
      • Passos / Steps
        1. Optional: get the authors from svn history, and edit the resulting users.txt file:
          • svn log --xml | grep -P "^<author" | sort -u | perl -pe 's/<author>(.*?)<\/author>/$1 = /' > users.txt
        2. Clone the remote svn to a local git (as before):
          • git svn clone svn://server/remote_project_name [--authors-file=users.txt] --no-metadata local_project_name
        3. post-import cleanup (for branches and tags)
          • ...
        4. Add a remote server:
          • git remote add origin your_login_name@remote_git_server:/path/to/project_name.git
        5. On the remote server, create the repository
        6. from your local computer push to it:
          • git push origin --all

Grafana

  • Instal·lació / Installation
    • Dependències / Dependencies
      • Mageia
        • urpmi ...
    • Get Grafana
      • tar
        • wget https://dl.grafana.com/oss/release/grafana-6.5.3.linux-amd64.tar.gz
        • tar -zxvf grafana-6.5.3.linux-amd64.tar.gz
      • rpm
        • wget https://dl.grafana.com/oss/release/grafana-6.5.3-1.x86_64.rpm
        • Mageia (not working: needs freetype)
          • urpmi grafana-6.5.3-1.x86_64.rpm
        • ...
    • Start server
      • sudo ...grafana-6.5.3/bin/grafana-server
  • Ús / Usage
    • http://localhost:3000/
    • admin / admin (només la primera vegada / only the first time)
    • Data Source Dashboard

      InfluxDB
      • URL: http://localhost:8086
      • Database: home_db
      Query: InfluxDB
      • A
        • FROM default temperature WHERE machine = unit42
        • SELECT field(external) mean()
        • GROUP BY time($_interval) fill(null)
        • FORMAT AS Time series
        • ALIAS BY unit42_external
      • B
        • FROM default temperature WHERE machine = unit42
        • SELECT field(internal) mean()
        • GROUP BY time($_interval) fill(null)
        • FORMAT AS Time series
        • ALIAS BY unit42_internal


      InfluxDB
      • URL: http://localhost:8086
      • Database: sensors



Calendaris / Calendars

apropos

  • makewhatis

Matlab

  • gcf = figure( 'Position', [0 0 mida_x mida_y] );
    ...
    axis( [0 255 0 Inf] );
    set( gcf, 'PaperPositionMode', 'auto' );
    print( '-r72', '-dtiff', 'toto.tif' );

C / C++

  • Temps / Time
    • include <time.h>
    • time_t tHoraActualUTC;
    • time( &tHoraActualUTC ); // get present time
-> time_t tm str
time_t
(sec from 1 jan 1970)
- gmtime
localtime ctime
tm
(struct)
timegm (gnu c)
_mkgmtime (ms visual)
- asctime
mktime (ansi)
timelocal (gnu c)

str
getdate
strptime
strftime
-

NO fa la conversió a hora local
fa la conversió a hora local

Cygwin

Postfix (servidor de correu / email server)

  • Instal·lació / Installation
    • CentOS
      • sudo yum install postfix
  • Configuració / Configuration
    • MSA
      Mail Submission Agent
      MTA
      Mail Transfer Agent
      MDA
      Mail Delivery Agent
      Postfix smtpd (server) Postfix smtpd (SMTP server: receiving)
      Postfix smtp (SMTP+LMTP client: sending) dovecot, cyrus
      /etc/postfix/master.cf
      /etc/postfix/main.cf
      (sudo postconf -e ...)
      /etc/postfix/main.cf
      (sudo postconf -e ...)

      Enable port 587:
      • submission inet n       -       n       -       -       smtpd
          -o syslog_name=postfix/submission
          -o smtpd_tls_security_level=encrypt
          -o smtpd_sasl_auth_enable=yes
          -o smtpd_reject_unlisted_recipient=no
          -o smtpd_client_restrictions=$mua_client_restrictions
          -o smtpd_helo_restrictions=$mua_helo_restrictions
          -o smtpd_sender_restrictions=$mua_sender_restrictions
          -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
          -o milter_macro_daemon_name=ORIGINATING
      • # network interfaces that listen
        inet_interfaces
        = localhost, 192.168.1.100
      • # trusted networks that can send messages
        mynetworks = 192.168.1.0/24, 127.0.0.0/8
      • # domain name for this email server
        mydomain = example.org
      • # host name of the system
        myhostname = mail.example.org
      • # domain for locally-posted email
        myorigin = $mydomain
      • # this server is destination for emails with this domain
        mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
      • # destination domains this server can relay to
        relay_domains =
      • home_mailbox = Maildir/


      SASL: cyrus
      • ...
      SASL: dovecot
      • smtpd_sasl_auth_enable = yes
      • broken_sasl_auth_clients = yes
      • smtpd_sasl_type = dovecot
      • smtpd_sasl_path = private/auth
      • smtpd_sasl_security_options = noanonymous
      • smtpd_sasl_local_domain =
      • smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
      SASL (when relaying: connection to a remote STMP for submission):
      • smtp_sasl_auth_enable = yes
      • smtp_tls_security_level = encrypt
      • smtp_sasl_tls_security_options = noanonymous
      • relayhost = [mail.isp.example]
        # Alternative form:
        # relayhost = [mail.isp.example]:submission
      • smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd


      certificates (server):
      • self signed test certificates (including key) can be created with OpenSSL: "cd /etc/postfix/; make -f /etc/pki/tls/certs/Makefile mail.example.org.pem"
        • smtpd_tls_cert_file = /etc/postfix/mail.example.org.pem
        • smtpd_tls_key_file = $smtpd_tls_cert_file
      • Let's Encrypt certificates:
        • smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.org/fullchain.pem
        • smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.org/privkey.pem
      STARTTLS:
      • smtpd_tls_security_level = may
      TLS (server):
      • smtpd_use_tls = yes
      • smtpd_tls_loglevel = 1
      • smtpd_tls_received_header = yes
      • #smtpd_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
      • smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

      TLS (client) (connection to destination MTA; e.g. if not secure, Gmail will mark message as non secure):
      • smtp_use_tls (obsolete since Postfix 2.3)
      • smtp_tls_security_level = may
      • smtp_tls_note_starttls_offer = yes
      • smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt # see also: ca-root-nss.crt



      Virtual maps
      • virtual_alias_domains = $mydomain
      • virtual_alias_maps = hash:/etc/postfix/virtual



      /etc/postfix/virtual
      • postmaster@example.org root
        root@example.org root
        info@exampe.org info
      • sudo postmap /etc/postfix/virtual

    • Postfix Standard Configuration Examples
    • Test configuration
      • postconf
    • Django + Postfix
    • Postfix rate limiting – Politeness goes a long way
    • CentOS 5
    • Port
      • Enable port 587 (submission), that will enable STARTTLS on 250 responses to EHLO request
        • /etc/postfix/master.cf
          • submission inet n       -       n       -       -       smtpd
              -o syslog_name=postfix/submission
              -o smtpd_tls_security_level=encrypt
              -o smtpd_sasl_auth_enable=yes
              -o smtpd_reject_unlisted_recipient=no
              -o smtpd_client_restrictions=$mua_client_restrictions
              -o smtpd_helo_restrictions=$mua_helo_restrictions
              -o smtpd_sender_restrictions=$mua_sender_restrictions
              -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
              -o milter_macro_daemon_name=ORIGINATING
    • Seguretat / Security
      • Info
      • Let's Encrypt
      • STARTTLS
        • Problemes / Problems
          • warning: TLS library problem: 5294:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol:s23_srvr.c:647:
            • Solució / Solution
              • telnet/nc does not allow sending non-encrypted text once STARTTLS has been invoked
              • use openssl s_client instead
      • Autenticació / Authentication
        • SASL - Simple Authentication and Security Layer
          • Postfix SASL Howto
          • supported SASL implementations:
            • postconf -a
          • Cyrus SASL
            • Instal·lació / Installation
              • CentOS
                • sudo yum install cyrus-sasl
                • systemctl enable saslauthd.service
                • systemctl start saslauthd.service
          • Dovecot SASL
            • Instal·lació / Installation
            • Configuració / Configuration
              • Basic configuration
                • Authentication (users and passwords)
                  • Example from real user, with password stored as plain text (do not use it in real deployments):
                    • $ echo "$USER:{PLAIN}password:$UID:$(id -g)::$HOME" > users
                    • sudo mv users /etc/dovecot/
                  • Add non-system users with encrypted passwords
                    • Password Schemes (How To Safely Store A Password)
                    • check availability of encryption schemes:
                      • doveadm pw -l
                    • encrypt with SHA256-CRYPT:
                      • $ doveadm pw -s SHA256-CRYPT -p my_password
                        {SHA512-CRYPT}$6$...
                    • echo "$USER:{SHA512-CRYPT}$6$...:$UID:$(id -g)::$HOME" > /etc/dovecot/users
                  • sudo chown root.root /etc/dovecot/users; sudo chmod 600 /etc/dovecot/users
                  • /etc/dovecot/conf.d/10-auth.conf
                    • # Remove '#' to use passwd-file:
                      !include auth-passwdfile.conf.ext
                  • check:
                    • doveconf -n passdb userdb
              • /etc/dovecot/conf.d/10-master.conf (or under directory included by file specified when running: doveconf -n | head -n1)
                • service auth {
                  ...
                  # Postfix smtp-auth
                  unix_listener /var/spool/postfix/private/auth {
                  mode = 0660
                  # Assuming the default Postfix user and group
                  user = postfix
                  group = postfix
                  }
                  ...
                  }

                  # Outlook Express and Windows Mail works only with LOGIN mechanism, not the standard PLAIN:
                  auth_mechanisms = plain login
            • Prova / Test
              • Testing SASL authentication in the Postfix SMTP Server (postfix.org)
              • encode username and password in base64 (if password starts with a digit, and bash version >=2.3, check that you are using four zeros):
                • $ echo -ne '\0000username\0000password' | base64 <username_and_password_in_base64>
                • check decoding:
                  • $ echo -ne <username_and_password_in_base64> | base64 -d usernamepassword
              • $ openssl s_client -connect mail.example.org:587 -starttls smtp
                ...
                250 DSN
                AUTH PLAIN <username_and_password_in_base64>
              • Problemes / Problems
                • dovecot: auth-worker(5017): Error: passwd-file: open(/etc/dovecot/users) failed: Permission denied
    • non-relayed (local Postfix acts as a server: smtpd_...)
      • (feu servir el fitxer /etc/postfix/main.cf predeterminat / use the default /etc/postfix/main.cf file)
      • el camp "from" es crearà a partir de:
        • `whoami`@`hostname`
      • seguretat / security
      • usuaris / users
      • accessible des de fora / accessible from outside
        • inet_interfaces = ...
    • relayed (local Postfix acts as a client: smtp_...)
    • Debug
      • telnet localhost 25
        • 220 hostname.local ESMTP Postfix
      • mailq
      • /var/log/maillog
  • Client

Dovecot (servidor IMAP)

MySQL / MariaDB

  • Instal·lació / Iinstallation
    • Mageia
      • urpmi mysql mysql-MariaDB
      • # urpmi mariadb
    • Ubuntu
    • CentOS
      • yum install mariadb-server
    • # TMPDIR=/var/tmp mysql_install_db
    • # chmod 755 -R /var/lib/mysql
    • check that:
      • installation is ok (no errors about mysql user or group)
    • start the service
      • Mageia
        • systemctl enable mysqld.service
        • systemctl start mysqld.service
        • old way
          • service mysqld start
      • Ubuntu
        • sudo service mysql start
      • CentOS
        • systemctl enable mariadb.service
        • systemctl start mariadb.service
    • (cal?) # mysql_upgrade
    • check that it is working:
      • mysql [-h localhost -u root]
      • Note: "mysql -h 127.0.0.1 -u root" will not work
    • Establiu la contrasenya de root / Set the root password
    • Problemes / Problems
      • només s'hi pot connectar des de superusuari. Des d'usuari, apareix l'error "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)"
        • Solució / Solution:
          • # chmod 755 -R /var/lib/mysql
  • Set the root password (How to reset the root password) by using one of the following methods:
    1. mysql_secure_installation
    2. Command line (recommended by MariaDB after running mysql_install_db):
      • # /usr/bin/mysqladmin -u root password ['new-password']
      • # /usr/bin/mysqladmin -u root -p -h localhost password ['new-password']
      • # service mysqld restart
      • Check that it is working when logged as a regular user:
        • $ mysql -u root -p
    3. Use mysql-workbench
    4. Use mysql-administrator
    5. $ mysql -u root
      • mysql> UPDATE mysql.user SET password = password('new_password') WHERE user = 'root';
        mysql> FLUSH PRIVILEGES;
  • Afegir usuaris / Add users
    • Adding users
    • mysql -u root -p -h localhost mysql
      • CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
    • Creació d'una base de dades i un usuari:
      • mysql -u root -p -h localhost
        • CREATE DATABASE IF NOT EXISTS toto_db;
          GRANT ALL ON toto_db.* TO 'usuari'@'localhost' IDENTIFIED BY 'contrasenya';
          FLUSH PRIVILEGES;
          exit;
        • CREATE DATABASE IF NOT EXISTS toto_db;
          GRANT ALL ON toto_db.* TO 'usuari'@'%' IDENTIFIED BY 'contrasenya';
          FLUSH PRIVILEGES;
          exit;
  • Bolcat des d'un fitxer / Dump from file
  • Execució de comandes SQL en línia (o des d'un script) / Execution of on-lin SQL commands (or inside a script):
    • How to feed mysql queries from bash
    • Opció 1: using EOF:
      • mysql -u root -p mysql <<EOF
        CREATE USER 'usuari'@'localhost' IDENTIFIED BY 'contrasenya';
        EOF
      • mysql -u root -p > toto.txt <<EOF
        use toto_db;
        select * from toto_table;
        EOF
    • Opció 2: auxiliary file
      • mysql --host=localhost --user=user --password=password [database_name] < commands.sql
    • Opcions / Options
      • -s / --silent
      • -N / --skip-column-names
  • Time Zone Tables
  • Admin (GUI)
    • mysql-workbench
      • urpmi mysql-workbench
      • Set the root password:
        • New connection:
          • Connection Name: your_label
          • Connection Method: Local Socket/Pipe
          • Socket/Pipe Path: (leave empty)
          • Username: root
          • Password / Store in Keychain...: your_password
          • Default Schema: (leave empty)
      • Problemes / Problems
        • "pure virtual method called"
          • Solution:
            • ...
    • phpMyAdmin
    • mysql-administrator
      • urpmi mysql-administrator
      • Set the root password:
        • mysql-administrator
        • Stored connection / Save this connection...: your_label
        • Server hostname: localhost
        • Username: root
        • Password: (empty)
        • Connect
        • User Administration / root : New password / Apply changes
  • Accés remot / Remote access
    • server (IP address: server_ip_address):
      • /etc/my.cnf
        • comment "skip-networking"
        • ? bind-address
      • grant privileges for a user (user_with_remote_privileges) from a remote location:
        • from command line (user_with_remote_privileges is mythtv):
          • mysql -u root -p
          • mysql> grant all on mythconverg.* to mythtv@"%" identified by "mythtv";
          • mysql> flush privileges;
        • (?) from mysql-workbench:
          • Server administration:
            • Security / Users and privileges
              • Server Access Management
                • Select user: user_with_remote_privileges
                • Login name: user_with_remote_privileges
                • Limit connectivity to hosts matching: % (for any host)
              • Schema Privileges
                • Select user: user_with_remote_privileges
                • Add entry...
      • service mysqld restart
    • client (IP address: client_ip_address):
      • mysql -h server_ip_address -u user_with_remote_privileges -p
  • Logs
  • Problemes / Problems
  • Esborrar totes les bases de dades i eliminar la contrasenya de root:
    • rm -rf /var/lib/mysql
    • service mysqld restart
  • Esborrar mysql / Removing mysql
    • urpme mysql mariadb
    • this will not remove all the data (root password...). To completely remove mysql:
      • # rm -rf /var/lib/mysql
  • Causes of Access denied Errors
  • Configuration for:
  • Client (GUI)
    • sqlgui
      • urpmi sqlgui libsqlguimysql
      • ln -s /usr/lib/libsqlguimysql-0.1.1.so /usr/lib/libsqlguimysql.so
  • Backup
    • mysqldump database_name -u root -p > database_name.sql
    • mysqldump --all-databases -u root -p > all_databases.sql
    • cron backup
      • /var/spool/cron
        • 0 23 * * * /root/backup_base_dades.sh
      • /root/backup_base_dades.sh
        • #!/bin/bash
          DB_BACKUP_DIR="/var/export/backup"
          DB_USER="root"
          DB_PASSWD="******"
          DATE="`date '+%Y%m%d_%H%M'`"
          mysqldump -u$DB_USER -p$DB_PASSWD timetracker > $DB_BACKUP_DIR/backup_timetracker_$DATE.sql
          mysqldump -u$DB_USER -p$DB_PASSWD wikidb > $DB_BACKUP_DIR/backup_wikidb_$DATE.sql
          echo "$DATE: Backup done" > /tmp/backup_base_dades.txt
          mail -s "[backup] Backup base de dades" $EMAIL < /tmp/backup_base_dades.txt
    • backup from mysql-administrator (mabackup)
    • backup from mysql-workbench
  • Restore

Bugzilla

  • MySQL
  • Instal·lació / Installation
    • Mageia
      • urpmi apache-mpm-prefork postfix perl-DBD-mysql
      • [urpmi bugzilla-contrib eclipse-bugzilla]
      • [urpmi apache-mod_perl perl-GDGraph perl-Template-GD perl-Chart perl-PatchReader perl-Image-Magick perl-HTML-Scrubber perl-Apache-DBI perl-DBD-Pg perl-MIME-tools perl-Email-MIME-Attachment-Stripper perl-Email-Reply interdiff]
      • [urpmi 'perl(Authen::Radius)' 'perl(SOAP::Lite)' 'perl(JSON::RPC)' 'perl(JSON::XS)' 'perl(Test::Taint)' 'perl(TheSchwartz)' 'perl(Daemon::Generic)' 'perl(Math::Random::Secure)']
      • urpmi bugzilla
    • Ubuntu
      • sudo apt-get install liblist-moreutils-perl libdatetime-perl libtemplate-perl libemail-send-perl libemail-mime-perl liburi-perl libmath-random-isaac-perl
      • optional:
        • apt-get install lib...-perl
      • wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.4.4.tar.gz
      • sudo tar --directory /usr/local -xvzf bugzilla-4.4.4.tar.gz
  • Configuració / Configuration
    • Option 1: new bugzilla
      • run config:
        • Mageia
          • /usr/share/bugzilla/bin/checksetup.pl
        • Ubuntu
          • sudo /usr/local/bugzilla-4.4.4/checksetup.pl
      • configure mysql for bugzilla
        • add user 'bugs' with password xxxxx (specified with $db_pass in localconfig):
          • mysql -u root -p
          • mysql> GRANT SELECT, INSERT,
            UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
            CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*
            TO bugs@localhost IDENTIFIED BY 'xxxxx';
            mysql> FLUSH PRIVILEGES;
        • edit config file:
          • Mageia
            • /etc/bugzilla/localconfig
              • set $db_pass xxxxx
          • Ubuntu
            • /usr/local/bugzilla-4.4.4/localconfig
              • set $db_pass xxxxx
                $webservergroup = 'www-data';
        • run config again:
          • Mageia
            • /usr/share/bugzilla/bin/checksetup.pl
          • Ubuntu
            • sudo /usr/local/bugzilla-4.4.4/checksetup.pl
    • Option 2: from existing bugzilla
      • On previous machine: backup
        • mysqldump bugs -u root -p > bugs_$(date '+%Y%m%d_%H%M').sql
      • On new machine: restore
    • Apache configuration
      • Bugzilla using Apache
      • Mageia (Apache 2.4)
        • (config file /etc/httpd/conf/sites.d/bugzilla.conf already supplied by rpm package):
          • # Bugzilla Apache configuration
            Alias /bugzilla/data /var/lib/bugzilla/
            Alias /bugzilla /usr/share/bugzilla/www

            <Directory /usr/share/bugzilla/www>
                Require all granted

                Options ExecCGI
                DirectoryIndex index.cgi
                AddHandler cgi-script .cgi .pl
            </Directory>

            # The dot files must be accessible to the public webdot server
            # The png files locally created locally must be accessible
            <Directory /var/lib/bugzilla/webdot>
                <FilesMatch \.dot$>
                    Require host research.att.com
                </FilesMatch>

                <FilesMatch \.png$>
                    Require all granted
                </FilesMatch>
            </Directory>
      • Ubuntu (Apache 2.4)
        • /etc/apache2/sites-available/bugzilla.conf
          • Alias /bugzilla /usr/local/bugzilla-4.4.4

            <Directory
            /usr/local/bugzilla-4.4.4>
               
            Require all granted
                Options ExecCGI
                DirectoryIndex index.cgi
                AddHandler cgi-script .cgi .pl

            </Directory>
        • sudo a2ensite bugzilla
        • sudo a2enmod cgi
        • sudo service apache2 reload
      • Problemes / Problems
        • Service Unavailable. The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
          • Solution
            • sudo service apache2 restart
    • Mail server configuration
    • LDAP configuration
  • Usage:

Scmbug

  • CVS
  • Bugzilla
  • Scmbug
    • instal·lació dels paquets necessaris (exemple per a MandrivaLinux):
      • urpmi docbook-style-dsssl-doc perl-XML-Simple perl-Mail-Sendmail
    • correspondència entre usuaris de cvs i usuaris de bugzilla:
      • /etc/scmbug/daemon.conf
      • userlist => {enabled => 1, values => {'usuari' => 'usuari@domini.org'}}
    • inici del servei:
      • temporalment: service scmbug-server restart
      • permanentment: chkconfig scmbug-server on
    • enganxa l'scmbug entre cvs i bugzilla:
      • scm_install_glue --scm=CVS --product=nom_modul --repository=/usr/local/cvsroot --bug=1 --daemon=127.0.0.1 --binary-paths=/usr/bin
    • edita algunes preferències:
      • chmod 644 /usr/local/cvsroot/CVSROOT/etc/scmbug/glue.conf
      • /usr/local/cvsroot/CVSROOT/etc/scmbug/glue.conf 
      • presence_of_bugs_ids => {value => 'optional' }
      • </