Utilitats i trucs
|
Index
|
- Sistemes operatius
-
- Maquinari
-
- Programari
-
- Oficina
-
- Ciències
-
- Bibliografia
-
- Biblioteques XML
-
- CRM
-
- Text
-
- Gràfics
-
- Imatge / Image
- Sincronització
-
- Gestió del temps
-
- Calendaris
-
- Bases de dades
-
- DirectFB
- SCM (source control management)
-
- Seguretat / Security
-
- OpenSSL
-
- Claus / Keys
- CA
- Certificats / Certificates
- Revocació / Revocation
- Gestió de parcs d'ordinadors
-
- Tasques / Tasks
-
|
- Desenvolupament
-
- Àudio / Vídeo
-
- TV
-
- WWW
-
- Correu electrònic / E-mail
-
- Xarxes
-
- Flameproject
|
|
|
- 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 .
- Des de Linux: si la partició principal és, per exemple
/dev/hda7 :
dd if=/dev/hda7 of=/root/bootsec.lin bs=512
count=1
- 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.
- Des de Windows 2000: afegir al fitxer
c:\boot.ini
la línia
c:\bootsec.lin = "Linux"
- 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
|
|
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'/>
|
|
- 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
- Utils
-
- a2query
-
- a2ensite
- a2dissite
- a2enmod
- a2...
- Configuració
/
Configuration
-
- Virtual hosts (vhosts.d,
sites-available)
-
- /etc/hosts
-
- VirtualHost
Examples
-
- Name-based
Virtual
Hosts (More than one web site per IP address)
-
- non-secure virtual host
-
- /etc/httpd/conf/vhosts.d/02_tva_vhost.conf
-
NameVirtualHost
*:80
<VirtualHost *:80>
ServerName tva.com
ServerAlias tva.com *.tva.com
DocumentRoot /var/www/html_tva
</VirtualHost>
- accessed from browser as:
-
- secure virtual
host
-
- /etc/httpd/conf/vhosts.d/03_tva_ssl_vhost.conf
-
<VirtualHost
*:443>
ServerName tva.com
ServerAlias tva.com *.tva.com
DocumentRoot /var/www/html_tva
</VirtualHost>
- accessed from browser as:
-
- IP-based
Virtual
Hosts (An IP address for each web site)
- Place MediaWiki inside a Virtual Host
/etc/httpd/conf/vhosts.d/*.conf:
-
<Directory "/var/www/html_2">
Options -Indexes FollowSymLinks
MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
/etc/httpd/conf/httpd.conf or
/etc/apache2/apache2.conf
-
- 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
-
- check syntax:
-
- loaded modules
-
- Logs
-
- Apache
Module
mod_log_config
- detailed log in error_log (or name specified by
ErrorLog) file:
-
- 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
-
- 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
-
- 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)
-
- Exemples / Examples:
-
/var/www/your_app
- /etc/httpd/conf/webapps.d/your_app.conf
-
Alias /your_app
/var/www/your_app
<Directory "/var/www/your_app">
Order allow,deny
Allow from All
</Directory>
- Check user
permissions of
/var/www/your_app:
-
- Place MediaWiki inside a Virtual Host
- 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:
-
- 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)
-
- 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)
- 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:
-
- Creeu una CA
amb OpenSSL / Create
a
CA with OpenSSL
- 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
- Configuració del servidor Apache / Apache server
configuration:
- /etc/hosts
-
- /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
- Configuració del client / Client configuration
- import CA
- connect to server:
-
- Si la resposta és sec_error_inadequate_key_usage:
-
- 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
- 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:
-
- Creeu
un certificat de client amb OpenSSL / Create a
client certificate with OpenSSL (client.crt)
- Encapsuleu el
certificat de client en un fitxer PKCS12 /
Encapsulate client certificate into a PKCS12 file
(client.p12)
- Configuració del servidor
Apache / Apache server configuration:
- import CA certificate
-
- creat per nosaltres / created by us
-
- 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:
-
- Install mod_auth_certificate
(*)
-
- urpmi apache-mod_auth_certificate
- /usr/share/doc/apache-mod_auth_certificate/README
- config
Apache ssl to require client certificate
- /etc/httpd/conf/httpd.conf:
-
- LoadModule
auth_certificate_module
/usr/lib/apache-extramodules/mod_auth_certificate.so
<Directory
"/var/www/html/protegit_c">
CertAuthEnabled on
AuthType Cert
AuthName "Zona protegida
(cert)"
Require valid-user
</Directory>
- Problems
-
- 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:
-
- Configuració del servidor Apache / Apache server
configuration:
- Install mod_auth_basic, mod_auth_digest
(mod_auth_cert?)
-
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
|
|
|
- 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) ():
-
nginx_version=1.16.1
wget http://nginx.org/download/nginx-${nginx_version}.tar.gz
tar xvzf nginx-${nginx_version}.tar.gz
cd nginx-${nginx_version}
- 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
./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"
make
su; make install
- Problemes / Problems
ngx_rtmp_eval.c:160:17: error: this statement
may fall through [-Werror=implicit-fallthrough=]
- 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
-
- 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
-
|
|
- Instal·lació / Installation
-
- Mageia
-
urpmi memcached
systemctl start memcached@11211
- CentOS
-
- 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>
|
|
Squid (HTTP Proxy)
|
- Info
- Server
- Install
- 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'
|
|
- 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:
-
- Obriu el fitxer .doc i feu "Exporta
com a PDF".
- Per a generar vistes prèvies i hiperenllaços: extendedPDF
- Des de MS Word:
-
- 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).
- Obriu el fitxer amb MS Word.
- 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.
- Des de l'explorador de Windows (o similar) canvieu el nom
de fitxer de toto.prn a toto.ps
- Feu la conversió de Postscript
a
PDF.
- Des de MS Word:
-
|
Conversió de Postscript a PDF
|
- UNIX
- ps2pdf
toto.ps toto.pdf
- MS Windows
- 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])
- 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:
-
- 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ó
-
|
|
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
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);
|
|
- Install RPM:
-
- urpmi kernel-desktop-devel
- Launch config:
-
- /usr/bin/vmware-config.pl
- Resize virtual disk size
-
- vmplayer
- select virtual machine -> Settings -> Utilities
-> Expand disk
- start guest OS (eg Mandriva) in safe mode
- #drakdisk -> resize partition
- reboot
- Resize virtual
disk file (6GB -> 8GB) (NOTA:
les noves versions de vmplayer ja permet el redimensionament
dels discos):
-
- Install needed software
urpmi qemu
urpmi dkms-kqemu (plf) (needed to
activate -kernel-kqemu option)
- resize disk from several parts (option 1, recommended):
-
qemu-img convert
WindowsXP-s001.vmdk -O raw WindowsXP-s001.raw
qemu-img convert
WindowsXP-s002.vmdk -O raw WindowsXP-s002.raw
- qemu-img convert
WindowsXP-s003.vmdk -O raw
WindowsXP-s003.raw
- qemu-img convert
WindowsXP-s004.vmdk -O raw
WindowsXP-s004.raw
- cat
WindowsXP-s001.raw WindowsXP-s002.raw
WindowsXP-s003.raw WindowsXP-s004.raw
>
WindowsXP_8G.raw
dd bs=1 if=/dev/zero of=WindowsXP_8G.raw seek=8G
count=0
qemu-img convert WindowsXP_8G.raw -O vmdk
WindowsXP_8G.vmdk
- resize disk from several parts (option 2):
-
qemu-img convert WindowsXP-s004.vmdk -O raw
WindowsXP-s004.raw
dd bs=1 if=/dev/zero of=WindowsXP-s004.raw
seek=2G count=0
qemu-img convert WindowsXP-s004.raw -O vmdk
WindowsXP-s004.vmdk
- edit WindowsXP-s004.vmdk:
-
RW 6144 SPARSE "WindowsXP-s004.vmdk"
-> RW 4192256 SPARSE "WindowsXP-s004.vmdk"
- resize disk from one part
qemu-img convert WindowsXP_6GB.vmdk -O raw
WindowsXP_8GB.raw
dd bs=1 if=/dev/zero of=WindowsXP_8GB.raw
seek=8G count=0
qemu-img convert WindowsXP_8GB.raw -O vmdk
WindowsXP_8GB.vmdk
- resize partition with Gparted-LiveCD
(select "force Vesa"):
-
- (
modprobe kqemu )
qemu -kernel-kqemu [-no-kvm] -m 512 -k es -cdrom
gparted-livecd-xxx.iso
-boot d -hda WindowsXP_8G.vmdk
cp WindowsXP.vmx WindowsXP_8G.vmx and edit
it:
-
ide0:0.fileName = "WindowsXP_8G.vmdk"
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
-
-
smbpasswd -a nom_usuari
(nom_usuari
must exist as a UNIX
user)
/etc/samba/smb.conf :
-
load printers = no
[dir_compartit]
browseable = yes
read only = no
comment = Directori compartit
path = /var/export
directory mask =
0744
force create mode = 0660
force directory mode = 0770
- disable printers
(*)
-
load printers = no
(this alone isn't enough)
show add printer wizard = no
printing = none
printcap name = /dev/null
disable spoolss = yes
testparm; service smb restart
- Obrir tallafoc / Open firewall
- Usuaris / Users (
urpmi
tdb-utils )
-
tdbdump /etc/samba/passdb.tdb | grep USER
tdbbackup /etc/samba/passdb.tdb
- Gestió d'usuaris /
User management
-
- Solucions a problemes
/ Problem solutions
-
chcon -R -t samba_share_t /home
- Error -43 when accessing from OSX:
-
- 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:
-
- 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
-
-
- unexport (-u) all (-a) export points
-
- 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
- smbclient
- info
- list
smbclient -L 192.168.1.1 -U ' % '
- connect
smbclient \\\\192.168.1.1\\samba -U
' % '
- ...
- GUI
konqueror/dolphin: smb://usuari_remot@server/dir
- if local computer is using UTF8:
-
... iocharset=utf8,credentials=...
- Explora / Browse
-
findsmb
- Instal·lació / Installation
nmblookup domain_name
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
- 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:
-
- creeu els grups amb el mateix GID que al servidor:
# groupadd -g 8001 grup_secundari_1
# groupadd -g 8002 grup_secundari_2
...
- assigneu a l'usuari aquests grups secundaris:
# usermod -a -G grup_secundari_1
grup_secundari_2 nom_usuari
- (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:
-
- 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:
-
- 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
|
- Comparteix la carpeta / Share the folder
- 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
|
|
- Configuració / Settings
-
- 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*)
-
- Camí / Path
-
- Per omissió / Default
-
- Afegir / Add: Eines -> Opcions -> OpenOffice.org
-> Paths -> Plantilles:
-
- Working
with
templates (ooimpress)
- OpenOffice
Templates (repository)
- Creació / Creation
-
- Utilització / Usage
-
- Using
a
template to create a document
Fitxer -> Nou -> Plantilles i documents
- La plantilla utilitzada es mostra a Fitxer ->
Propietats
- Si es modifica la plantilla original, quan es torni a
obrir el document creat amb ella, l'aplicació preguntarà
si volem tornar-li a aplicar la nova plantilla. Si diem
que no, es perd tot el lligam amb la plantilla original!
(Issue 52783)
- Gestió / Management
-
Fitxer -> Plantilles -> Organitza
- Edició / Edition
-
- Associating
a
document with a different template
-
- Method 2: Template
Changer (requires
urpmi
openoffice.org-java-common) (based on Issue 52783)
-
- oowriter:
-
- Assign template (current document)
- Assign template (folder)
- ooimpresss:
-
- 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:
- 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
- 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...
- 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
-
- 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
-
- 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.
|
|
|
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
-
- 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:
-
- Compilació / Compilation
-
- Passos / steps
-
- 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
make
sudo make install
- 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)
-
- 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
|
|
- Linux compilation
-
-
- 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):
-
cd ~/src/libav-9.8/
- if you want aac
encoding:
-
make install-libs
- 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
- 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:
- gpac / gpac
(GitHub)
git clone [-b master] [--depth 1]
https://github.com/gpac/gpac.git
- gpac
tar or CVS
- SVN
-
- first time:
-
- next times:
-
- head (latest):
-
- specific revision (e.g. r5382):
-
- patch some
Makefile files:
-
- gpac/applications/{mp4client,mp4box,mp4ts}/Makefile:
-
...
$(LINKLIBS)
$(JS_LIBS)
- 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'
-
- 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:
-
- make sure that extra_lib is not refrenced by
configure:
-
- 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:
-
- 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'
-
undefined reference to JS_ClearNewbornRoots
-
- solved in rev
3646
- solution: check that "ldd libgpac.so" points
to the correct libmozjs.so (libxulrunner-x.y.z)
-
- solution: disable js support
-
- 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
-
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:
-
- 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:
-
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:
-
- 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
-
- 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 :
-
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
-
- 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
cd /c/.../gpac_extra_libs/lib
- 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
- compile the rest of gpac_extra_libs with MS Visual:
- Open build\msvc6\BuildAll.dsw
- compile gpac with MSVisual 6.0
-
- Open gpac\build\msvc6\gpac.dsw
- set gpac_dll as active (StartUp) project
- 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
-
- Be sure you have VS2005 and WM
5.0
Developer Resource Kit installed
- From the VS2005 open the solution file for WM5
located at: <download folder>\build\wm5\wm5.sln
- Select the correct solution configuration and platform
(Debug/Release and Windows Mobile 5.0 Pocket PC SDK
(ARMV4I)
- Connect you device using the USB cable and verify that you
can communicate with it (Explore from the ActiveSync)
- Compile and deploy as usual
|
|
- 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
-
- Problems
-
- error:
‘UINT64_C’
was not declared in this scope
-
- 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
-
- 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
|
|
- Get the source (choose one of the following methods)
-
- tarball
- subversion
-
- mkdir ~/src; cd ~/src/
- First time
-
- Next times
-
- Prerequisites
-
- Compile
-
- 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
|
- Install eclipse
- Download ref_software_2007-01-26.zip (w8869) from MPEG site
(access needed)
mv LASeRCodec1206 LASeRJPlayer1206 ~/workspace
- Download and install Sun's J2ME
Wireless Toolkit (WTK)
- 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.
- 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)
- 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
- Change the build settings as following. Right click on the
project, Properties, Java Build Path, Order and Export - check
library.jar.
- 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)
- 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.
- For executing / debugging, right click on
iso.mpeg.streamezzo.player.tool.LASeRPlayer, Run as / Debug as
Emulated J2ME Midlet
|
|
- 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...
-
- 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...
-
- player usage
-
- GPAC with OpenSVC
|
|
- Modules:
-
- DownConvertStatic
- H264AVCEncoderLibTestStatic
- H264AVCDecoderLibTestStatic
- AvcRewriter
- BitStreamExtractorStatic
- QualityLevelAssignerStatic
- MCTFPreProcessor
- PSNRStatic
- FixedQPEncoderStatic
- SIPAnalyser
- YUVCompareStatic
- Compilació / Compilation
-
- dependencies
- get
the
code
-
- GitHub
-
- 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):
-
- MGS quality (Q):
-
- Temporal (T)
-
- 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):
-
|
Flameproject
|
|
|
- Per a afegir un camí amb biblioteques compartides / To add a
path which contains shared libraries:
-
- edit
/etc/ld.so.conf
ldconfig
|
|
|
|
- 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
-
- 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:
-
|
Logitech Harmony
|
- concordance
-
- Harmony
700
-
- 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
- http://members.harmonyremote.com/
(it will call Congruity)
|
|
|
|
|
|
- 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
-
- or use Gnome instead of Plasma
- Dropbox
Not
Syncing On Ubuntu Linux
-
- Solution:
-
- kill the dropbox process
dropbox start
- Website host
-
|
|
- Grive
-
- Installation
[Grive]
-
- Dependències / Dependencies
-
- urpmi cmake lib64json-devel
- yajl
-
- git clone git://github.com/lloyd/yajl yajl
- cd yajl
- ./configure
- cmake .
- make
- su; make install
- grive
-
- git clone https://github.com/Grive/grive.git
- cd grive
- cmake .
- make
- su; make install
- Usage
-
|
|
urpmi mediatomb
- /etc/mediatomb.conf
-
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
-
|
|
- Examples
-
- Download
-
- Compile
-
./configure
make
make install
- Test
-
- Extras
-
- WebKit
-
- Download
-
- Compile
-
urpmi bison flex gperf libjpeg-deve-
libpng-devel libglib2.0-devel libicu-devel
libenchant-devel libgail-devel libsoup-2.4-devel
libxslt-devel libgstreamer0.10-devel
libgstreamer-plugins-base0.10-devel
./autogen.sh
./configure
make
|
|
- 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:
-
- load it from ~/.emacs
-
- 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
-
- newline in replace:
-
- Inverted colours (reverse video):
-
- 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:
-
- Índex a partir d'una cerca:
-
- HTML
tags
- cerca el tag de tancament a partir del tag d'obertura /
search corresponding ending tag
- cerca el tag d'obertura a partir del tag de tancament /
search corresponding opening tag
- elimina el tag / remove tag
- .emacs:
-
- disable bell
-
- 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:
-
- 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)
- conflictes / conflicts (text
diff)
-
- envoltar un text seleccionat
-
- wrap-region.el
-
- dependencies
-
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
-
- 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 default-tab-width 4);
(setq-default indent-tabs-mode t);
- tabs -> spaces
-
- spaces -> tabs
-
|
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
-
|
|
- urpmi php-curl php-mbstring php-mcrypt php-mysqli php-sqlite3
php-pdo_mysql php-pdo_sqlite openoffice.org-pyuno
- Download the latest version
- untar it
- /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>
- Open http://localhost/eyeOS/install
|
LDAP (Lightweight Directory Access Protocol)
|
- Info
-
- Servidor / Server
-
- OpenLDAP
-
- slapd (server)
- modes
-
- slapd-config: OLC (on-line configuration)
-
- slapd.conf (deprecated)
-
- based on /etc/openldap/slapd.conf
- install
-
- config:
-
- OpenLDAP
Software
2.4 Administrator's Guide (openldap.org)
-
- OpenLDAP
server (Ubuntu)
-
- User and group management
-
- sudo apt-get install ldapscripts
-
- ldapadduser
- ldapsetpasswd
- ldapdeleteuser
- ldapaddusertogroup
- ldapdeleteuserfromgroup
- ldapmodifyuser
- Configure
LDAP
server (CentOS)
- LDAP
(OpenLDAP):
instalación y configuración (I)
- schema
-
- /usr/share/openldap/schema/
- passos / steps:
-
- slappasswd
- /etc/openldap/slapd.conf
rootpw {SSHA}xxxx
suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"
- logs
- /etc/openldap/slapd.conf
-
- /etc/syslog.conf
-
- local4.* /var/log/ldap.log
- service rsyslog restart
- service ldap restart
- migració dels usuaris de sistema
- configuració del sistema perquè comprovi les
contrasenyes des de fitxer i des d'ldap
- urpmi nss_ldap
- /etc/nsswitch.conf
-
passwd: files
ldap
shadow: files ldap
group: files ldap
- /etc/ldap.conf (base must match what is
defined in server: /etc/openldap/slapd.conf)
-
host 127.0.0.1
base dc=example,dc=com
- /etc/ldap.secret
-
- comprovació que la migració s'ha fet bé:
la resposta a aquesta ordre hauria de donar
dues línies idèntiques:
-
# getent passwd | grep
nom_usuari
- comproveu
l'accés
des del client / check access from clients
- ...
- 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
-
- 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
|
|
- 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
|
|
|
|
|
- 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
-
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
-
- /etc/init.d/mmc-agent start
- If you get a "failed", try with debugging:
-
- 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
-
|
|
-
- 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
-
- Info
-
- Debian Lenny (Pulse2 1.3.0)
-
- Steps
-
- ...
- Installation from source (README,
INSTALL)
-
- Info
-
- Compilation and installation
-
wget pulse2-1.3.1.1.tar.gz
tar xvzf pulse2-1.3.1.1.tar.gz; cd
pulse2-1.3.1.1
./configure --disable-nsis --prefix=/usr
--sysconfdir=/etc --localstatedir=/var
make
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
-
|
|
- MCLv3
-
- MAD-FLUTE compilation
-
- wget ...
- urpmi libcurl-devel
- ...
|
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 35 490
(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
|
|
- 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
|
- Obteniu els diccionaris (de català:
ispell-ca, Softcatalà)
- 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)
- 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:
- netscape-communicator
- (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:
CTRL+ALT+F1 per anar a una sessió de text.
- Mogueu el ratolí i veureu el cursor (quadrat blanc) que
belluga.
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
|
|
- 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:
-
- 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
|
|
- servidor
(
maquina )
-
urpmi subversion-server subversion-tools
chown svn.svn -R /var/lib/svn/repositories
(n'hi ha prou amb?: chgrp svn -R /var/lib/svn/repositories )
- sticky group
(els nous rpositoris es crearan amb el grup svn / new
repositories will be created with svn group):
-
chmod 2775 /var/lib/svn/repositories
- svnpserver (
urpmi subversion-server ):
-
- (
urpmi xinetd )
- /etc/xinetd.d/svnserve:
-
server_args = -i -r
/var/lib/svn/repositories (-i: inetd; -r:
repositories as root dir)
chkconfig svnserve on
service xinetd restart
- tallafocs / firewall:
-
- Creation of alias
to be sure that the directories are created with the right umask (Step
6)
- Creació d'un
repositori / Creation
of a repository (Step
8)
-
- cd
/var/lib/svn/repositories
[umask 002]
svnadmin create repo1 (or:
svnadmin create /var/lib/svn/repositories/repo1 )
[chmod -R 770 repo1] (only needed if umask was not used)
chmod g+t repo1/db
- if you want to have a differentiated group for each
repository:
-
- chgrp -R REPO1_USERS_GROUP_NAME repo1
- add users to REPO1_USERS_GROUP_NAME:
- Autenticació / Authentication
-
- option 1: per repository username / clear password (Built-in
Authentication
and Authorization)
-
/var/lib/svn/repositories/repo1/conf/svnserve.conf
-
- password-db = passwd_file
- realm = etiqueta_reialme
/var/lib/svn/repositories/repo1/conf/passwd_file
-
- usuari1 = contrasenya_usuari1
- usuari2 = ...
- to deny anonymous read access:
-
- option 2: SASL
-
- option 3: svn+ssh
-
- access from client
- Per a importar un fitxer dump
(creat a partir de cvs2svn
o bé des de svnadmin dump) (si s'ha fet des de client, s'ha
d'importar des de client):
-
- Info
-
svnadmin create repo3
svnadmin
load
repo3 < toto.dump
chown svn.svn -R repo3
- Per a afegir només el modul_1 que hi ha dins del dump:
-
- cat toto.dump | svndumpfilter3 modul_1 >
modul_1.dump
- svnadmin load repo3 < modul_1.dump
- Problemes:
-
File not found: transaction '...' ...
- Solutions:
-
- 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
-
- Estat remot / Remote status
-
- Actualització / 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
-
- Dóna un conflicte
per resolt / Mark a conflict as resolved
-
- 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:
-
- des de fitxer / from file:
-
- Unset
-
- Get properties
-
svn proplist
svn propget svn:ignore
- List of properties
-
- Eclipse
-
- Remote dump:
-
- svnrdump
(v>=1.7)
-
- 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.
|
|
- Instal·lació / Installation
-
- CentOS
-
- from official repository: v1.8.3.1
- if you need a newer version (e.g. for Weblate), get it from Ghettoforge:
-
sudo yum install -y
http://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el7.noarch.rpm
sudo yum install -y --enablerepo=gf-plus git
- Git documentation
-
- Tutorial
-
- A
successful Git branching model
- Workflow
-
- Continuous integration
-
- Commit messages
-
- Altres usos / Other usages
-
- Services
-
- Configuració / Configuration
-
- 1.5
Getting
Started - First-Time Git Setup
git config --list [--show-origin]
- to setup global config file (
~/.gitconfig )
-
git config --global user.email user@example.org
git config --global user.name "My Complete Name"
- to setup per-project config file (
/path/to/project/.git/config )
-
git config user.email user@example.org
git config user.name "My Complete
Name"
- 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):
-
- 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 chmod 660
{} +
- 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
- 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)
-
- all (HEAD is yellow circle)
-
- history of all modifications for a specific file (See
changes
to a specific file using git):
-
- simplificat / simplified
-
gitk --simplify-by-decoration --all
- info
-
git status
-
- do not show untracked files:
-
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 ls-files
- list ignored files or dirs:
-
git -C <path_to_local_repo_dir>
ls-files --exclude-standard -oi --directory
- list only untracked 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:
-
- add selected modified files to stage:
- commit files that are on stage:
git commit
-m "comentari"
- option 2:
-
- 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:
-
- 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:
- pull (=
git fetch + git merge FETCH_HEAD )
the remote changes to local repository:
-
git pull origin
master
- git pull
<remote_name> <branch>
- Problemes / Problems
- Your
configuration specifies to merge with the ref
'refs/heads/mybranch'
from the remote, but no such ref was fetched.
- 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
-
"insufficient permission for adding an object to
repository database"
-
- 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
-
- repository
-
- exemples / examples:
-
- 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:
-
- 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>
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
-
- list all available (local and remote) branches
-
- 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:
-
- 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:
-
- 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:
- delete the upstream:
- 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
-
- merge master into your branch
-
git checkout <branch_name>
git merge --no-ff master
- Abort 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?)
git merge --no-commit --no-ff
<branch_name>
git status -uno
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
- 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 push origin nom_tag
- etiqueta un commit anterior / tag a previous commit:
-
git log --pretty=oneline
-
git tag -a v1.2 9fceb02
- llista d'etiquetes / list of tags:
-
- detalls sobre una etiqueta / details about a tag
-
- puja a origin
-
- una etiqueta
-
- totes les etiquetes
-
- 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:
-
- 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:
git checkout branch_with_hotfix
git log --pretty=oneline
note the commit_id of the commit you want to
apply to preproduction branch
git checkout preproduction
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
- 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:
-
- 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:
-
- 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 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
-
- 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
- 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
- post-import cleanup (for branches and tags)
- Add a remote server:
git remote add origin
your_login_name@remote_git_server:/path/to/project_name.git
- On
the remote server, create the repository
- from your local computer push to it:
|
|
- Instal·lació / Installation
- Dependències / Dependencies
- 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
|
- plan to iCalendar
-
plan2vcs
dayplan dayplan.vcs
recode
l1..utf-8 dayplan.vcs , to convert from Latin-1
(plan) to utf-8 (kde). (based on KDE
Unicode
How-to)
- open dayplan.vcs with Korganizer and export it as
iCalendar: dayplan.ics
- Google calendar synchronisation
-
|
apropos
|
|
|
gcf = figure( 'Position', [0 0 mida_x
mida_y] );
...
axis( [0 255 0 Inf] );
set( gcf, 'PaperPositionMode', 'auto' );
print( '-r72', '-dtiff', 'toto.tif' );
|
|
- 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
- Estàndards per a la notació del temps / Standards for time
notation
-
|
|
- Info
-
- Instal·lació desatesa / Batch installation:
-
- Re:
cygwin installation batch file?
- only download (no installation):
-
setup.exe
--download
--quite-mode --root c:\cygwin --local-package-dir
c:\tmp --site ftp://ftp.rediris.es/mirror/cygwin
- basic installation from scratch
-
setup.exe
--quite-mode --root c:\cygwin --local-package-dir
c:\tmp --site ftp://ftp.rediris.es/mirror/cygwin
[--no-shortcuts --no-desktop]
- personalised installation from scratch
-
setup.exe --quite-mode --root c:\cygwin
--local-package-dir c:\tmp --site
ftp://ftp.rediris.es/mirror/cygwin --packages
package1,package2
- add some packages (not previously downloaded to c:\tmp)
-
setup.exe --quite-mode [--root c:\cygwin
--local-package-dir c:\tmp --site
ftp://ftp.rediris.es/mirror/cygwin] --packages
package1,package2
- Usuaris i grups / Users and groups
-
mkpasswd -d DOMINI | grep
nom_usuari >> /etc/passwd
mkgroup -d DOMINI | grep
grup_usuari >> /etc/group
- Paquets / Packages
-
cygcheck [-f -l -c]
- Mirrors
-
- Utilitats / Utils
-
- Compilation without cygwin.dll (or use MinGW
instead):
-
- Access from DOS terminal
-
- Serveis / Services
-
cygrunsrv
-
-L : list
-S service_name :
register service_name
-R service_name :
unregister service_name
-Q service_name :
query status for service_name
- Drivers
-
|
|
- Instal·lació / Installation
-
- 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
-
- 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:
-
- 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:
-
- 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 username password
$ 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:
-
- seguretat
/ security
- usuaris / users
-
- accessible des de fora / accessible from outside
-
- relayed (local Postfix acts as a client:
smtp_... )
-
- What
delivery
method: direct or indirect
- Postfix
relayhost
- Configuring
SASL
authentication in the Postfix SMTP/LMTP client
- passos / steps
-
- remote smtp credentials
- /etc/postfix/sasl_passwd
smtp.example.org
remote_smtp_user:contrasenya
chown root:root
/etc/postfix/sasl_passwd; chmod 600
/etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd
- if smtp user (e.g. remote_smtp_user) is different
from local user (e.g. apache), masquerading is
needed:
- info
-
- passos / steps
-
-
/etc/postfix/generic
postmap /etc/postfix/generic
-
/etc/postfix/main.cf
mydomain = example.org
myorigin = $mydomain
relayhost
= [smtp.example.org]
smtp_sasl_auth_enable
= yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_generic_maps = hash:/etc/postfix/generic
# for a detailed (+1) debug only for specified
(debug_peer_list) peers:
debug_peer_level = 1
debug_peer_list = smtp.example.org
- Debug
-
telnet
localhost 25
-
mailq
/var/log/maillog
- Client
|
Dovecot (servidor IMAP)
|
|
|
- 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
-
- Ubuntu
-
- 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:
-
mysql_secure_installation
- 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:
-
- Use mysql-workbench
- Use mysql-administrator
- $ 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"
-
- 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):
-
-
- 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:
-
- 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
-
|
|
- 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
-
- 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:
-
|
|
- 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:
-
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' }
|