Utilitats i trucs
Seccions d'aquesta pàgina 99
- 01MS Windows 2000/NT i Linux
- 02Resin
- 03Resin i Apache
- 04Resin i MS Internet Information Server
- 05Apache
- OpenSSL
- 06Nginx
- 07Memcached
- 08XAMPP
- 09Tomcat
- Django
- 10Squid (HTTP Proxy )
- 11DOS-UNIX
- 12Canvi de nom
- 13Conversió de MS-Word a PDF
- 14Conversió de Postscript a PDF
- 15Múltiple pàgina en PostScript
- 16PDF
- 17X-face
- 18Registre MS Windows
- 19Xerces
- 20VMWare / QEmu
- 21NFS/ Samba
- 22Compartició de carpetes en MS Windows / MS Windows sharing folders
- 23Open Office / Libre Office
- 24Google Docs
- 25Flameproject
- Biblioteques compartides / Shared libraries
- Llengua / Language
- 26Servei / Service
- 27Logitech Harmony
- 28SVG
- 29QR
- 30Dropbox
- 31Google Drive
- 32Media Tomb ( UPnP server)
- 33DirectFB
- 34Emacs
- 35Fitxers de text / Text files
- 36eyeOS
- 37LDAP (Lightweight Directory Access Protocol)
- 38MMC Mandriva Management Console
- 39Pulse2
- 40FLUTE
- 41DSM-CC
- 42dvbsnoop
- 43Diccionaris per a Netscape
- 44Diccionaris per a ispell
- 45Internacionalització de Netscape
- 46Diccionari català per a MS Word
- 47Defunció del ratolí en Linux
- 48Ratolí estrany en MSWindows 2000 sota VMWare
- 49CVS
- 50WinCVS -> LinCVS
- 51Subversion
- 52Git
- 53Grafana
- 54Calendaris / Calendars
- 55apropos
- 56Matlab
- 57C / C++
- 58Cygwin
- 59Postfix ( servidor de correu / email server )
- 60Dovecot (servidor IMAP)
- 61MySQL / MariaDB
- 62Bugzilla
- 63Scmbug
- 64Eclipse
- 65Inno Setup
- 66NTP (Network Time Protocol)
- 67UUID
- 68Microsoft IIS (Internet Information Server)
- 69MS Visual Web Services
- 70Toggle keybord layout in MS Windows
- 71KDE
- 72Escriptori remot / Remote dektop
- 73rsync
- 74ImageMagick
- 75HTML parsing
- 76Expresions regulars / Regular expressions
- 77Substitució / Replacement
- 78Base64
- 79Tasques / Tasks
- 80Data / Date
- 81Telnet
- 82OpenSSH
- 83Logs
- Synology ( NAS )
- 84Iomega NAS
- 85Xiaomi Band
- 86TimeTracker
- 87Kimai
- 88Weblate
- 89DNS server
- 90VPN
- 91DHCP
- 92PXE
- 93gPXE
- 94iPXE
- 95VTigerCRM
- 96WebDAV
- 97Wiki (mediawiki)
- 98Wordpress
- 99Zotero
01MS Windows 2000/NT i Linux#
- 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 ac:\bootsec.lindes de MSWindows. - Des de Windows 2000: afegir al fitxer
c:\boot.inila 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.
02Resin#
- 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
- csh: en el fitxer .cshrc
03Resin i Apache#
- ./configure --with-apache-libexec=/usr/lib/apache --with-apache-include=/usr/include/apache --with-apache-conf=/etc/httpd/conf/httpd.conf
04Resin i MS Internet Information Server#
resin.conf
una configuració d'aquest tipus no funciona:
<http-server>
<http-port>8888<http-port/>
<app-dir>doc<app-dir/>
<http-server/>
<http-server port='8888' app-dir='doc'/>
05Apache#
- Installation
-
- Mageia 2
-
urpmi apache
- CentOS
-
yum install httpd mod_ssl mod_wsgi- SELinux on HTTP servers
- Ubuntu
-
sudo apt-get install apache2
- Versions
-
- 2.4
-
- Upgrading to 2.4 from 2.2
-
- "
Require all granted" "Order deny,allow", "Allow from all"
- "
- 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\
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Estructura de directoris de configuració / Configuration
directory structure
Apache 2.2
Apache 2.4
Mageia 1, 2
Debian / Ubuntu
Mageia 3, 4
CentOS
Debian / Ubuntu general
/etc/httpd/ conf/
- httpd.conf
- magic
- mime.types
/etc/apache2/
- apache2.conf
- magic
- ports.conf
- envvars
/etc/httpd/
conf/
- httpd.conf
-
- # Include sites configuration
Include conf/sites.d/*.conf
- # Include sites configuration
- magic
/etc/httpd/
- conf/
-
- httpd.conf
- magic
/etc/apache2/ - apache2.conf
- magic
- ports.conf
- envvars
virtual hosts
- vhosts.d/
-
- 00_default_vhosts.conf
- 00_default_ssl_vhost.conf
- sites-available/
-
- default
- default-ssl
- sites-enabled/
-
- 000-default -> ../sites-available/default
- vhosts.d -> sites.d
- webapps.d -> sites.d
- sites.d/
-
- 00_default_vhosts.conf
- 00_default_ssl_vhost.conf
- ...
- bugzilla.conf
- mediawiki.conf
a2ensite / a2dissite
- sites-available/
-
- default
- default-ssl
- sites-enabled/
-
- 000-default -> ../sites-available/default
webapps
- webapps.d/
-
- bugzilla.conf
- mediawiki.conf
- phpmyadmin.conf
- timetracker.conf
- your_app.conf
- ...
- conf.d/
-
- mediawiki.conf
- mediawiki.conf -> /etc/mediawiki/apache.conf
- phpmyadmin.conf -> ../../phpmyadmin/apache.conf
- your_app.conf
- ...
- charset
- localized-error-pages
- other-vhosts-access-log
- security
- conf-available/
-
- mediawiki.conf
- mediawiki.conf -> /etc/mediawiki/apache.conf
- phpmyadmin.conf -> ../../phpmyadmin/apache.conf
- your_app.conf
- ...
- charset
- localized-error-pages
- other-vhosts-access-log
- security
- conf-enabled/
-
- ... -> ../conf-available/...
- conf.d/
- conf.d/
-
- autoindex.conf
- info.conf
- languages.conf
- mpm.conf
- multilang-errordoc.conf
- security.conf
- ssl.conf
- conf.d/
-
- autoindex.conf
- ssl.conf
- userdir.conf
- welcome.conf
modules
- modules.d/
-
- 40_mod_ssl.conf
- 70_mod_php.conf
- 75_mod_perl.conf
- mods-available/
-
- actions.conf
- actions.load
- ...
- mods-enabled/
-
- ...
- modules.d/
-
- 00_base.conf
- 00_mod_lua.conf
- 00_mod_ssl.conf
- 00_mod_systemd.conf
- 00_mpm.conf
- 00_mod_cgi.conf
- conf.modules.d/
-
- 00-base.conf
- 00-dav.conf
- 00-lua.conf
- 00-mpm.conf
- 00-proxy.conf
- 00-ssl.conf
- 00-systemd.conf
- 01-cgi.conf
a2enmod / a2dismod
- mods-available/
-
- actions.conf
- actions.load
- ...
- mods-enabled/
-
- ...
- extramodules -> ../../usr/lib/apache-extramodules/
- lib -> ../../usr/lib/
- logs -> ../../var/log/httpd/
- modules -> ../../usr/lib/apache/
-
- mod_*.so
- logs -> ../../var/log/httpd/
- modules -> ../../usr/lib64/httpd/modules/
-
- mod_*.so
- run -> ../../run/httpd/
- logs -> ../../var/log/httpd
- modules -> ../../usr/lib64/httpd/modules/
-
- mod_*.so
- run -> /run/httpd
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Utils
-
- a2query
-
- get the Apache version
-
- a2query -v
- a2ensite
- a2dissite
- a2enmod
- a2...
- Configuració / Configuration
-
- Virtual hosts (vhosts.d, sites-available)
-
- /etc/hosts
-
- your_ip_address tva.com
- 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:
-
- http://tva.com/
- 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:
-
- https://tva.com/
- 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-
ServerName your_ip_address- Logs
- Variables d'entorn / Environment variables
- MPM
-
mpm_prefork_module-
- number of childs:
StartServers, MinSpareServers, MaxSpareServers, MaxClients -
- number of requests per child:
MaxRequestsPerChild
- number of requests per child:
- number of childs:
- Rewriting
-
- URL rewriting guide
- When not to use mod_rewrite
-
- Canonical hostnames (example.org -> www.example.org)
- Scripts d'instal·lació / Installation scripts
-
- Script d'instal·lació per a Django / Django installation script
- estructura / structure:
-
webapp_name-
apache_config-
install_apache.shwebapp_name.conf
index.htmljs/css/...
install_apache.sh-
#!/bin/bash
EXPECTED_ARGS=1
if [ $# -ne $EXPECTED_ARGS ]
then
cat <<EOF
Usage: `basename $0` webapp_name
Example: `basename $0` hbbtv
Actions:
- copy webapp_name.conf to apache configuration directory (e.g. /etc/httpd/conf/webapps.d/)
- recursively copy .. (parent directory, except apache_config) to apache directory (e.g. /var/www/webapp_name/)
- change the owner and group of the files and directories to the right ones
The following typical OS are automatically detected:
- Red Hat, CentOS, Mageia, ...
- Debian, Ubuntu, ...
- MAC OSX (MAMP)
EOF
exit 1
fi
webapp_name=$1
webapp_dir=/var/www/${webapp_name}
# Red Hat, CentOS, Mageia, ...
if [ -f /etc/httpd/conf/httpd.conf ]
then
httpd_config=/etc/httpd/conf/httpd.conf
webapp_conf_dir=/etc/httpd/conf/webapps.d/
grup_httpd=`grep "^Group" $httpd_config | awk '{print $2}'`
usuari_httpd=`grep "^User" $httpd_config | awk '{print $2}'`
fi
# MAC OSX
if [ -f /Applications/MAMP/conf/apache/httpd.conf ]
then
httpd_config=/Applications/MAMP/conf/apache/httpd.conf
webapp_conf_dir=/Applications/MAMP/conf/apache/extra
webapp_dir=~/sites/${webapp_name}
fi
# Debian, Ubuntu, ...
if [ -f /etc/apache2/apache2.conf ]
then
httpd_config=/etc/apache2/apache2.conf
webapp_conf_dir=/etc/apache2/conf.d/
usuari_httpd=`awk -F= '/APACHE_RUN_USER/ {print $2}' /etc/apache2/envvars`
grup_httpd=`awk -F= '/APACHE_RUN_GROUP/ {print $2}' /etc/apache2/envvars`
fi
# còpia recursiva de la webapp
echo "copying application $webapp_name to $webapp_dir"
mkdir -p $webapp_dir
rsync -a --exclude='.git' --exclude='apache_config' .. $webapp_dir
chown ${usuari_httpd}.${grup_httpd} -R $webapp_dir
# webapp config
echo "copying config file ${webapp_name}.conf to ${webapp_conf_dir}"
cp ${webapp_name}.conf ${webapp_conf_dir}
- Start server
-
- Serveis / Service
- apachectl / httpd
-
- compiled in modules
-
apachectl -lhttpd -l
- check syntax:
-
apachectl -thttpd -t
- loaded modules
-
apachectl -Mhttpd -M
- Logs
-
- Apache Module mod_log_config
- detailed log in error_log (or name specified by ErrorLog) file:
-
LogLevel debug
- httpd.conf / apache2.conf
-
- errors
-
ErrorLog "logs/error_log"LogLevel debug
- access
-
TransferLog "logs/access_log"# CustomLog with format nickname
LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog "logs/access_log" common# CustomLog with explicit format string
LogFormat "logs/access_log" "%h %l %u %t \"%r\" %>s %b"# real remote ip when using AWS ELB load balancer (%a, %h give ELB ip address)LogFormat"%v %A %{X-FORWARDED-FOR}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" elb-ncsa
CustomLog "logs/access_log" elb-ncsa
- /etc/apache2/conf.d/other-vhosts-access-log
-
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined
cat /etc/httpd/logs/error_loggrep httpd /var/log/messagessystemctl status httpd.servicehttpd -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
- Apareix al navegador com a: «
- 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
-
- Solució / Solution
-
- Apache symbol lookup error apr_os_uuid_get
- steps:
-
yum erase libapr1yum install apr apr-util apr-util-ldap httpd httpd-tools [mod_ssl]
- Change listen ports
-
- Debian
-
- ports.conf
- Mageia
-
- /etc/httpd/conf/httpd.conf
-
Listen 8000 # can be specified in sites.d/toto.conf instead
- /etc/httpd/conf/sites.d/00_default_vhosts.conf
-
Listen 8000
<VirtualHost _default_:8000>
- open firewall
- RedHat / CentOS
-
- SELinux:
semanage
(to avoid error "
could not bind to address 127.0.0.1:12345 no listening sockets available, shutting down") -
semanage port -l | grep -w http_port_tsemanage port -a -t http_port_t -p tcp 12345
- Firewall / tallafoc
- http.conf
-
Listen 12345
- SELinux:
semanage
(to avoid error "
- 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
- Directori
addicional / Additional directory (
/home/user1/other_dirto be accessed ashttp://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/htmlln -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_dirIMPORTANT: 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 groupapache(or whatever group defined inGroupdirective in httpd.conf, or in APACHE_RUN_USER variable)
- Solution
1: symbolic link (no funciona / it does not
work) (caldria
- 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:
-
urpmi apache-mod_ssl
- Autenticació de servidor amb certificat autosignat / Server authentication with self-signed certificate
-
- Mageia:
-
- [cd /etc/httpd/conf/vhosts.d; cp 01_default_ssl_vhost.conf 02_hostname_ssl_vhost.conf]
- canvi de port 443 -> 8443:
-
- httpd.conf (diu quins ports obre per a escoltar)
-
Listen 8443
- 01_default_ssl_vhost.conf (diu a quin dels ports on està escoltant fa referència)
-
<VirtualHost _default_:8443>
- Ubuntu:
-
cd /etc/apache2/sites-enabled; sudo ln -s ../sites-available/default-ssl 001-default-sslcd /etc/apache2/mods-enabled; sudo ln -s ../mods-available/ssl.conf .; sudo ln -s ../mods-available/ssl.load .- canvi de port 443 -> 8443:
-
- ports.conf (diu quins ports obre per a
escoltar)
Listen 8443
- default-ssl (diu a quin dels ports on està
escoltant fa referència)
<VirtualHost _default_:8443>
- ports.conf (diu quins ports obre per a
escoltar)
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.crtmv/etc/pki/tls/newkey.pem/etc/pki/tls/private/tva_server.key
- Configuració del servidor Apache / Apache server
configuration:
- /etc/hosts
-
- your_ip_address hostname
- /etc/httpd/conf/httpd.conf
-
LoadModule ssl_module modules/mod_ssl.so
- cp /etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf /etc/httpd/conf/vhosts.d/02_hostname_ssl_vhost.conf
- /etc/httpd/conf/vhosts.d/02_hostname_ssl_vhost.conf
-
- secure virtual host
- Optional:
DocumentRoot "/var/www/html_segur"
<Directory "/var/www/html_segur">
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory> - If you are using intermediate CA certificates (Install your Certificates on Apache (OpenSSL)):
-
SSLCertificateChainFile/etc/apache2/ssl.crt/server-ca.crt
SSLCertificateFile /etc/pki/tls/certs/hostname_server.crtSSLCertificateKeyFile /etc/pki/tls/private/hostname_server.key
- 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:
-
- https://...
- Si la resposta és sec_error_inadequate_key_usage:
-
- comproveu que al certificat del servidor, a keyUsage hi ha keyEncipherment
- Si sec_error_reused_issuer_and_serial:
-
- Netegeu la memòria cau del navegador / Clean the cache on the browser
- Si sec_error_unknown_issuer:
-
- Descarregueu el certificat de la CA i doneu-li permís per a identificar servidors www: "Confia en aquesta CA per identificar llocs web"
- ssl_error_rx_record_too_long
-
- check /var/log/httpd/ssl_error_log
- 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.crtmv 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
-
- cp ...
- altres / others (e.g. for DNIe)
-
cd /etc/pki/tls/certs/wget http://www.dnielectronico.es/ZIP/ACRAIZ-SHA1.zipunzip 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>
- LoadModule
auth_certificate_module
/usr/lib/apache-extramodules/mod_auth_certificate.so
- Problems
- Configuració de client
/ Client configuration:
- Si el client es connecta amb un navegador / If the clients connects from a web browser:
-
- El client ha d'importar el fitxer .p12 a les preferències del navegador WWW / Client must import the .p12 file into the browser preferences
- es connecta a (vegeu també / see also: PHP):
-
- https://...
- 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:
-
- Authentication, Authorization and Access Control (htaccess,...) / Access Control (Apache 2.2)
- Passos / Steps:
-
- Configuració del servidor Apache / Apache server
configuration:
- Install mod_auth_basic, mod_auth_digest (mod_auth_cert?)
-
- urpmi ...
mkdir /var/www/passwdhtpasswd -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/
- Configuració del servidor Apache / Apache server
configuration:
- Certificate Revocation List (CRL)
-
- Info:
- Passos / Steps:
-
- Creeu una llista de revocació (CRL amb OpenSSL / Create a revocation list (CRL) with OpenSSL
- Configuració del servidor Apache / Apache server
configuration:
- /etc/httpd/conf/vhosts.d/02_hostname_ssl_vhost.conf
-
SSLCARevocationFile /etc/pki/tls/crl/cacrl.pem
- Client:
- es connecta a:
-
- https://...
- i rep un error del tipus ssl_error_revoked_cert_alert
- WebDAV
-
urpmi apache-mod_dav- httpd.conf:
-
Listen 8080(optional)LoadModule dav_module modules/mod_dav.soLoadModule dav_fs_module modules/mod_dav_fs.soLoadModule dav_lock_module modules/mod_dav_lock.soDAVLockDB /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
06Nginx#
- 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_modulelib64xslt-devel
libxslt-devel --with-http_ssl_module
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
- Modules
-
- xslt
- ngx_http_xslt_module
- Exemples / Examples
- nginx-rtmp-module stats
- arguments from queryset
- arguments from url
- Exemples / Examples
- ngx_http_xslt_module
-
- xslt
- Compilació / Compilation (Building nginx from Sources) ():
-
nginx_version=1.26.1- option 1: from tar
wget http://nginx.org/download/nginx-${nginx_version}.tar.gztar xvzf nginx-${nginx_version}.tar.gzcd nginx-${nginx_version}
- option 2: from git
git clone https://github.com/nginx/nginx.gitcd nginxgit checkout release-${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
- kaltura / nginx-vod-module
nginx_vod_module_version=1.33
git clone https://github.com/kaltura/nginx-vod-module.gitgit checkout ${nginx_vod_module_version}
- nginx-upload-module
-
wget -O nginx-upload-module-2.2.tar.gz https://github.com/vkholodkov/nginx-upload-module/archive/2.2.tar.gztar xvzf nginx-upload-module-2.2.tar.gz
- arut
- if you are installing from git:
ln -s auto/configure .
./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"makesu; make install- verify:
nginx -t
- nginx -V
- Problemes / Problems
ngx_rtmp_eval.c:160:17: error: this statement may fall through [-Werror=implicit-fallthrough=]- Error while compiling with nginx 1.15.0 #1283
- Solució / Solution
./configure ... --with-cc-opt="-Wimplicit-fallthrough=0"
- Nginx init scripts
-
- CentOS
-
- Systemd
-
- nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target cloud-init.target
DefaultDependencies=no
[Service]
Type=forking
PIDFile=/run/nginx.pid
TimeoutStartSec=200s
ExecStartPre=/usr/sbin/nginx -t
PrivateTmp=true
# other exectartpre scripts
ExecStartPre=/bin/bash -c 'for script in /etc/nginx/execstartpre.d/*; do $script; done'
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
[Install]
WantedBy=multi-user.target
- save it to:
-
- /usr/lib/systemd/system/nginx.service
- nginx.service
- Ubuntu
- Starting, Stopping, and Restarting Nginx
-
/usr/local/nginx/sbin/nginx- Open port 1935 (?)
- Start
-
/usr/local/nginx/sbin/nginx
- Stop
-
/usr/local/nginx/sbin/nginx -s stop
- Reload config
-
/usr/local/nginx/sbin/nginx -s reload
- Test
-
cd nginx-1.9.2/nginx-rtmp-module/test/- edit nginx.conf
-
- /path/to/
- cp nginx.conf /usr/local/nginx/conf/
/usr/local/nginx/sbin/nginx- publish:
-
./ffstream.sh- with ffmpeg
-
ffmpeg -loglevel verbose -re -i sintel-1024-stereo.mp4 -c copy -f flv rtmp://localhost/myapp/mystream
- play:
-
./play.shffplay -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
07Memcached#
- Instal·lació / Installation
-
- Mageia
-
urpmi memcachedsystemctl start memcached@11211
- CentOS
-
- Installing and configure Memcache on CentOS 7
yum install memcachedsystemctl enable memcachedsystemctl start memcached
- 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:11211memcached-tool 127.0.0.1:11211 statsecho stats | nc localhost 11211
08XAMPP#
- 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>
- ...
09Tomcat#
- Per a instal·lar-lo en MS Windows, falta el fitxer:
-
- msvcr71.dll (*)
- 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>
10Squid (HTTP Proxy )#
- Info
- Server
- Install
- Mageia
urpmi squid
- Mageia
- Setup
- /etc/squid/squid.conf
acl localnet src <client_ip>/32
http_access allow localnet
- /etc/squid/squid.conf
- Start
sudo systemctl start squid.service
- Install
- Client (<client_ip>)
- export http_proxy='http://<server_ip>:3128'
export https_proxy='http://<server_ip>:3128'
export ftp_proxy='http://<server_ip>:3128'
- export http_proxy='http://<server_ip>:3128'
11DOS-UNIX#
- Per a canviar el tipus de fitxer de DOS (amb retorns de carro ^M) a UNIX (retorns de carro senzills): dos2unix
- Noms de fitxer de majúscula a minúscula:
-
#! /bin/csh
foreach f ( * )
mv $f `echo $f | tr '[A-Z]' '[a-z]'`
end#! /bin/bash
for f in *;
do mv $f `echo $f | tr '[A-Z]' '[a-z]'`;
done
12Canvi 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
13Conversió 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:
14Conversió de Postscript a PDF#
15Múltiple pàgina en PostScript#
psnup -2 toto.ps toto.2.ps
16PDF#
- Manipulació
-
- pdftk
-
- Manipulación de ficheros PDF (CRySoL)
- separa en pàgines individuals / split into single pages:
-
pdftk toto.pdf burst
- uneix documents / join documents:
-
pdftk 1.pdf 2.pdf cat output 12.pdf
- afegeix un peu de pàgina / add a footer:
-
pdftk input.pdf multistamp footer.pdf output input_with_footer.pdf
- compilation (Mandriva)
-
urpmi fastjar gcc-java- modify Makefile.Base:
-
... -I$(JAVALIBPATH) -I/usr/include/libgcj-4.4.3 ...
make -f Makefile.RedHat
- PDF-Xchange viewer
- Edició
-
- Inkscape
17X-face#
giftoppm face.gif | ppmtopgm |pgmnorm |pnmscale -xy 48 48 |pgmtopbm > face.pbmpbmmake -white 48 48 |pnmpaste face.pbm 0 0 |pbmtoicon |tail +3 |compface > face.xface- X-face in Mozilla.
- On-line X-face converter
- A bunch of X-Faces
18Registre MS Windows#
Auto login: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\-
AutoAdminLogon REG_SZ 1DefaultUsername REG_SZ usuariDefaultPassword REG_SZ contrasenyaDefaultDomainName REG_SZ
- Auto login gràfic:
control userpasswords2 - Execució a l'inici:
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
19Xerces#
- 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
- To avoid errors of type "
- Ambiguous DOMDocument
-
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentXERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentFragment#define WIN32_LEAN_AND_MEAN // to vaoid using MSxml.h
- DOMWriter
-
- delete of object
LocalFileFormatTargetto close and release the file
- delete of object
- 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:
-
XercesDOMParser *parser = new XercesDOMParser;parser->setLoadExternalDTD(false);
- 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);
20VMWare / QEmu#
- 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 qemuurpmi 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.rawqemu-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.rawWindowsXP-s002.rawWindowsXP-s003.rawWindowsXP-s004.raw > WindowsXP_8G.raw dd bs=1 if=/dev/zero of=WindowsXP_8G.raw seek=8G count=0qemu-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.rawdd bs=1 if=/dev/zero of=WindowsXP-s004.raw seek=2G count=0qemu-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.rawdd bs=1 if=/dev/zero of=WindowsXP_8GB.raw seek=8G count=0qemu-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.vmxand edit it:-
ide0:0.fileName = "WindowsXP_8G.vmdk"
vmplayer WindowsXP_8G.vmx
- Install needed software
- serial device on file.vmx:
-
serial0.present = "TRUE"serial0.fileName = "Auto Detect"serial0.autodetect = "TRUE"serial0.hardwareFlowControl = "TRUE"
- Xarxa / Network
21NFS/ 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 USERtdbbackup /etc/samba/passdb.tdb
- Gestió d'usuaris / User management
-
pdbedit -v nom_usuari- Linux-PAM
- Unix and Samba password sync on Debian Etch
- Unificació dels logins en una xarxa casolana (I) (i II)
- LDAP
-
- Samba & LDAP (SambaWiki)
- Samba and LDAP (Ubuntu)
- Tools:
- Solucions a problemes / Problem solutions
-
chcon -R -t samba_share_t /home
- Error -43 when accessing from OSX:
-
- avoid underscores ('_') in folder names (Odd OS X Samba to Linux issue and workaround)
-
- 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=nfsfirewall-cmd --permanent --add-service=rpc-bindfirewall-cmd --permanent --add-service=mountd
firewall-cmd --reload
- SELinux (in server or in client?)
-
- option 1: booleans
-
getsebool -a | grep -i nfssetsebool -P <someboolean>=1 <someotherbool>=1 ...
- option 2: policy
-
grep rpc.statd /var/log/audit/audit.log | audit2allow -M mypolsemodule -i mypol.pp
- NFSv4
-
systemctl enable rpcbind.service nfs-idmapd.service nfs-server.servicesystemctl 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.servicesystemctl start rpcbind nfs-lock nfs-idmap
- Mageia
-
urpmi nfs-utilsservice nfs-server start- firewall (shorewall) (Réseau Linux avec NFS - Mandriva) (Configuring NFS under Linux for Firewall control)
-
- /etc/sysconfig/nfs-common:
-
- STATD_OPTIONS="--port 4000"
- service nfs-common restart
- /etc/sysconfig/nfs-server:
-
- RPCMOUNTD_OPTIONS="--port 4002"
- service nfs-server restart
- /etc/modprobe.conf:
-
- options lockd nlm_udpport=4001 nlm_tcpport=4001
- reboot computer
- open ports: 111/tcp 111/udp 2049/tcp 2049/udp 4000:4002/tcp 4000:4002/udp
- check port attibution:
-
- rpcinfo -p
- configure idmap
-
- /etc/idmapd.conf
-
[General]
Domain = domain.tld
[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
- configure permissions
-
- /etc/hosts.allow
-
rpcbind: 172.16.11.0/255.255.255.0
- configure export points
-
- /etc/exports
-
/tmp 172.16.11.0/24(no_all_squash,async,secure,no_subtree_check,ro)# NFSv4 (in client: mount -t nfs4 server_address:/var/toto)
/var/toto 172.16.11.0/24(rw,sync)# NFSv4(in client: mount -t nfs4 server_address:/)
/var/toto 172.16.11.0/24(rw,sync,fsid=0)# NFSv4(in client: mount -t nfs4 server_address:/)
# exported dir /mnt/vol1 is itself a mounted drive
/mnt/vol1 172.31.0.0/16(rw,async,mountpoint=/mnt/vol1,fsid=0,no_root_squash)
- Options
-
- 21.6 NFS Server Configuration
- 21.7 The /etc/exports Configuration File
- Optimizing performance: Network File Systems (MythTV)
-
optimized
(suggested by MythTV)
general options ro, rw
read only, read and write
insecure
allow connections from port 1024 and higher
insecure_locks
allow insecure file locking
no_subtree_check
disable subtree checking
sync / async
sync write operations on request
async
no_wdelay
force sync of write operations immediately
nohide
do not hide filesystems beneath
mountpoint[=/mnt/xxx]
export only if mounted
fsid=X
set explicit filesystem ID
tcp / udp
udp
user access
no_root_squash
remove map of root in client to anonymous in server (use carefully)
all_squash
map all users in client to anonymous in server
anonuid
specify uid of the anonymous user in server
anongid
specify gid of the anonymous group in server
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- manage export points
-
- exportfs man page
- list of export points
-
exportfs
- reload (-r) all (-a) exports points
-
exportfs -rav
- unexport (-u) all (-a) export points
-
exportfs -uav
- client SAMBA from Unix (*):
-
urpmi mount-cifs [samba_client]mount -t [cifs,smbfs] //server/dir /mnt/toto -o username=usuari_remot,password=contrasenya_remotamount -t [cifs,smbfs] //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd/home/usuari_local/.smbpasswd-
username=usuari_remotpassword=contrasenya_remota
-
server client mount /etc/fstab CIFS no UNIX ext mount -t cifs //server/dir /mnt/toto -ocredentials=/home/usuari_local/.smbpasswd,
uid=usuari_local,gid=grup_local//server/dir /mnt/toto cifscredentials=/home/usuari_local/.smbpasswd,uid=usuari_local,gid=grup_local0 0UNIX ext mount -t cifs //server/dir /mnt/toto -ocredentials=/home/usuari_local/.smbpasswd//server/dir /mnt/toto cifscredentials=/home/usuari_local/.smbpasswd0 0Samba mount -t smbfs //server/dir /mnt/toto -ocredentials=/home/usuari_local/.smbpasswd,
uid=usuari_local,gid=grup_local,nounix//server/dir /mnt/toto smbfscredentials=/home/usuari_local/.smbpasswd,uid=usuari_local,gid=grup_local,nounix0 0Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- cli
- smbclient
- info
- list
smbclient -L 192.168.1.1 -U ' % '
- connect
smbclient \\\\192.168.1.1\\samba-U ' % '
- ...
- smbclient
- GUI
konqueror/dolphin: smb://usuari_remot@server/dir
- if local computer is using UTF8:
-
... iocharset=utf8,credentials=...
- Explora / Browse
-
findsmb- Instal·lació / Installation
urpmi samba
- Instal·lació / Installation
nmblookup domain_namenmblookup WORKGROUP
smbclient -L192.168.1.100-
- without password:
-
smbclient -L192.168.1.100 -Nsmbclient -L192.168.1.100 -U ' % '
- Exemples / Examples
- 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
- /etc/samba/smb.conf
- a l'ordinador que fa de client:
- Solució / Solution
- 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
- a byte 00 is following any single character:
- ?????????? ? ? ? ? ? directory
-
- Solution:
umount -l /mnt/directory
- Solution:
- check dmesg
- 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
- creeu els grups amb el mateix GID que al servidor:
- client NFS from Unix:
-
- Mageia
-
urpmi nfs-utils-clients- needed?
-
service rpcbind startservice nfs-common start
- Browse:
-
- Dolphin: network NFS
- CentOS
-
sudo yum install nfs-utils
- Configure idmap
-
- /etc/idmapd.conf
-
[General]
Domain = domain.tld
[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
mkdir/mnt/toto- Mount temporarily:
-
mount -t nfs server:/var/toto /mnt/totomount -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
-
- Avoid stuttering streaming from NFS shares with XBMC on the Raspberry Pi
- Optimizing performance: Network File Systems (MythTV)
-
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
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Check real values:
-
cat /proc/mounts
- /etc/fstab (see examples of present mounts at:
- User permissions
-
- create a dir owned by a user with login:
-
sumy_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>
22Compartició 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
23Open Office / Libre Office#
- Configuració / Settings
-
~/.config/libreoffice/
- Línia d'ordres / Command line
- Inici del programari del LibreOffice amb paràmetres
- Conversió d'un dibuix a SVG
/ Conversion of a drawing to SVG:
soffice --headless --convert-to svg:"draw_svg_Export" toto.odg
- Conversió csv (delimiter is
;) -> xlsx
- Convert-to from csv to ods and viceversa
- Filter Options (--infilter)
libreoffice --headless --convert-to xlsx --infilter="CSV:59,34,0,1,,0,false,true,true" toto.csv
- ...
- Tipus de lletres generals / General fonts
-
- Eines -> Opcions -> OpenOffice.org Writer -> Tipus de lletra bàsic
- Plantilles / Templates (.ot*)
-
- Camí / Path
-
- Per omissió / Default
-
- ~/.ooo3/user/template/
- Afegir / Add: Eines -> Opcions -> OpenOffice.org -> Paths -> Plantilles:
-
- .../plantilles/
- Working with templates (ooimpress)
- OpenOffice Templates (repository)
- Creació / Creation
-
- Creating a template
-
- Creating a template from a document
-
- Esborreu totes les transparències que no desitgeu / Remove all unwanted slides
Fitxer -> Plantilles -> Desa
- Creating a template using a wizard
- [Anomena i desa -> Plantilla de document de text ODF (.ott)]
- 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
-
- Modifying a template (ooimpress) (Working with templates)
- Fitxer -> Plantilles -> Edita
- 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:
-
- Assign template (folder)
- Method 2: Template
Changer (requires
- 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
- si voleu modificar puntualment l'estil d'una part
(p.ex. una paraula) podeu fer servir alguna
d'aquestes opcions:
- 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
- (click dret sobre el salt de pàgina) Edita el
salt de pàgina
- Insereix -> Salt de pàgina
- 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
- (click dret sobre el salt de pàgina) Edita el
salt de pàgina
- Insereix -> Salt de pàgina
- 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:
-
- Turning Off AutoCorrect
- Format -> Correcció automàtica -> En teclejar
- Activeu el control de canvis: Edita -> Canvis -> Registra
- L'estructura lògica s'ha de veure reflectida en la visió
de l'estructura del document:
- Edita -> Navegador
- El cos de text ha de tenir l'estil "Cos de text".
- Autofit text (Impress for Linux) equivalent:
-
- Format -> Text -> Fit to frame
- Per a incloure figures (dibuix fet amb Draw):
-
- [creeu un marc]
- Obriu la vostra figura amb el Draw, seleccioneu-la i copieu-la
- Posicioneu-vos al lloc on la voleu enganxar (dins del marc si n'heu creat un)
- Enganxeu la figura
- Per a posar un peu:
-
- [seleccioneu el marc]
- menú contextual: Llegenda...
- Posicionament del marc (marc = imatge+llegenda):
-
- Alineació -> Centrada
- Àncora -> Al paràgraf
- Ajusta -> Sense ajustament (Cap)
- Nota: si la lletra us surt massa grossa, l'haureu de canviar prèviament al Draw.
- Per a incloure figures
(imatge):
- Insereix -> Imatge...
- Si encara no té llegenda, afegiu-la amb el menú contextual: Insereix una llegenda...
- Per a properes ocasions, si voleu que cada vegada que
s'insereixi una imatge es posi automàticament una
llegenda:
- Eines -> Opcions -> OpenOffice.org writer -> Llegenda automàtica -> Imatge de l'OpenOffice Writer -> Categoria: Figura
- Posicionament del marc (marc
= imatge+llegenda) (NO de la imatge) amb el menú
contextual:
- Alinea els objectes -> Centrat
- Àncora -> Al paràgraf
- Ajusta -> Cap
- Referència a una figura:
- Insereix -> Referència creuada
- Tipus: Figura
- Consulteu utilitzant: Categoria i número
- Insereix -> Referència creuada
- 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
- el fitxer EPS a inserir ha d'haver estat normalitzat
amb
- Taules
- Tipus de numeració:
- ...
- Peu automàtic de taules:
- Eines -> Opcions -> OpenOffice.org writer -> Llegenda automàtica -> Taula de l'OpenOffice Writer -> Categoria: Taula
- Tipus de numeració:
- 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]
- Bibliografia (botó dret) Edita l'índex ->
Estils
- Base de dades
- 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/)
- assegureu-vos que és el mateix directori que fa
servir Firefox
- 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»:
- ...
- 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»
- Signa el document...
- Fitxer > Signatures digitals > Signatures
digitals...
- Per a signar un document PDF generat a partir d'un
open document:
- Fitxer > Exporta com a PDF...
- pestanya: Signatures digitals
- Selecciona...
- pestanya: Signatures digitals
- Fitxer > Exporta com a PDF...
- 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
- ...
- Eines ->
Opcions -> LibreOffice -> Seguretat -> Camí
del certificat
- Impress
-
- Pàgines mestres / Master pages
-
- Visualitza -> Mestra -> Elements mestres...: data/hora, peu, número de diapositiva (cal tancar la mestra per a actualitzar)
- Es poden afegir tantes pàgines mestres com calgui (com si fos una presentació normal): títol, contingut,...
- Número de pàgina
-
- A la diapositiva mestre cal que hi aparegui (Elements mestres)
- i, a més, cal activar Visualitza -> Capçalera i peu
- Es poden desactivar també amb si trieu Format - Disseny de la diapositiva i desactiveu la casella de selecció Objectes al fons.
- Esquema / Outline
- Numeració de les capçaleres / Heading numbering
-
- Eines -> Numeració d'esquemes...
- Nom de la diapositiva / Slide name
- Text al voltant d'una imatge (adapta el text a un
polígon) / Wrap text around an image (adapt text to a
polygon)
- creeu el rectangle principal
- creeu el rectangle on posareu la imatge (es menjarà una part del rectangle principal)
- seleccioneu: el rectangle principal, maj + rectangle secundari
- Formes -> Resta
- feu doble clic al polígon principal
- escriviu el text
- seleccioneu tot el text
- menú amb el botó dret: Text...
- Ajusta a la vora
- per a modificar la forma del polígon:
- seleccioneu-lo
- menú botó dret: activeu Punts
- Draw
-
- Text alineat amb els connectors / Text aligned to the connectors:
-
- Adjusting text to suit the connecting line
- Configuració:
-
- Visualitza -> Barres d'eines -> Formatació
de text
- (clic dret sobre la barra d'eines de formatació de text) Personalitza la barra d'eines... -> Categoria: Formata -> Fontwork -> (fletxa cap a la dreta)
Eines -> Personalitza -> Barres d'eines -> Barra d'eines: Dibuix -> Afegeix -> Formata -> Fontwork
- Visualitza -> Barres d'eines -> Formatació
de text
- Ú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
-
- Turn off auto complete in libreoffice or openoffice calc and writer
Eines -> Continguts de la cel·la -> Entrada automàtica
- Amaga i mostra files i columnes
-
Format -> {Fila,Columna,Full} -> {Amaga. Mostra}
- Ordenació alfabètica / Alphabetic sort
-
- Dades -> Ordena
- Text a columnes / Text to column
-
- Convert text to columns in Calc
- Dades -> Text a columnes
- 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
- límit de la pàgina
- Problemes amb Mandriva i KDE/Qt:
- Bugs
-
- Impress 2.1.7
- un cop desada una plantilla, la llista de la diapositiva mestra no s'actualitza (aquesta mestra inactualitzable seguirà així en els documents creats a partir d'aquesta plantilla). Però l'estil, que és el que compta, es modificarà bé i serà el que s'aplica als documents creats a partir d'aquesta plantilla.
- per a tornar a aplicar la mateixa plantilla un cop modificada, cal aplicar una altra plantilla, desar el document, tancar i obrir l'OpenOffice, i aplicar de nou la plantilla que hem modificat.
24Google Docs#
- Autofill
- Votacions / Polls
-
- Google Poll Question (Counting Votes)
-
- =COUNTA( IFERROR( FILTER( 'Sheet1'!B$2:B ; TRIM('Sheet1'!B$2:B)=A2 ) ) )
25Flameproject#
- urpmi libgnome2_0-devel
26Servei / Service#
- UbuntuBootupHowto
- /etc/init.d/toto:
-
#!/bin/sh
#
# Startup script for the toto daemon
#
# chkconfig: 2345 26 59
#
# description: toto daemon
#
### BEGIN INIT INFO
# Provides: toto
# Should-Start: xxxx
# Required-Start: xxx
# Required-Stop: xxx
# Default-Start: 2 3 4 5
# Short-Description: Toto daemon
# Description: Toto daemon
### END INIT INFO
. /etc/init.d/functions
case "$1" in
start)
gprintf "Starting toto daemon: "
daemon "/usr/bin/toto -i 172.16.11.5" -d
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/toto
;;
stop)
gprintf "Shutting down toto daemon: "
killproc toto
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/toto
;;
status)
status toto
RETVAL=$?
;;
restart|reload)
$0 stop
$0 start
;;
condrestart)
[ -f /var/lock/subsys/toto ] && restart || :
;;
*)
gprintf "Usage: %s {start|stop|status|restart}\n" "$0"
RETVAL=1
;;
esac
exit $RETVAL
- ln -s /etc/init.d/toto /etc/rc5.d/S99toto
- service toto start
- Configuració / Setup
-
chkconfig-
chkconfig -list
- install a service:
-
update-rc.d to make all the links from /etc/rc?.d/ to /etc/init.d/toto (start: 90, kill: 10)-
sudo update-rc.d toto defaults 90 10
- uninstall a service:
-
sudo rm /etc/rc*/*toto
27Logitech Harmony#
- concordance
-
- Harmony 700
-
- concordance >= 0.22
- Codi font / Source code
- jaymzh/concordance (GitHub)
- sourceforge (old)
- 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-develcd concordance/libconcord-
autoreconf --install./configuremakemake install
cd concordance/libconcord/bindings/python-
urpmi libpython2.6-develpython setup.py install
cd concordance/concordance-
autoreconf --install./configuremakemake install
- Add
/usr/local/libto the library path
- congruity
(GUI)
- Instal·lació / Installation
- Mageia
- sudo urpmi congruity
- Mageia
- Instal·lació / Installation
- http://members.harmonyremote.com/ (it will call Congruity)
28SVG#
- Include scalable SVG into HTML (Inkscape ViewBox bug, Bug #168261) (feedicons examples):
-
- .svg
-
-
<svg ...
width="..."
height="..."
ViewBox="0 0 200 100">
...
-
- .html (figure scaled to 40x20 pixels)
-
-
<object type="image/svg+xml" data="figure.svg" width="40" height="20">
You cannot display SVG files.
</object>
-
29QR#
- Generació / Generation
- The 5 Best QR Code Generator Apps for Linux
- qrencode
- Instal·lació / Installation
- Mageia
sudo dnf install qrencode
- Mageia
- Ús / Usage
qrencode -t SVG -o fpm_qr.svg http://www.francescpinyol.cat/
- Instal·lació / Installation
30Dropbox#
- Dropbox
- The Unofficial Dropbox wiki
- Linux installation (Dropbox: Painless and Free Backup)
-
- from package
-
- Mageia
-
urpmi nautilus-dropbox(will also installdropboxpackage)
- from code:
-
- Mageia
-
urpmi gcc make lib64nautilus-devel python-docutils
wget https://linux.dropbox.com/packages/nautilus-dropbox-1.6.1.tar.bz2tar xjf nautilus-dropbox-1.6.1.tar.bz2cd 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
dropboxagain and follow the displayed URL to sync your Dropbox account to your PC)
- Problems:
-
- Plasma / KDE5 (e.g. Mageia 6)
-
- "isn't running"
- Solució provisional / Workaround
-
- CTRL + ALT F2 to open a text console
-
$ dropbox start
- or use Gnome instead of Plasma
- Dropbox Not Syncing On Ubuntu Linux
-
- Solution:
-
- kill the dropbox process
dropbox start
- Website host
31Google Drive#
- 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
-
- ...
32Media Tomb ( UPnP server)#
urpmi mediatomb- /etc/mediatomb.conf
-
MT_INTERFACE="eth0"
service mediatomb start- /etc/mediatomb/
-
- config.xml
-
<name>Servidor MediaTomb</name>
- add supoort for mts (MPEG-2 TS) files:
-
- config.xml
-
<map from="mts" to="video/mpeg"/>
<map from="ts" to="video/mpeg"/>
<map from="m2ts" to="video/mpeg"/>
- Administració / Administration
33DirectFB#
- Examples
-
- Download
- Compile
-
./configuremakemake install
- Test
-
df_matrix- ...
- Extras
-
- Download
-
- wget
- Compile
- 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./configuremake
34Emacs#
- Paquets / Packages
-
- ELPA / MELPA
-
- Emacs: How to Install Packages Using ELPA, MELPA
- Installation
-
- Getting started
- ~/.emacs
-
(when (>= emacs-major-version 24)
(require 'package)
(add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/")
t)
(package-initialize))
- Usage
-
M-x list-packages
- Meta
key (
M-) -
- ESC (and release)
- Alt (and keep)
- xemacs indent tutorial
c-set-style java- Modes
- Instal·lació d'un mode / Mode installation
-
- (consider MELPA)
- set ~/.emacs.d as part of load-path
-
- ~/.emacs
-
(add-to-list 'load-path "~/.emacs.d")
- put your file in:
-
- ~/.emacs.d/toto.el
- load it from ~/.emacs
-
- ~/.emacs
-
(require 'toto)
- carregar un fitxer .el / load a .el file
-
M-x load-file- .emacs:
-
(load "~/nxml-mode-200YMMDD/rng-auto.el")
- carregar un mode / load a mode
-
M-x [sh-mode c-mode xml-mode...]- .emacs:
-
(setq auto-mode-alist
(cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
auto-mode-alist))
- informació sobre un mode / information about a mode
-
M-x describe-mode
- newline in replace:
-
C-q C-j
- Inverted colours (reverse video):
-
emacs -rv
- printf colors
-
- Ansi Color (built-in)
-
M-x load-library ansi-color
M-: (ansi-color-apply-on-region (point-min) (point-max))
- columnes / columns
-
M-x column-number-mode- .emacs
-
(setq column-number-mode t)
- ratlles verticals / vertical lines
- indent-guide
- instal·lació
- ús
M-x indent-guide-mode
- indent-guide
- parèntesis
-
- What is the command to match brackets in Emacs?
- Moving in the Parenthesis Structure
-
C-M-{n,p,u,d}Ctrl+Alt+(arrows)
- cerca
-
- tornar al lloc després de la cerca:
-
C-x C-x
- Índex a partir d'una cerca:
-
M-occurs
- HTML
tags
- cerca el tag de tancament a partir del tag d'obertura /
search corresponding ending tag
C-c C-f
- cerca el tag d'obertura a partir del tag de tancament /
search corresponding opening tag
C-c C-b
- elimina el tag / remove tag
C-c Backspace
- cerca el tag de tancament a partir del tag d'obertura /
search corresponding ending tag
- .emacs:
-
- disable bell
-
(setq visible-bell t)
- font
-
(set-default-font "6x13")
- auto-fill (automatic introduction of newlines for long lines):
-
- mouse-3 button over (Text) at bottom to activate or deactivate it
- posar bé un paràgraf / fill paragraph:
-
M-q
- eliminar els retorns de carro / join line:
-
- aneu a la darrera línia del paràgraf i aneu fent una de les següents opcions:
-
M-^(cal fer un espai, perquè^és una tecla morta)M-x join-line
- conflictes / conflicts (text diff)
-
- Conflict resolution with Emacs Ediff: How can I take the changes of both versions
M-x vc-resolve-conflicts
- envoltar un text seleccionat
-
- wrap-region.el
-
- dependencies
-
M-x package-install
cd ~/.emacs.d/wget https://raw.githubusercontent.com/rejeep/wrap-region.el/master/wrap-region.el- i18n in Smarty
-
(wrap-region-add-wrapper "{t}" "{/t}" "/") ; hit / then region -> {t}region{/t}
- .emacs
-
(add-to-list 'load-path "~/.emacs.d/wrap-region.el")
- usage
-
M-x html-modeM-x wrap-region-mode- select text
- type '/'
- Indentation
-
- Indentation basics
- 24.1 Indentation Commands
- indent region
-
C-u 1 M-x indent-region
- unindent region
-
C-u 0 M-x indent-region
- Macros
- 17.1 Basic Use
- definició
- F3
...
F4
- F3
- execució
- C-x e
e
e
...
- C-x e
- tabs
-
- Show white space
-
- WhiteSpace
-
- install
-
- ~/.emacs
-
(require 'whitespace)
- activate
-
C-u 1 M-x whitespace-mode RET
- deactivate
-
C-u 0 M-x whitespace-mode RET
- usage
only for this session permanently, in ~/.emacs display
M-x set-variable RET tab-witdth RET 4(setq tab-width 4);insert
CCMode
c-basic-offset
perl
cperl-indent-level
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- inserting
-
(setqtab-stop-list 4);
(setq default-tab-width 4);;; insert spaces (not tabs) when tabbing
(setq-default indent-tabs-mode nil);;; insert tabs (not spaces) when tabbing
(setq-default indent-tabs-mode t);- tabs -> spaces
-
M-x untabify
- spaces -> tabs
-
M-x tabify
35Fitxers 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.texrecode 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
- Percent-encoding
/ URL encoding
- bash
- function cgi-decodevar()
echo "https%3A%2F%2Fwww.example.org%2F" | xargs python -c "import urllib, sys; print urllib.unquote(sys.argv[1])"
- python
- urllib.quote
- urllib.unquote
- bash
- Per a canviar la codificació del nom del fitxer:
-
convmv -f ascii -t utf8 --notest [filename] > [newfilename]
- Diferències / Differences
-
- Programari / Software
- Subversion
- Ignore eol type:
-
diff --strip-trailing-cr file_a.txt file_b.txt
36eyeOS#
- 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
37LDAP (Lightweight Directory Access Protocol)#
- Info
-
- Lightweight Directory Access Protocol (wp)
-
- LDAP Data Interchange Format (LDIF) (plain text format)
- List of LDAP software
- LDAP system administration (O'Reilly)
- Servidor / Server
-
- OpenLDAP
-
- slapd (server)
- modes
-
- slapd-config: OLC (on-line configuration)
-
- based on /etc/openldap/slapd.d/
- Chapter 6.1.1: OpenLDAP using OLC (cn=config)
- slapd.conf (deprecated)
-
- based on /etc/openldap/slapd.conf
- install
-
urpmi openldap-servers
- 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
- {SSHA}xxxx
- /etc/openldap/slapd.conf
rootpw {SSHA}xxxx
suffix "dc=example,dc=com"
rootdn "cn=Manager,dc=example,dc=com"
- logs
- /etc/openldap/slapd.conf
-
- loglevel 128
- /etc/syslog.conf
-
- local4.* /var/log/ldap.log
- service rsyslog restart
- service ldap restart
- migració dels usuaris de sistema
- Migrating Unix and smbpasswd Accounts to LDAP
- Capítulo 9. Migración de usuarios y grupos Unix/Posix al directorio LDAP
- urpmi smbldap-tools
- cd /tmp
- ...
- /usr/share/doc/smbldap-tools/doc/migration_scripts/smbldap-migrate-unix-accounts -P users.passwd -S users.shadow -v -n -a
- 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
- slappasswd
- ...
- afegir entrades / add entries
-
- ldapadd
-
- -x: simple authentication
- -W: prompt for password
- -D: bind dn
- general:
-
- edit general.ldif:
-
dn: dc=example,dc=com
dc: example
objectClass: top
objectClass: domain
dn: ou=usuaris,dc=example,dc=com
ou: usuaris
objectClass: top
objectClass: organizationalUnit
dn: ou=grups,dc=example,dc=com
ou: grups
objectClass: top
objectClass: organizationalUnit
ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f general.ldif
- grups / groups:
-
- grups.ldif (or generated by a script)
-
dn: cn=example,ou=grups,dc=example,dc=com
objectClass: posixGroup
cn: grup1
gidNumber: 10000
ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f grups.ldif
- persones / people:
-
- usuaris.ldif (or generated by a script)
-
...
objectClass: posixAccount
...
ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f usuaris.ldif
- Apache DS
- Clients
-
- command line
-
- openldap client
-
urpmi openldap-clients- usage:
-
ldapsearch -x -b 'dc=example,dc=com' '(objectclass=*)'ldapsearch [-h ldap_server] -xLLL -b 'dc=example,dc=com' '(objectclass=posixGroup)' cn gidNumber
- shelldap
-
urpmi shelldap
- smbldap-tools
-
urpmi smbldap-tools/etc/smbldap-tools/smbldap.conf-
- ...
- usage:
-
smbldap-...smbldap-passwd- ...
- GUI tools (Samba & LDAP)
- Apache Directory Studio
-
- Bind DN or user:
-
- cn=Manager,dc=example,dc=com
- LUMA browser
- Mandriva Directory Server - MDS
- Integration with:
38MMC Mandriva Management Console#
- Mandriva Management Console
- Packages
-
-
MMC
(3.0.4)
Pulse2
(1.3.1)
Mandriva Directory Server (2.4.2.2)
core
plugins
source
mmc-core-3.0.3.2.tar.gz
mmc-core-3.0.3.2.tar.gz
pulse2-1.3.1.1.tar.gz mds-2.4.2.2.tar.gz server
MMC web interface
- mmc-web-base
- mmc-web-ppolicy
- mmc-web-pulse2
- mmc-web-dyngroup
- mmc-web-glpi
- mmc-web-imaging
- mmc-web-inventory
- mmc-web-msc
- mmc-web-pkgs
- mmc-web-bulkimport
- mmc-web-mail
- mmc-web-network
- mmc-web-proxy
- mmc-web-samba
- mmc-web-sshlpk
- mmc-web-userquota
MMC agent
- mmc-agent
- python-mmc-core
- python-mmc-base
- python-mmc-ppolicy
- python-mmc-pulse2
- python-mmc-dyngroup
- python-mmc-glpi
- python-mmc-imaging
- python-mmc-inventory
- python-mmc-msc
- python-mmc-pkgs
/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
client
- pulse2-imaging-client
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
- 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.gztar 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 updatedpkg-reconfigure debconf-
- medium
sudo apt-get installslapd mysql-serversudo 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=/varmakemake 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)
- DN:
[slappasswd -s secret][sudo debconf-show slapd]sudo apt-get install ldap-utilsmmc-add-schema /usr/share/doc/python-mmc-base/contrib/ldap/ /etc/ldap/schema/sudo /etc/init.d/slapd restart
- Mageia
-
mmc-add-schema /usr/share/doc/python-mmc-base/contrib/ldap/ /usr/share/openldap/schema/- service slapd restart
- MMC agent
-
- /etc/mmc/plugins/base.ini
-
- baseDN = dc=example, dc=com
- password = secret
- [computers]
method = inventory
- mkdir /home/archives
- /etc/default/mmc-agent
-
- ENABLE=yes
- /etc/init.d/mmc-agent start
- If you get a "failed", try with debugging:
-
- mmc-agent -d
- Apache
-
- Debian
-
ln -s /etc/mmc/apache/mmc.conf /etc/apache2/conf.d/- sudo /etc/init.d/apache2 restart
- Mandriva / Mageia
-
ln -s /etc/mmc/apache/mmc.conf /etc/httpd/conf.d/service httpd restart
- MMC usage
-
- http://localhost/mmc/
- root / secret
39Pulse2#
-
latest (1.3.1) 1.3.0
download
http://pulse2.mandriva.org/pub/pulse2/
Pulse2 Downloads Pulse2 Downloads (Previous releases)
documentation
install
from source
from packages
Pulse2-Install-Debian-Lenny.pdf user
User manuals
development
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- 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
-
- /usr/share/doc/pulse2/
- Compilation and installation
-
wget pulse2-1.3.1.1.tar.gztar xvzf pulse2-1.3.1.1.tar.gz; cd pulse2-1.3.1.1./configure --disable-nsis --prefix=/usr --sysconfdir=/etc --localstatedir=/varmakemake install
- Post-install (choose one of the following)
-
pulse2-setup- manual MySQL config:
-
- setup
-
mysql -u root -pcreate 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
40FLUTE#
- MCLv3
-
- wget http://planete-bcast.inrialpes.fr/bin/mcl_ldpc_pre05may25.tgz
- FCAST
-
- urpmi libstdc++-static-devel makedepend
- cd mcl/fcast
- make ...
- FLUTE
-
- urpmi libxerces-c28-devel
- mcl/src/flute_lib/Makefile:
-
- /usr/local/include -> /usr/include
- ...
- MAD-FLUTE compilation
-
- wget ...
- urpmi libcurl-devel
- ...
41DSM-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-downloadwget 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 -vvdvbtune -f 818000-qam 64 -gi 4 -cr AUTO -bw 8 -tm 8 && rb-download -vv-c 35490(TVE La1)dvbtune -f 650000 -qam 64 -gi 32 -cr AUTO -bw 8 -tm 8 && rb-download -vv [-c carousel_id] service_id- ...
- rb-browser
-
urpmi libexpat1-devel libfreetype6-devel libffmpeg-devel libxrender1-devel libxft-devel libpng-devel- get it:
-
svn checkout https://redbutton.svn.sourceforge.net/svnroot/redbutton/redbutton-browser/trunk/ redbutton-browser
make
42dvbsnoop#
- Compilació / Compilation
-
- Get the source:
-
- ...
- Get and apply patches
- Compile
43Diccionaris per a Netscape#
- Aquests són alguns diccionaris:
- català: pca4s323.dat (239 KB)
- francès: pfr2s331.dat (346 KB)
- castellà: psp4s333.dat (292 KB)
- Linux: poseu-los a
/usr/lib/netscape/spell - MS Windows: poseu-los a
...\Netscape\Communicator\Program\SpellChk\
44Diccionaris 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.
45Internacionalització de Netscape#
- netscape-communicator
- (algun netscape-llengua)
- ca -> català
- es -> castellà
46Diccionari català per a MS Word#
- diccio_catala.zip (1105 KB)
47Defunció del ratolí en Linux#
CTRL+ALT+F1per anar a una sessió de text.- Mogueu el ratolí i veureu el cursor (quadrat blanc) que belluga.
CTRL+ALT+F7per a tornar allà on éreu. El ratolí hauria d'anar bé.
48Ratolí 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
49CVS#
- server (
computer_name) -
urpmi cvs xinetdcvs -d /usr/local/cvsroot/repository_name initchown 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 onservice xinetd restart
- (
- tallafoc / firewall:
-
- mcc:
-
- 2401/tcp
- client:
cvs -d :pserver:usuari@computer_name:/usr/local/cvsroot/repository_name login
- Per a fer servir el WinCVS:
- La primera vegada
- CVSROOT -> :pserver:username@dev.isoco.com:/usr/local/cvs-repository
- Identification: password on CVS server
- Admin / Login
- Create / Checkout del
projecte que ens interessa:
- Local directory: BackOfficeCVS (o un altre qualsevol)
- CVS directory: BackOfficeRepository
- Globals / read-only deshabilitada
- Les altres vegades
- per a pujar un fitxer que hem modificat: commit
- per a baixar-nos l'última versió que hi ha al CVS: update
- La primera vegada
- 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 Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Per a eliminar "-kb" d'un fitxer (*):
-
cvs admin -kkv toto.txtcvs update -A toto.txt(des de lincvs: "Treure opcions locals (-kx")
- Per a eliminar "-kb" de tots els fitxers d'un directori (*):
- Els finals de línia es fan de les
formes següents, depenent del sistema operatiu (aquesta
nomenclatura és la que fa servir TextPad):
CR: 0D, LF: 0A
PC ^M \r \n CR LF UNIX \n LF Mac ^M \r CR Netscape ^M^M \r \r \n CR CR LF Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- 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.txtamb 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
- crear
50WinCVS -> LinCVS#
- CVS/Root:
-
- :pserver;username=usuari;hostname=maquina:/cvsroot -> :pserver:usuari@maquina:/cvsroot
51Subversion#
- servidor
(
maquina) -
urpmi subversion-server subversion-toolschown 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 onservice xinetd restart
- (
- tallafocs / firewall:
-
- 3690/tcp (/etc/services)
- mcc:
- 3690/tcp 3690/udp
- 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 createrepo1(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:
- ...
- cd
- 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:
-
svnserve.conf-
anon-access = none
- option 2: SASL
- option 3: svn+ssh
-
- Tunneling over SSH
- client:
-
svn info svn+ssh://maquina/absolute_path/to/repo1
- NOTE: if you want to avoid the absolute path, setup client for ssh with modified ~/.ssh/authorized_keys (Step 7):
- /etc/subversion/config
-
- ...
- 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 repo3svnadmin load repo3 < toto.dumpchown 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_svnsvn import . svn://host/repo1/module_name_remote/trunk/
- Baixada de codi per primera vegada / First time download:
-
svn co svn://host/repo1/module_name_remote/trunk/ /local/dir/module_name_local
- Estat local / Local status
-
svn status
- Estat remot / Remote status
-
svn status -uv
- Actualització / Update
-
svn update
- Afegir / Add
-
svn add file1 file2 ...svn delete --keep-local file1 file2 ...- un directori, però sense el seu contingut / a directory without its contents
-
svn add --depth=empty name_dir
- Pujada / Commit
-
svn commit [fitxer_local] -m "comentari"
- Diferències locals / Local differences
-
svn diffsvn diff | kompare -on -meld .
- Diferències remotes / Remote differences
-
svn diff -r HEAD
- Dóna un conflicte per resolt / Mark a conflict as resolved
-
svn resolved toto.txt
- Etiquetes / Tags
-
svn copy http://svn.example.com/repos/calc/trunk http://svn.example.com/repos/calc/tags/release-1.0 -m "Tagging the 1.0 release of the 'calc' project."
- Propietats / Properties
-
- Estableix les propietats / Set properties (*)
-
- directament / directly:
-
svn propset svn:ignore dirname .
- editant-les / editing:
-
svn propedit svn:ignore . --editor-cmd emacs
- des de fitxer / from file:
-
svn propset svn:ignore -F file.txt .- on / where file.txt
-
dir1
dir2
- Unset
-
svn pdelsvn:ignore .
- Get properties
-
svn proplistsvn propget svn:ignore
- List of properties
- Eclipse
- Remote dump:
- 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/rootcould 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
-
- get the cvs2svn-example.options file corresponding to your version of cvs2svn (e.g. 2.3.0):
-
- (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,
)
- ctx.cvs_author_decoder =
CVSTextDecoder(['latin1',],)
cvs2svn --options=your_file.options
- Importar el fitxer dump.
52Git#
- 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.rpmsudo yum install -y --enablerepo=gf-plus git
- Git documentation
- Tutorial
-
- gittutorial (kernel.org)
- git (1) manual page (kernel.org)
- A successful Git branching model
- Workflow
-
-
good for
bad for
git flow
- develop
- release
- master
GitHub Flow
- master
GitLab Flow
(14.10)
(with Duo)Simple
- master
Production branch
- master
- production
Sass
Sass with time restrictions
Environment branches
- master
- pre-production
- production
3 environments:
staging, pre-production, production
Release branches
- master
- 2-3 stable
- 2-4 stable
- ...
(one branch for each stable version)
releasing software to outside
production branch
upstream first (Google, Red Hat), cherry-pick
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Continuous integration
- Feature branch (Martin Fowler)
- Commit messages
-
- Altres usos / Other usages
- Services
- Bitbucket
- GitHub
- GitLab
- 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.orggit config --global user.name "My Complete Name"
- to setup per-project config file (
/path/to/project/.git/config)git config user.emailuser@example.orggit config user.name"My Complete Name"
- prompt
- ~/.bashrc
# git
# Carrega la funció oficial del prompt de Git d'Ubuntu
if [ -f /usr/lib/git-core/git-sh-prompt ]; then
source /usr/lib/git-core/git-sh-prompt
fi
# Configuració dels indicadors d'estat de Git (opcional)
export GIT_PS1_SHOWDIRTYSTATE=1 # Mostra * si hi ha canvis sense desar, + si estan a l'staged
export GIT_PS1_SHOWUNTRACKEDFILES=1 # Mostra % si hi ha fitxers nous no seguits
export GIT_PS1_SHOWSTASHSTATE=1 # Mostra $ si tens canvis guardats a l'stash
export GIT_PS1_SHOWUPSTREAM="auto" # Mostra <, > o = respecte a la branca remota (GitHub)
export GIT_PS1_SHOWCOLORHINTS=1 # Activa colors automàtics per a l'estat de Git
# Modifica el format del text del prompt (PS1) per incloure la branca
# El paràmetre " (%s)" injectarà la branca verda i el seu estat
export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\[\033[01;33m\]$(__git_ps1 " (%s)")\[\033[00m\]\$ '
- 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
...
- bad response:
- Solució / Solution
-
- update nss (3.19 -> 3.28):
-
- CentOS
-
sudo yum install nss
- Pujar un projecte a un servidor central / Import a project into a central server
-
- on server (user connected via ssh), create the repository:
-
$ cd /opt/git
$ mkdir project.git
$ cd project.git
$ git --bare init [--shared=group]- shared for group members:
- 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/masterall refs (?) master (HEAD) yes
git fetchsize 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.gitall 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 = trueall 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
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- ...
- Backup a GitHub repository
- Git Repository Backup
- Fully backup a git repo?
- What's the difference between git clone --mirror and git clone --bare
gitbundle- create a bundle file (--all: with all heads) from
inside a local git repo
git bundle create reponame.bundle --all
- incremental
- (see: man git bundle)
- inspect:
git bundle list-heads reponame.bundle
- regenerate a git repo from a bundle file:
-
git clone [-b master] reponame.bundle reponame_from_bundle git clone --bare reponame.bundle reponame_from_bundle
-
- create a bundle file (--all: with all heads) from
inside a local git repo
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.gitcd /path/to/reponame.gitgit 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 updatecd /path/to/reponame.gitgit bundle create /path/to/backups/reponame.bundle --all
- first time: create a mirror and a bundle file from
it
- from a computer with access to the origin git
-
- bare
- bare és un repositori sense branca de treball (només el directori .git)
- conversió de repositori
normal a bare:
- How do I make existing non-bare repository bare?
- How to convert a normal Git repository to a bare one?
cd myrepo_namemv .git ../myrepo_name.gitcd ..rm -rf myrepo_namecd myrepo_name.gitgit config --bool core.bare true
- 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.gitcd myprojecttouch README.mdgit add README.mdgit commit -m "add README"git push -u origin master
- Push an existing folder:
cd existing_foldergit initgit remote add origin git@gitlab.com:mygroup/myproject.gitgit add .git commit -m "Initial commit"git push -u origin master
- Push an existing Git repository:
cd existing_repogit remote rename origin old-origingit remote add origin git@gitlab.com:mygroup/myproject.gitgit push -u origin --allgit push -u origin --tags
- Git global setup:
- GitHub / GitLab
- GUI
-
- GUI clients
- Eclipse
- gitk
- The missing gitk documentation
- until HEAD (yellow circle)
-
gitk
- all (HEAD is yellow circle)
-
gitk --all
- history of all modifications for a specific file (See changes to a specific file using git):
-
gitk [--all] <filename>
- simplificat / simplified
-
gitk --simplify-by-decoration --all
- Mode fosc / Dark mode
- dracula / gitk
- themitosan/gitk-dark-mode
- Gittyup
- Instal·lació
flatpak install flathub com.github.Murmele.Gittyup
- Ús / Usage:
flatpak run com.github.Murmele.Gittyup
- Instal·lació
- info
-
git status-
- do not show untracked files:
-
git status -uno
git remote -v-
project_name=$(git remote -v | head -n1 | awk '{print $2}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')
git remote show [remote-name]git show-
git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%C(yellow)%h|%C(red)%ai|%C(blue)%an|%C(green)%d %C(reset)%s"git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%h | %ai | %an | %d %s"git_date=$(git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%aI")
git show-refgit 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 --graphgit 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
- View
git history of specific line
git log -L '/the line from your file/,+1:path/to/your/file.txt'
git reflog- Inclusió de la informació del git en el codi font / Include git info in source files:
-
- How would you include the current commit id in a git project's files?
- GIT-VERSION-GEN
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"
- 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: list only “untracked” files (also, custom commands)
git -C <path_to_local_repo_dir> ls-files --exclude-standard -o --directory
git blame <filename>-
- show who modified lines in filename
git bisect-
- Use binary search to find the commit that introduced a bug
- Change log
-
- Keep a CHANGELOG
- Good ways to manage a changelog using git? (so)
- Eines / Tools
-
- gitchangelog (Python)
- build a local repository (fetch) and a working copy (...) from a remote repository:
-
git clone [--depth=...] nom_usuari@origin_server:/full/path/to/repository.gitgit 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.gitgit 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_dircd ~/my_dirgit remote add -m branch_name origin https://github.com/user/project.gitgit config core.sparsecheckout trueecho dir_in_project >> .git/info/sparse-checkoutgit pull origin branch_namegit checkoutbranch_name
- commit to local repository
-
- option 1:
-
- add selected modified files to stage:
git add fitxer1 fitxer2
- commit files that are on stage:
git commit -m "comentari"
- add selected modified files to stage:
- option 2:
-
- add all modified files to satge ans commit them in a
single step:
git commit -a -m "comentari"
- add all modified files to satge ans commit them in a
single step:
- modify comment:
-
- Amending the most recent commit message
- Changing a commit message (GitHub)
- just commited, still not pushed
-
git commit --amend -m "..."
- 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 komparegit difftool -d -t meld
- entre dues branques / between two branches:
-
- Get all files that have been modified in git branch
- How can I find out which files have been modified in a branch?
git diff branch1 branch2git difftool -d -t meld branch1 branch2- només els noms de fitxer / only file names
-
git diff --name-only branch1 branch2
- només els noms de fitxer, amb l'estat / only file names, with status
-
git diff --name-status branch1 branch2
- entre dues versions del mateix fitxer:
-
- How do I diff the same file between two different commits on the same branch?
git diff [--options] <commit> <commit> [--] [<path>...]
- 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.gitcd primary_repo.gitgit remote add --mirror=fetch secondary https://secondary_repo_url/secondary_repo.git
- if your primary_repo is not bare, you may want to
checkout every remote branch to convert them to
local
- sync primary -> secondary
git fetch origingit push secondary --all
- sync secondary -> primary
git fetch secondarygit push origin
- sync primary <-> secondary
mkdir ../workdirgit fetch origingit --work-tree=../workdir/ checkout branch_name file_name1git fetch secondarygit --work-tree=../workdir/ checkout branch_name file_name2git push secondarygit push origin
- setup
- show the remotes:
-
git remote -v
- remove the remote "origin"
-
git remote remove origin- git remote remove <remote_name>
- add a new remote (default to "origin"):
-
git remote add origin remote_user@remote_server.org:/home/user/toto.gitgit remote add <remote_name> remote_user@remote_server.org:/home/user/toto.git
- check remote changes:
-
- git: check if pull needed
-
git fetch -v --dry-run
- get the remote (default to "origin") changes into the local repository (e.g. to get new branches), without merging:
-
git fetchgit fetch <remote_name>- all remotes:
git fetch --all
- 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.
- Your
configuration specifies to merge with the ref
'refs/heads/mybranch'
- discard local changes
- push the local repository to a remote (default to "origin"):
-
git pushgit 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 branchgit push origin <branch_name> # to push the local branch
- Problemes / Problems
-
"insufficient permission for adding an object to repository database"-
- Solució / Solution
-
- Git Push Error: insufficient permission for adding an object to repository database
- How do I share a Git repository with multiple users on a machine?
- for newly created repositories, make sure they are created, in origin, with option --shared=group
- to modify an existing repository, on origin:
-
git config core.sharedRepository true
- a l'origin, comproveu que el grup té permisos d'escriptura de la carpeta objects:
-
chmod g+w nom_repositori.git/objects/*
- change the remote origin (e.g. to GitLab):
-
git remote -vgit remote remove origingit remote add origin git@gitlab.com:<your_group>/<your_project>.gitgit branch --set-upstream-to=origin/master mastergit pull
- get a given branch or commit
-
git checkout mastergit checkout remotes/git-svngit checkout c8a1
- ignore
-
- gitignore
- gitignore.io (create .gitignore file for a lot of languages/frameworks)
- user
-
$HOME/.config/git/ignore
- repository
-
.gitignore
- exemples / examples:
-
*.pyc
- submodules
- 7.11 Git Tools - Submodules
- list submodules
git submodule
- addició d'un submòdul / add submodule
cd some_main_projectgit submodule add git@gitlab.com:account_name/some_needed_project.git- crearà un fitxer
.gitmodules, que conté la informació dels submòduls
- clonació d'un projecte que ja conté
.gitmodules:- en tres passos
git clone git@gitlab.com:account_name/some_main_project.git- us crearà un subdirectori
some_needed_project, però estarà buit
- us crearà un subdirectori
git submodule initgit submodule update
- en dos passos
git clone git@gitlab.com:account_name/some_main_project.git- us crearà un subdirectori
some_needed_project, però estarà buit
- us crearà un subdirectori
git submodule update --init
- en un sol pas
git clone --recurse-submodules git@gitlab.com:account_name/some_main_project.git
- en tres passos
- actualització del submòdul:
git submodule update --remote some_needed_project
- només un subdirectori com a submòdul
- revert / reset
-
- revert will add new commits
- reset will not add new commits
- Undo commit
-
- reset (no new commits) not pushed yet (all local commits will be discarded):
-
git reset --hard origin/<branch_name>
- reset (no new commits) already pushed:
git reset --hard <last_working_commit_sha>
git push -f origin <branch_name>
- revert (new commits) already pushed:
-
git revert ...- only last commit:
-
git revert HEADgit push
- last two commits:
-
git revert HEAD~1git push
- ...
- Undoing Merges
-
- local:
-
git reset --hard <hash_of_commit_previous_to_merge>
- local and remote:
-
git revert -m 1 <hash_of_merge_commit>- redo merge
git revert <hash_of_first_revert>
- Rolling back changes with revert
- reset remote branch
- to the same commit as in local
- Resetting remote to a certain commit
- steps
- you may need to temporarily configure repo to
accept forced push:
- GitLab
- Settings -> Repository ->
Protected Branches
- master: Allowed to force push
- Settings -> Repository ->
Protected Branches
- GitLab
- 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
- you may need to temporarily configure repo to
accept forced push:
- to the same commit as in local
- branch
-
- Git - Branches in a nutshell
- clone a given branch
-
git clone -b branch_name nom_usuari@origin_server:/full/path/to/repository.git repository-branch_name
- list all local branches
-
git branch
- list all available (local and remote) branches
-
git branch -a- sort by date
-
git branch -v --sort=committerdategit branch -a -v --sort=committerdate --no-mergedgit for-each-ref --sort=-committerdate refs/heads/
- get current branch
-
git rev-parse --abbrev-ref HEADgit symbolic-ref --short HEAD
- branch management
-
git branchgit branch -vgit branch --mergedgit branch --no-mergedgit branch -v --sort=committerdate --no-merged
- create a new branch:
-
git branch <branch_name>
- switch to the new branch:
-
git checkout <branch_name>
- create a new branch and switch to it:
-
git checkout -b <branch_name>
- create a local branch based on a remote
one (a previous fetch was done) and switch
to it:
git checkout <branch_name>- git checkout
--track
<remote_name>/<branch_name> git checkout -b <local_branch_name> <remote_name>/<remote_branch_name>
- rename a local branch (*)
-
git branch -m <old_branch_name> <new_branch_name>
- rename a remote branch (*)
-
git branch -m <old_branch_name> <new_branch_name>git push origin :<old_branch_name>git push --set-upstream origin <new_branch_name>- other users:
-
git fetch origin --prune
- upstream (connect to/track a remote
branch)
- set the upstream:
git branch -u <remote_name>/<remote_branch_name>git branch --set-upstream-to=<remote_name>/<remote_branch_name>
- get the upstream:
git branch -vv
- delete the upstream:
- git ...
- set the upstream:
- push a local branch
-
git push origin <branch_name>- undo a push (recently done)
git reset --hard HEAD~1git push --force
- get new branches from origin
-
git fetch
- merge master into your branch
-
git checkout <branch_name>git merge --no-ff master- Abort merge
-
git reset --merge
- merge your branch into master
-
git checkout mastergit merge--no-ff<branch_name>
- discard local merge, not pushed yet
-
- Undo a Git merge that hasn't been pushed yet
git reset --merge ORIG_HEAD
- dry-run merge (Is
there a git-merge --dry-run option?)
git merge --no-commit --no-ff <branch_name>git status -unogit merge --abort
- revert / undo a merge
- conflicts
-
- solve conflicts
-
- manually, or
git mergetool
git add <file_with_resolved_conflicts>git statusgit commit -m ...
- delete branch
git branch -d <branch_name>- to force deletion:
git branch -D <branch_name>
- delete branch in origin
-
- Delete a Git branch both locally and remotely
git push origin --delete <branchName>- from other developer computer:
git fetch --all --prune
- rebase branch (sense canviar-ne el nom /
without changing name)
git checkout my_branchgit rebase mastergit 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_branchgit rebase master- git branch -m my_branch my_branch_rebased
- git branch --unset-upstream my_branch_rebased
- git push --set-upstream origin my_branch_rebased
- other users
git fetch origin --prune
- abort rebase (local)
git rebase --abort
- squash
- using interactive
rebase
- squash latest 3 commits
git rebase -i HEAD~3
- squash latest 3 commits
- using interactive
rebase
- tag
-
- Git - Tagging
- Semantic versioning 2.0.0
- crea una etiqueta / create a tag:
-
git tag -a nom_tag[-m "my comments"]- lightweight
-
git tag lw_nom_tag
git push origin nom_tag
- etiqueta un commit anterior / tag a previous commit:
-
git log --pretty=oneline-
9fceb02...
git tag -a v1.2 9fceb02
- llista d'etiquetes / list of tags:
-
git tag- amb els comentaris:
- git tag -n
- detalls sobre una etiqueta / details about a tag
-
git show nom_tag
- puja a origin
-
- una etiqueta
-
git push origin nom_tag
- totes les etiquetes
-
git push origin --tags
- afegeix un comentari a una etiqueta existent / add a comment to an existing tag:
-
git tag -f existing_tag existing_tag -m "my comments"
- esborra una etiqueta / delete a tag:
-
- local
-
git tag -d old_tag
- origin
-
git push --delete origin old_tag
- reanomena una etiqueta / rename old_tag -> new_tag:
-
git tag new_tag old_taggit tag -d old_taggit push --delete origin old_taggit 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_hotfixgit log --pretty=onelinenote the commit_id of the commit you want to apply to preproduction branch
git checkout preproductiongit cherry-pick <commit_id>
- patch
-
- 5.3 Distributed Git - Maintaining a Project
- Option 1: to be applied with classical patch
- Creació / Creation
git diff -p v1.0.0 >0001.patch
- Aplicació / Application
patch -p1 <0001.patch
- Creació / Creation
- Option 2: to be applied to a git repo
- Creació / Creation
-
- diferències entre el git local (amb els commits fets) i l'origin:
-
git format-patch origin
- Aplicació / Application
-
git apply 0001-toto-description.patchgit am ...
- Desfer l'aplicació / Undo application
-
git apply -R0001-toto-description.patch
-
- archive
-
- How to do a “git export” (like “svn export”)?
git archive --format zip --output /tmp/toto.zip master
- 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 gpacgit svn initsvn://svn.code.sf.net/p/gpac/code/trunk/gpacgit svn fetch -rHEAD(or specific revision, obtained with "svn logsvn://svn.code.sf.net/p/gpac/code/trunk/gpac")git svn clone -rHEADsvn://svn.code.sf.net/p/gpac/code/trunk/gpac- or a range of revisions (from r4000 to HEAD)
-
git svn clone -r 4000:HEADsvn://svn.code.sf.net/p/gpac/code/trunk/gpac
- actualitza el git a partir de l'svn / update git from svn:
-
git svn rebase
- des d'un altre ordinador, sincronitza cap a aquest nou git creat / attach another client computer to this newly created git
-
git clone user@server:/path/to/gpac.git- o bé, des del matiex ordinador, en un altre directori / or, from the same computer, on another directory:
-
git clone /path/to/gpac/
- a l'ordinador que sincronitza l'svn, mira les diferències
que hi ha entre el git local (
master) (amb els commits fets) i la versió que s'ha baixat de l'svn remot (remotes/git-svn): -
- comprova les branques existents
-
git branch -a
git diff remotes/git-svn..- crea un patch amb aquestes diferències:
-
git format-patch remotes/git-svn
- Migració / Migration svn -> git
-
- 8.2 Git and Other Systems - Migrating to Git
- Passos / Steps
-
- 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:
git push origin --all
- Optional: get the authors from svn history, and
edit the resulting users.txt file:
53Grafana#
- Visualization
- Info
- Grafana community
- Grafana
fundamentals
- Grafana
for beginners (yt list)
- Observabilitat / Observability
- DevOps
- Steps
- plan
- code
- build
- test
- release
- deploy
- operate
- monitor
- plan
- ...
- Steps
- Tutorial (Grafana
fundamentals)
- ...
- Annotations
- manual
- automatic
- Alerts
- ...
- Grafana
for beginners (yt list)
- Instal·lació / Installation
- Docker
git clone https://github.com/grafana/tutorial-environment.gitcd tutorial-environmentdocker psdocker compose updocker compose ps
- Local
- Dependències / Dependencies
- Mageia
- urpmi ...
- Mageia
- Get Grafana
- tar
wget https://dl.grafana.com/oss/release/grafana-6.5.3.linux-amd64.tar.gztar -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
- ...
- tar
- Start server
sudo ...grafana-6.5.3/bin/grafana-server
- Dependències / Dependencies
- Docker
- Ú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
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
54Calendaris / Calendars#
- plan to iCalendar
-
plan2vcs dayplan dayplan.vcsrecode 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
55apropos#
- makewhatis
56Matlab#
gcf = figure( 'Position', [0 0 mida_x mida_y] );
...
axis( [0 255 0 Inf] );
set( gcf, 'PaperPositionMode', 'auto' );
print( '-r72', '-dtiff', 'toto.tif' );
57C / C++#
- Temps / Time
-
include <time.h>time_t tHoraActualUTC;time( &tHoraActualUTC ); // get present time
| -> | time_t | tm | str |
|---|---|---|---|
| time_t (sec from 1 jan 1970) |
- | gmtime | |
| localtime | ctime | ||
| tm (struct) |
timegm
(gnu
c) _mkgmtime (ms visual) |
- | asctime |
| mktime (ansi) timelocal (gnu c) |
|||
| str | getdate strptime strftime |
- |
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
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
58Cygwin#
- 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
- Paquets / Packages
-
cygcheck [-f -l -c]- Mirrors
-
- Cygwinports (blog) (e.g. for PHP)
-
cygstart -- /path/to/setup.exe -K http://cygwinports.org/ports.gpg-
- Add:http://stackoverflow.com/questions/3810966/automate-cygwin-via-batch-file?rq=1
- Utilitats / Utils
-
util-linux (more, ...)
- Compilation without cygwin.dll (or use MinGW instead):
- Access from DOS terminal
-
- Automate cygwin via batch file
- Cygwin: Running bash script directly inside dos batch file doesn't work
bash --login -i -c '/usr/bin/mkpasswd --local > /etc/passwd'
- 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
- Servicios en Cygwin (syslogd, sshd, telnetd, ftpd, nfsd, etc.)
- OpenSSH
-
ssh-host-config -ycygrunsrv -S sshd
(net start sshd)- How to setup the secure shell daemon on a Windows 2003 server
- Running Cygwin as root to use SSH on target Windows operating systems
- Problems:
-
- sshd_server (privileges)
-
- "/bin/bash: permission denied" on WinXP 2003 x64 solved (privilege problem)
-
editrights -u sshd_server -l
- Error 1609
-
- RE: Error starting sshd: "Win32 error 1069"
-
editrights -l -u sshd_server
- /var/empty not owned by ...
- Apache
-
- Using Apache 1.3 with Cygwin
- (net start Apache2)
- /usr/sbin/apachectl2 -k start
- PHP
-
- PHP on Cygwin (Cygwin Ports)
- PHP and Cygwin (Gareth Hunt)
- Steps
-
- Add Cygwinports mirror
- Install: apache2-devel apache2-mod_php5
- Problems:
-
- segmentation fault (*):
-
- net stop cygserver
- net start cygserver
- /usr/sbin/apachectl2 -k start
- Drivers
59Postfix ( servidor de correu / email server )#
- Instal·lació / Installation
-
- CentOS
-
sudo yum install postfix
- Configuració / Configuration
-
-
MSA
Mail Submission Agent
MTA
Mail Transfer Agent
MDA
Mail Delivery Agent
Postfix smtpd (server) Postfix smtpd (SMTP server: receiving)
Postfix smtp (SMTP+LMTP client: sending) dovecot, cyrus
/etc/postfix/master.cf
/etc/postfix/main.cf
(sudo postconf -e ...)/etc/postfix/main.cf
(sudo postconf -e ...)
Enable port 587:
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=$mua_client_restrictions
-o smtpd_helo_restrictions=$mua_helo_restrictions
-o smtpd_sender_restrictions=$mua_sender_restrictions
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
# network interfaces that listen
inet_interfaces = localhost, 192.168.1.100# trusted networks that can send messages
mynetworks = 192.168.1.0/24, 127.0.0.0/8
# domain name for this email server
mydomain = example.org# host name of the system
myhostname = mail.example.org# domain for locally-posted email
myorigin = $mydomain# this server is destination for emails with this domain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain# destination domains this server can relay to
relay_domains =home_mailbox = Maildir/
SASL: cyrus
- ...
smtpd_sasl_auth_enable = yesbroken_sasl_auth_clients = yessmtpd_sasl_type = dovecotsmtpd_sasl_path = private/authsmtpd_sasl_security_options = noanonymoussmtpd_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 = yessmtp_tls_security_level = encryptsmtp_sasl_tls_security_options = noanonymousrelayhost = [mail.isp.example]
# Alternative form:
# relayhost = [mail.isp.example]:submissionsmtp_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/Makefilemail.example.org.pem" -
smtpd_tls_cert_file = /etc/postfix/mail.example.org.pemsmtpd_tls_key_file = $smtpd_tls_cert_file
- Let's Encrypt certificates:
-
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.org/fullchain.pemsmtpd_tls_key_file = /etc/letsencrypt/live/mail.example.org/privkey.pem
smtpd_tls_security_level = may
smtpd_use_tls = yessmtpd_tls_loglevel = 1smtpd_tls_received_header = yes#smtpd_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crtsmtpd_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 = maysmtp_tls_note_starttls_offer = yessmtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt # see also: ca-root-nss.crt
Virtual maps
virtual_alias_domains = $mydomainvirtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/virtual
postmaster@example.org root
root@example.org root
info@exampe.org infosudo postmap /etc/postfix/virtual
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Postfix Standard Configuration Examples
- Test configuration
-
postconf
- Django + Postfix
- Postfix rate limiting – Politeness goes a long way
- CentOS 5
- Port
-
- Enable port 587 (
submission), that will enable STARTTLS on 250 responses to EHLO request -
- /etc/postfix/master.cf
-
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=$mua_client_restrictions
-o smtpd_helo_restrictions=$mua_helo_restrictions
-o smtpd_sender_restrictions=$mua_sender_restrictions
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
- Enable port 587 (
- Seguretat / Security
-
- Info
-
- Postfix TLS Support
- Postfix/dovecot SASL and SSL/TLS guide (CentOS)
- Running down stray errors
-
openssl s_client ...
- Let's Encrypt
-
- How to Secure Postfix Using Let’s Encrypt
certbot --authenticator standalone ...
- STARTTLS
-
- Steps
-
- enable port 587 (submission)
- add certificate
- add SASL
- Problemes / Problems
-
warning: TLS library problem: 5294:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol:s23_srvr.c:647:-
- Solució / Solution
-
- telnet/nc does not allow sending non-encrypted text once STARTTLS has been invoked
- use openssl s_client instead
- Autenticació / Authentication
-
- SASL - Simple Authentication and Security Layer
-
- Postfix SASL Howto
- supported SASL implementations:
-
postconf -a
- Cyrus SASL
-
- Instal·lació / Installation
-
- CentOS
-
sudo yum install cyrus-saslsystemctl enable saslauthd.servicesystemctl start saslauthd.service
- Dovecot SASL
-
- Instal·lació / Installation
-
- CentOS
-
- Postfix/dovecot SASL and SSL/TLS guide (CentOS 5)
- Postfix and Dovecot SASL (CentOS 6)
sudo yum install dovecot
- 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" > userssudo mv users /etc/dovecot/
- Add non-system users with encrypted passwords
-
- Password Schemes (How To Safely Store A Password)
- check availability of encryption schemes:
-
doveadm pw -l
- encrypt with SHA256-CRYPT:
-
$ doveadm pw -s SHA256-CRYPT -p my_password
{SHA512-CRYPT}$6$...
echo"$USER:{SHA512-CRYPT}$6$...:$UID:$(id -g)::$HOME" > /etc/dovecot/users
sudo chown root.root /etc/dovecot/users; sudo chmod 600 /etc/dovecot/users- /etc/dovecot/conf.d/10-auth.conf
-
# Remove '#' to use passwd-file:
!include auth-passwdfile.conf.ext
- check:
-
doveconf -n passdb userdb
- /etc/dovecot/conf.d/10-master.conf (or
under directory included by file
specified when running:
doveconf -n | head -n1) -
-
service auth {
...
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0660
# Assuming the default Postfix user and group
user = postfix
group = postfix
}
...
}
# Outlook Express and Windows Mail works only with LOGIN mechanism, not the standard PLAIN:
auth_mechanisms = plain login
-
- Prova / Test
-
- Testing SASL authentication in the Postfix SMTP Server (postfix.org)
- encode username and password in base64 (if password starts with a digit, and bash version >=2.3, check that you are using four zeros):
-
$ echo -ne '\0000username\0000password' | base64<username_and_password_in_base64>- check decoding:
-
$ echo -ne<username_and_password_in_base64>| base64 -dusernamepassword
$ openssls_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
-
- check SELinux
- non-relayed (local Postfix acts as a server:
smtpd_...) -
- (feu servir el fitxer
/etc/postfix/main.cfpredeterminat / use the default/etc/postfix/main.cffile) - el camp "from" es crearà a partir de:
-
- `whoami`@`hostname`
- seguretat / security
- usuaris / users
- accessible des de fora / accessible from outside
-
inet_interfaces = ...
- (feu servir el fitxer
- 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_passwdpostmap /etc/postfix/sasl_passwd
- /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/genericapache remote_smtp_user
postmap /etc/postfix/generic
-
-
/etc/postfix/main.cfmydomain = 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
- remote smtp credentials
- Debug
-
telnet localhost 25-
220 hostname.local ESMTP Postfix
mailq/var/log/maillog
-
- Client
60Dovecot (servidor IMAP)#
61MySQL / MariaDB#
- Instal·lació / Iinstallation
-
- Mageia
-
urpmi mysql mysql-MariaDB# urpmi mariadb
- Ubuntu
-
- >=14.04
-
sudo apt-get install mariadb-server
- How to install MariaDB?
- 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.servicesystemctl start mysqld.service- old way
-
service mysqld start
- Ubuntu
-
sudo service mysql start
- CentOS
-
systemctl enable mariadb.servicesystemctl 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
- només s'hi pot connectar des de superusuari. Des
d'usuari, apareix l'error "
- 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:
-
$ mysql -u root -p
- 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';
EOFmysql -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
-
- Used by date_hierarchy in Django
- Linux
- MS Windows
- Admin (GUI)
-
- mysql-workbench
-
urpmimysql-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)
- Connection Name:
- Problemes / Problems
-
- "pure virtual method called"
-
- Solution:
-
- ...
- phpMyAdmin
-
urpmi phpmyadmin- /usr/share/phpmyadmin
- http://localhost/phpmyadmin
- mysql-administrator
-
urpmi mysql-administrator- Set the root password:
-
mysql-administrator- Stored connection / Save this connection...: your_label
- Server hostname: localhost
- Username: root
- Password: (empty)
- Connect
- User Administration / root : New password / Apply changes
- Accés remot / Remote access
-
- server (IP address: server_ip_address):
-
- /etc/my.cnf
-
- comment "skip-networking"
- ? bind-address
- grant privileges for a user (user_with_remote_privileges) from a remote location:
-
- from command line (user_with_remote_privileges is mythtv):
-
mysql -u root -pmysql> 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
-
/var/lib/mysql/server-name.{log,err}- Use mysql-workbench
- Problemes / Problems
-
- "too many connections"
-
- C.5.2.7. Too many connections
- MySQL Error “Too many connections”
-
- mysql_connect (php)
-
- too many connections
-
- "Apache children are hanging around for too long"
- Nombre de connexions permeses / Number of maximum connections:
-
mysql -u root -p-
mysql> select @@max_connections;
- Nombre de connexions obertes / Number of open connections:
-
netstat -n -a | grep -c mysq- ...
- Solució / Solution
-
- increase the maximum allowed connections on file /etc/my.cfg
-
max_connections = 1000 # default: 151
- Esborrar totes les bases de dades i eliminar la contrasenya de root:
-
rm -rf /var/lib/mysqlservice mysqld restart
- Esborrar mysql / Removing mysql
-
urpme mysql mariadb- this will not remove all the data (root password...). To completely remove mysql:
-
# rm -rf /var/lib/mysql
- Causes of Access denied Errors
- Configuration for:
- Client (GUI)
-
- sqlgui
-
urpmi sqlgui libsqlguimysqlln -s /usr/lib/libsqlguimysql-0.1.1.so /usr/lib/libsqlguimysql.so
- Backup
-
mysqldump database_name -u root -p > database_name.sqlmysqldump --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 -u root -p -v -v -v < all_databases.sql- -D to use specified database:
-
mysql -u root -p [-D toto_db] < toto_db.sql
- Extract a Single Table from a mysqldump File
62Bugzilla#
- MySQL
-
- configure mysql security
-
- set root password
- 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.gzsudo 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 -pmysql> GRANT SELECT, INSERT,
UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*
TO bugs@localhost IDENTIFIED BY 'xxxxx';
mysql> FLUSH PRIVILEGES;
- edit config file:
-
- Mageia
-
/etc/bugzilla/localconfig-
set $db_pass xxxxx
- Ubuntu
-
- /usr/local/bugzilla-4.4.4
/localconfig -
set $db_pass xxxxx
$webservergroup = 'www-data';
- /usr/local/bugzilla-4.4.4
- 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
-
mysql -u root -p-
- CREATE DATABASE bugs;
mysql -u root -p -D bugs < bugs_yyyymmdd_hhmm.sql- configure
mysql for bugzilla
- 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)
- 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:
63Scmbug#
- CVS
- Bugzilla
- Scmbug
-
- instal·lació dels paquets necessaris (exemple per a MandrivaLinux):
-
urpmi docbook-style-dsssl-doc perl-XML-Simple perl-Mail-Sendmailurpmi --allow-nodeps scmbug-common scmbug-tools scmbug-server scmbug-docs
- correspondència entre usuaris de cvs i usuaris de bugzilla:
-
/etc/scmbug/daemon.conf
userlist => {enabled => 1, values => {'usuari' => 'usuari@domini.org'}}
- inici del servei:
-
- temporalment:
service scmbug-server restart - permanentment:
chkconfig scmbug-server on
- temporalment:
- 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' }
valid_bug_owner => {enabled => 0}
log_regex => '[Bb][Uu][Gg].*?:(.*)'
64Eclipse#
- Developing an app that needs root privileges?
- Build UNIX software with Eclipse (.configure,...)
- Linux Tools Project/Autotools/User Guide
- Mandriva installation
-
urpmi classpathx-jafurpmi eclipse-platform(choose: xml-commons-jaxp-1.3-apis, eclipse-ecj)urpmi eclipse-changelog eclipse-pde eclipse-pde-runtime(Eclipse won't start with Mandriva 2008)
- Remove all unused import:
-
- (contextual menu):
Source -> Organize imports
- (contextual menu):
65Inno Setup#
- Execució MSI:
-
[Run]
Filename "msiexec.exe"; Parameters: "/qb+ /i ""{pf}\toto.msi"""; Flags: runascurrentserver shellexec waituntilterminated;
66NTP (Network Time Protocol)#
- UNIX / Linux
-
- Data / Date
- Quick HOWTO : Ch24 : The NTP Server
- client (no funcionarà si el servei ntpd està funcionant, perquè ocupa el port) (maybe you need to open the NTP port: 123)
-
- force set time:
sudo systemctl stop ntpd.servicesudo ntpd -gqsudo systemctl start ntpd.service
sudo service ntp stop
sudo ntpd -gq
sudo service ntp start
- ntpdate
(deprecated: use
ntpd -gqinstead)- Installation:
- urpmi ntpdate
- apt-get install ...
- Usage
ntpdate -u europe.pool.ntp.org(amb l'opció -u sí que funcionarà quan el servei ntpd està en marxa / use -u option to force update when ntpd service is running)ntpdate -q europe.pool.ntp.org(just query)
- Installation:
- KDE adjust time: automatically
- CentOS
8
dnf install chronysudo systemctl status chronyd.service- Check clock sync:
sudo dnf install ntpstatntpstat
- force set time:
- client / server (nom_servidor)
-
/etc/ntp.conf (/etc/chrony.conf)-
server nom_servidoriburst (ex: aries.salle.url.edu)
service ntpd start / systemctl start ntpd.servicesystemctl enable ntpd.service- comproveu que el port és accessible des dels clients / check that port is accessible from clients
-
- [solved] ntp reachable but rejected
-
- Open port 123 (udp, tcp):
-
iptables -I INPUT -p tcp -m multiport --dports 123 -m comment --comment "ntp incoming (tcp)" -j ACCEPT
iptables -I INPUT -p udp -m multiport --dports 123 -m comment --comment "ntp incoming (udp)" -j ACCEPT
- ntpstat
ntpstat
- timedatectl
timedatectl status
- ntpq
(standard NTP query program)
- install
- ...
- list of peers:
ntpq -p
- interactive format command (-c)
- list of peers and their status:
ntpq -c peers
- list of association identifiers:
ntpq -c assoc
- list of peers and their status:
- nom_servidor
no serà vàlid fins que no surti un * quan se'l
pregunta amb
ntpq -p nom_servidor/ nom_servidor will not be valid until a * appears before it when callingntpq -p nom_servidor
- install
- MS Windows XP, 2003
-
- client / server
-
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
"NtpServer"="aries.salle.url.edu,0x1""Type"="NTP"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient]
"Enabled"=dword:00000001"SpecialPollInterval"=dword:00000708(cada 1800s es connecta al servidor / connected to server every 1800s)
- server
-
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer]
"Enabled"=dword:00000001
67UUID#
- UNIX
-
urpmi libext2fs-devel (libuuid-devel) (libossp_uuid-devel)#include <uuid/uuid.h>uuid_generate( uu );- needed lib:
-luuid
- MS Windows
-
#inlcude <rpc.h>UuidCreate(&uu);- needed lib:
Rpcrt4.lib
68Microsoft IIS (Internet Information Server)#
- HTTPS configuration
69MS Visual Web Services#
- Check that your web service is running:
-
- http://localhost/<your_web_service>/<your_web_service>.asmx
- "Server Application Unavailable" (when trying to access web services with .net 2.0):
-
- uninstall .net 3.0
- "Failed to access iis metabase". Solution:
-
- WINDOWS\Microsoft.NET\Framework\vX.X.XXXXX\aspnet_regiis -i
- "The process account used to run ASP.NET must have read access to the IIS metabase"
-
- aspnet_regiis -ga <WindowsUserAccount>
- Others:
-
- aspnet_regiis -ua
- aspnet_regiis -i -enable
- "Parser Error Message: Unrecognized configuration section 'connectionStrings'" / "Server Error in '/<your_web_service>' Application, Configuration Error"
-
- Check that your web service is using the right ASP version:
- Start / Control Panel / Administrative Tools / Computer Management / Services and Applications / Internet Information Services / Web sites / Default Web Site
- <your_web_service>: Properties / ASP.NET tab / ASP.NET version: <the_needed_version_for_your_web_service>
- To install NET framework from Microsoft:
-
- Essential Downloads: Version 2.0 Framework
- Verify that the ASPNET user have writing permissions in the wanted directories:
-
- Properties / Security / Add / Advanced options / Search now
- if Security tab is not present:
-
- Tools / Folder options / View / (don't use) Simple file sharing
- ASP tab not present
-
- install first IIS and then NET framework (inverse installation order might cause the problem)
- to install NET framework
- (ASP.NET tab missing)
- Virtual units (subst) do not work for user ASPNET.
- Needed files for deployment of a web service in a computer without MS Visual installed (to be put under C:\Inetpub\wwwroot\<your_web_service>\bin\):
-
- developed with MS Visual 2005:
-
- Release
-
- ...\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\
-
- msvcp80.dll
- msvcr80.dll
- Microsoft.VC80.CRT.manifest
- ...\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.MFC\
-
- mfc80.dll
- Microsoft.VC80.MFC.manifest
- Debug
-
- ...\Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86\Microsoft.VC80.DebugCRT\
-
- msvcp80d.dll
- msvcr80d.dll
- Microsoft.VC80.DebugCRT.manifest
- ...\Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86\Microsoft.VC80.DebugMFC\
-
- mfc80d.dll
- Microsoft.VC80.DebugMFC.manifest
- Security issues (accessing network drives)
-
- IIS / ASP.NET
- "Accessing network drives (me crazy)" (ASP.NET forums)
- Accessing Mapped Network Drives via ASP.NET in IIS 6 (login auditing)
70Toggle keybord layout in MS Windows#
- Control Panel / Regional and Language Options / Languages / Details
- select the language and then Add
- add a keyboard
- Language bar: select all options
71KDE#
- Font antialiasing
-
- KDE control centre: Fonts / Use anti-aliasing / Enabled / Style: Complete
- Menú / Menu
-
kmenuedit/etc/xdg/menus//etc/xdg/kde4/menus/
- Auto start of applications/scripts:
-
- Configure desktop -> Advanced -> Autostart
- applications
-
~/.config/autostart/*.desktop
- scripts
-
~/.kde4/Autostart/*.desktop
- Netbook / HTPC
-
- Configura el teu escriptori
-
- Comportament de l'espai de treball -> Espai de treball -> Tipus d'espai de treball: Ordinador ultraportàtil
- Exploring the KDE Plasma Netbook interface
- Comparing Netbook Desktops - Part 2, KDE Plasma Netbook
72Escriptori remot / Remote dektop#
- rdesktop
rdesktop -g 1024x768 -k es remote_server -r disk:C=/- Per a accedir a la sessió remota ja iniciada ("
-0"): -
rdesktop -0 -g 1024x768 -k es remote_server -r disk:C=/
- Citrix
- Citrix Workspace App
- Download Citrix Workspace App
- Instal·lació / Install
- Dependències / Dependencies
- Mageia 9
- (no hi ha dependències)
- Mageia 7
urpmi libxpm4 libsm6 libxmu6 libxext6
- Mageia 9
- From rpm (ICAClient, ctxusb)
sudo rpm -ivh --nodeps ICAClientWeb-rhel-20.9.0.15-0.x86_64.rpm ctxusb-20.9.0.15-1.x86_64.rpm- it will be installed in:
/opt/Citrix/ICAClient/
- From tar
tar xvf linuxx64-20.9.0.15.tar.gz
./setupwfc- by default, it will be installed in:
- ~/
ICAClient/linuxx64/
- ~/
- Dependències / Dependencies
- Ús / Usage
- Citrix Workspace app for Linux Command Reference
- serveis / services
- ICAClientWeb
sudo systemctl status ctxlogd.servicesudo systemctl status ctxcwalogd.service- Problemes / Problems
ctxlogd.service: Start operation timed out. Terminating.- Solució / Solution
- modify /etc/rc.d/init.d/ctxlogd so
as it does not use start_daemon,
which, in Mageia 7, does not support
-p option:
# If /lib/lsb/init-functions is present use the LSB init fuctions.
if [ -r "$LSB_INIT_FUNCTIONS" ]; then
. "$LSB_INIT_FUNCTIONS"
INITLIB="$LSB_INIT_FUNCTIONS"
fi
INITLIB="NOT_FOUND"
- or manually call:
- /opt/Citrix/ICAClient/util/ctxlogd
- modify /etc/rc.d/init.d/ctxlogd so
as it does not use start_daemon,
which, in Mageia 7, does not support
-p option:
- ctxusb
sudo systemctl status ctxusbd.service- config
- /opt/Citrix/ICAClient/usb.conf
# DENY: class=0b # Smartcard
- ...
- /opt/Citrix/ICAClient/usb.conf
- ICAClientWeb
~/ICAClient/linuxx64/wfica -icaroot ~/ICAClient/linuxx64 toto.ica/opt/Citrix/ICAClient/wfica -icaroot /opt/Citrix/ICAClient toto.ica- Problemes / Problems
- corrupted double-linked list
Avortat (s'ha bolcat la memòria) - malloc_consolidate(): invalid chunk size
Avortat (s'ha bolcat la memòria)
- corrupted double-linked list
- Problemes / Problems
- Navegador / Browser
- Firefox
- fallbacks to HTML5
- Chrome
- uses (one-time) ica files
- Problemes / Problems
You have not chosen to trust "...", the issuer of the server's security certificate (SSL error 61)
- Firefox
- Citrix Workspace App
73rsync#
- setup an rsync server (to be used as rsync daemon):
-
/etc/xinetd.d/rsync
- syntax (
man rsync)
remote shell (one :)
rsync daemon (two ::)
pull
rsync [OPTION...] [USER@]HOST:SRC... [DEST]
rsync [OPTION...] [USER@]HOST::SRC... [DEST]
push
rsync [OPTION...] SRC... [USER@]HOST:DEST
rsync [OPTION...] SRC... [USER@]HOST::DEST
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- src/dest
(-r) SRC DEST sense barra final/ without trailing bar si és un directori, agafarà el directori i els fitxers que conté si el directori existeix, ho posarà tot a dins; si no existeix, el crearà i ho posarà tot a dins amb barra final / with trailing bar si és un directori, agafarà els fitxers que conté si el directori existeix, ho posarà tot a dins; si no existeix, el crearà i ho posarà tot a dins Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Exemples
rsync -avvr toto cesc@synologynas.local::homes/cesc/titi-
src dst - toto/
- primer.txt
- segon.txt
- homes/cesc/
- titi/
- toto/
- primer.txt
- segon.txt
- toto/
- titi/
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- toto/
-
rsync -avvr toto/ cesc@synologynas.local::homes/cesc/titi-
src
dst
- toto/
- primer.txt
- segon.txt
- homes/cesc/
- titi/
- primer.txt
- segon.txt
- titi/
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- toto/
-
- Problemes amb l'horari d'estiu / Problems with daylight-savings time (DST)
-
- How the DST Change can adversely affect FAT filesystems
-
rsync --modify-window=3601 ...rsync --checksum ...- change the timestamps
- The vfat file system and Linux
- ls with precise time
- examples:
-
- opcions
--dry-run
-a archive mode; equals -rlptgoD (no -H,-A,-X)-r, --recursive recurse into directories-l, --links copy symlinks as symlinks-p, --perms preserve permissions-t, --times preserve modification times-g, --group preserve group-o, --owner preserve owner (super-user only)-D same as --devices --specials
- -A
- -H
- -X
--delete delete extraneous files from dest dirs- els fitxers que hi ha a dest però no a src s'esborraran de dest; però aquesta opció cal posar-la explícitament
- sembla que Synology Shared Folder Sync l'activa sempre
- ...
- list of shared modules (rsync daemon):
-
rsync cesc@diskstation.local::- només apareixeran els directoris compartits des de Control Panel -> Shared Folders
rsync cesc@synologynas.local::rsync cesc@diskstation.local::photorsync cesc@synologynas.local::photo
- list of remote own (/home/cesc/) directories (remote shell):
-
rsync cesc@diskstation.local:
- from smartphone (mounted at /media/6636-3133) to local directory:
-
rsync -avvr /media/6636-3133/DCIM/ ~/Imatges/HTC_Magic/rsync -avvr /media/.../DCIM/ ~/Imatges/HTC_One_X/
- from video camera
(mounted at /media/disk or
/run/media/cesc/disk/, vfat) to local directory: -
rsync[--modify-window=3601]-avvr /media/disk/ ~/Vídeos/Sony/rsync --modify-window=3601 -avvr /run/media/cesc/disk/ ~/Vídeos/Sony2/
- from SD card (mounted at /run/media/cesc/9016-4EF8) to local directory:
-
rsync --modify-window=3601 -avvr /run/media/cesc/9016-4EF8/ ~/Imatges/Nikon_S31/
- from SD card (mounted at /run/media/cesc/xxxx-yyyy) to Synology NAS:
-
- DSM 7
rsync --modify-window=3601 -avvr /run/media/cesc/xxxx-yyyy/cesc@synologynas.local::photo/Cesc_Pare/sony_rx100v/sd10/
- DSM 4
rsync --modify-window=3601 -avvr /run/media/cesc/9016-4EF8/admin@diskstation.home::photo/album_1/sd1/
- DSM 7
- from local directory to Synology NAS (diskstation.local, 192.168.0.50):
-
rsync -avvr ~/Imatges/HTC_Magic admin@diskstation.local::photorsync -avvr ~/Imatges/ admin@diskstation.local::photorsync -avvr ~/Vídeos/ admin@diskstation.local::videorsync -avvr ~/Vídeos/Sony2/ admin@diskstation.local::video/Sony2/rsync -avvr /home/cesc/Documents/ synologynas.local:Documents/- com que es fa servir un sol ":"
- com que no s'especifica l'usuari, es farà servir el local, del client
- l'arrel implícita és la casa de l'usuari
- com que es fa servir un sol ":"
rsync -avvr /home/cesc/Documents/ cesc@diskstation.local::homes/cesc/Documents/
- from local directory to external drive:
-
rsync -avvr/home/cesc/Documents /media/disc/copia_seguretat/
- exclusió de fitxers / exclusion of files:
-
rsync --exclude='*.o' ...
- exclusió de directoris / exclusion of directories:
-
rsync --exclude='bin' ...
- preserva els enllaços / preserve links:
-
rsync -l ...
- llistat de fitxers modificats
-
- Can I use rsync to create a list of only changed files?
- Understanding the output of rsync --itemize-changes
- -i (same as--out-format=%i%n%L)
rsync -avvi source/ dest/ >/tmp/rsync.log
awk '/^>/ {print $2}' /tmp/rsync.log
- ssh en un port específic / on a specific remote ssh port 8023:
-
rsync -avvr dir_local --rsh='ssh -p8023' usuari_remot@adreca_servidor:/dir_remot_pare/- per a fer-ho sempre
-
- ~/.ssh/config
-
Host etiqueta_per_a_servidor
HostName adreca_servidor
Port 8023
rsync -avvr dir_local usuari_remot@etiqueta_per_a_servidor:/dir_remot_pare/
- ssh amb un certificat (-e, --rsh són equivalents) (nota: el camí cap al certificat .pem ha de ser absolut)
-
rsync -avvr -e 'ssh -i /home/cesc/.ssh/keys/my_key.pem'dir_localusuari_remot@adreca_servidor:/dir_remot .
- rsync amb sudo remot
-
- Getting files from remote server that need sudo
- Pulling Read restricted files from a remote system with rsync and sudo
- Server
-
- /etc/sudoers.d/usuari_remot
-
usuari_remot ALL=(ALL) NOPASSWD:ALL
# no need for "-t" when accessing via ssh
Defaults:usuari_remot !requiretty
- Client
-
rsync -avvr -e 'ssh -i /home/cesc/.ssh/keys/my_key.pem' --rsync-path='sudo rsync'usuari_remot@adreca_servidor:/etc/dir_remot .
- opcions
74ImageMagick#
- Instal·lació / Installation
- Mageia
urpmi ...
- CentOS
sudo yum install ...
- Mageia
- Features
-
-list format-list interlace
- Info (-format)
-
identify -format '%wx%h' filenameidentify -format '%[exif:orientation]' filenameidentify -verbose filename
- Python
- ImageMagick
(Python wiki)
- PythonMagick
- Documents and examples of PythonMagick
- /download/python
- PythonMagicWand
- based on MagickWand (C)
- PythonMagick
- ImageMagick
(Python wiki)
- Resize
-
convert input_filename -scale 120x90 output_filename
- YUV
- Reduce the number of colours (useful, e.g. for images from a scanner):
-
convert toto.pnm -colors 4 toto.png
- Convert alpha transparency in png (generate an RGBA image,
suitable e.g. for Snowmix)
convert input.png -write mpr:temp -background black -alpha Remove mpr:temp -compose copy-opacity -composite PNG32:output.png
- Convert to pdf
-
convert toto.png toto.pdf- they can then be joined with pdftk
- Create a BGRA image (e.g. for Snowmix)
which convert && convert -depth 8 -size 1280x720 canvas:black black_1280x720.bgraconvert -depth 8 -size 1280x720 canvas:green green_1280x720.bgra
- Convert to raw BGRA (e.g. for Snowmix)
-
convert toto.png toto.bgra
- Display a BGRA image:
display -size 1280x720 -depth 8 BGRA:green_1280x720.bgra- ...
- PNG
-
convert to this format using:
create using:
file gimp channels convert(ImageMagick)gimppython PIL PNG8
no transparency PNG image data, 320 x 180, 8-bit colormap, non-interlaced Indexat -alpha remove PNG8:image_wot_png8.png- Imatge -> Mode -> Indexat...
# pip install pillow
from PIL import Image, ImageDraw
image = Image.new('P', size=(320, 180), color=(155, 0, 0))
d = ImageDraw.Draw(image)
d.ellipse((20, 20, 160, 160), fill=(255, 255, 255))
image.save("imatge_png8.png", format='png')1 indexed colour is transparent PNG image data, 320 x 180, 8-bit colormap, non-interlaced Indexat, Alfa -transparent '#FFFFFF' PNG8:image_wt_png8.png- Imatge -> Mode -> Indexat...
- Capes -> Transparència -> Afegeix canal alfa
- Capes -> Transparència -> Color a alfa
# pip install pillow
from PIL import Image, ImageDraw
image = Image.new('P', size=(320, 180), color=(155, 0, 0))
d = ImageDraw.Draw(image)
d.ellipse((20, 20, 160, 160), fill=(255, 255, 255))
#image = image.convert('P', palette=Image.ADAPTIVE, colors=2)
# index 0 will be transparent
# save palette with 1 bit (2 colours)
image.save("imatge_png8a.png", format='png', transparency=0, bits=1)PNG24
no transparency PNG image data, 320 x 180, 8-bit/color RGB, non-interlaced Vermell, Verd, Blau -alpha remove PNG24:image_wot_png24.png- Imatge -> Mode -> RGB
# pip install pillow
from PIL import Image, ImageDraw
image = Image.new('RGB', size=(320, 180), color=(155, 0, 0))
d = ImageDraw.Draw(image)
d.ellipse((20, 20, 160, 160), fill=(255, 255, 255))
image.save("imatge_png24.png", format='png')1 RGB colour is transparent PNG image data, 320 x 180, 8-bit/color RGB, non-interlaced Vermell, Verd, Blau, Alfa -transparent '#FFFFFF' PNG24:image_wt_png24.png- Imatge -> Mode -> RGB
- Capes -> Transparència -> Afegeix canal alfa
- Capes -> Transparència -> Color a alfa
# pip install pillow
from PIL import Image, ImageDraw
image = Image.new('RGB', size=(320, 180), color=(155, 0, 0))
d = ImageDraw.Draw(image)
d.ellipse((20, 20, 160, 160), fill=(255, 255, 255))
# colour (155,0,0) will be transparent
image.save("imatge_png24a.png", format='png', transparency=(155,0,0))PNG32 gradual transparency PNG image data, 320 x 180, 8-bit/color RGBA, non-interlaced Vermell, Verd, Blau, Alfa ... -compose copy-opacity -composite PNG32:image_png32.png- Imatge -> Mode -> RGB
- Capes -> Transparència -> Afegeix canal alfa
# pip install pillow
from PIL import Image, ImageDraw
image = Image.new('RGBA', size=(320, 180), color=(155, 0, 0, 128))
d = ImageDraw.Draw(image)
d.ellipse((20, 20, 160, 160), fill=(255, 255, 255))
image.save("imatge_png32.png", format='png')Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
75HTML parsing#
- xq
- see also: jq (json), yq (yaml)
- using Xpath
expressions
- xq -x ...
- using CSS
selector
- extract head section
xq -n -q 'head' toto.html
- extract attribute type from link in head:
xq -q 'head > link' --attr type toto.html
- extract from id=table: every first td and first a from
forth td
xq -n -q '.table > tbody > tr > td:nth-child(1), td:nth-child(4) > a:nth-child(2)' reports.html
- extract head section
- Python
-
- BeautifulSoup 4
-
urpmi python-beautifulsoup4- Documentation
from bs4 import BeautifulSoup- Problemes / Problems
-
- BeautifulSoup return unexpected extra spaces
-
- Solució / Solution
-
- ...
- using beautifulsoup 4 for xml causes strange behaviour (memory issues?)
- Solució / Solution
-
- don't use (implicit) lxml parser; use "html.parser" or "html5lib" instead:
-
soup = BeautifulSoup(open("www.html"),"html.parser")- html5lib
-
easy_install html5libsoup = BeautifulSoup(open("www.html"),"html5lib")
- BeautifulSoup 3
-
urpmi python-beautifulsoupimport BeautifulSoup # To get everything
from BeautifulSoup import BeautifulSoup # For processing HTML
import urllib
url="http://xxx/toto.html"
txt = urllib.urlopen(url).read() #Pull in the url
soup = BeautifulSoup(txt)
allTags = soup.findAll('h3')
for node in allTags:
print node.string
- PHP
76Expresions regulars / Regular expressions#
- Perl regular expressions
- Regular expressions in bash
- Regular expression (wp)
- Regular Expression Flavor Comparison
- Online regex tester and debugger: PHP, PCRE, Python and JavaScript (101)
- Python regular expressions
- Literal character
- Exemples / Examples
-
- awk
- Java
- Parsing URLs
-
- RFC 3986 Appendix B
- Faster and cleaner way to parse Parameters from URL in javascript/jQuery?
-
- http://usuari:contrasenya@example.com:8080/path/to/file;parameters?a=b&c=d#section
^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$-
example
RFC 3986 regex
regular expression
regexp group name
javascript: location.
Python urllib.parse
bash
^
^
http:
(([^:/?#]+):)?
(?:([^:/?#.]+):)?protocol protocol (includes ":")
scheme
scheme=${url%//*}
(?:
//usuari
(//([^/?#]*))?
//(?:([^/?#]*)@)?user
netloc
username
url_wo_scheme=${url#*//}
domain=${url_wo_scheme%%/*}
:contrasenya@
password
example.com
([\\w\\d\\-\\u0100-\\uffff.%]*)hostname hostname
host
hostname
:8080
(?::([0-9]+))?port
port
)?
/path/to/file
([^?#]*)
([^?#]+)?pathname pathname
path
path=${url_wo_scheme##$domain}
;parameters
params
?a=b&c=d
(\?([^#]*))?
(?:\\?([^#]*))?search search
query
#section
(#(.*))?
(?:#(.*))?hash hash
fragment
$$
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- dvbsnoop
- Character classes
[abc]
any one character between brackets
[^abc]
any one character not between brackets .
any character except newline
\w
word character
\W
non word character \s
whitespace character
\S
non whitespace character \d
digit
\D
non digit
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Anchors
-
-
^
beginning
$
end
\b
\B
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
- Repetition (specified aftter the character)
-
-
0
1
more
?
*
+
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
n
more
m
{n}
{n,}
{n,m}
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
??
non-greedy (stops at first occurrence)
*?+?
{}?Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
- Grouping
(...)
all characters in specified order must match. Use (?:...)if you only want to match a group of characters but you do not want to keep them
|
separator between groups of characters. E.g.: (dev|pre|pro)
\n
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Extended regular expressions (Regex
lookahead, lookbehind and atomic groups)
(?#...)
(?:...)matches, but does not return the content ("...")
(?=...)positive lookahead
(?!...)negative lookahead
grep -P 'echo.*date(?!.*log_path)' toto.sh(?<=...)positive lookbehind
(?<!...)negative lookbehind
(?>...)atomic group
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- bash
my_regex="...(...)..."
if [[ $my_text =~ $my_regex ]]
then
first_group="${BASH_REMATCH[1]}"
fi
77Substitució / Replacement#
- variables
- sed
- tr: substitució de caràcters individuals -> caràcters individuals / replacement of individual characters -> individual characters:
- sponge
- kfilereplace (KDE)
-
- Filter: *.html (don't use the default settings: multiple filter does not work)
- canvi de nom de fitxers / file name change
-
- How to Bulk Rename Files in Linux (Terminal or GUI)
-
- rename.pl 's/ /_/g' *
- Replacing the space with an underscore in filenames
rename ' ' '_' *- renameutils
- gprenamer
- krename (gui)
- gwenrename (gui)
- thunar
78Base64#
| bash | openssl | Python | Javascript | ||
|---|---|---|---|---|---|
| encoding | non url safe | echo -n "toto" | base64 |
echo -n "toto" | openssl enc -base64 |
base64.b64encode(b"toto") |
|
| url safe | echo -n "toto" | base64 | tr '+' '-' | tr '/' '_' |
echo -n "toto" | openssl enc -base64 | tr '-_' '+/' |
base64.urlsafe_b64encode(b"toto") |
||
| decoding | non url safe | echo -n "dG90bw==" | base64 -d |
base64.b64decode(b"dG90bw==") |
||
| url safe | echo -n "dG90bw==" | tr '-' '+' | tr '_' '/' |
base64 -d |
base64.urlsafe_b64decode(b"dG90bw==") |
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- ...
79Tasques / Tasks#
80Data / Date#
- General
-
- ISO 8601 (wp)
- Data en Linux /
Date in Linux
- date (shell command)
- Dates a C/C++
- Dates a Javascript
- NTP
- Data en Python / Date in Python
- datefudge (fake the system date)
81Telnet#
- See also: nc / netcat
- Instal·lació / Installation
-
- Mageia
-
urpmi netkit-telnet
- CentOS
-
sudo yum install telnet
- Utilització / Usage
-
- escape characters:
-
- ^] = Ctrl+]
- ^@ = Ctrl+@
- Exemple / Example: RadioDNS
- Automate interactive session
-
- Automating telnet session using bash scripts
-
- /usr/bin/expect
-
urpmi expect expect-examples-
- /usr/share/doc/expect-examples/
- telnet.sh
-
#!/usr/bin/expect
set timeout 20
set hostName [lindex $argv 0]
set port [lindex $argv 1]
set password [lindex $argv 2]
spawn telnet $hostName $port
expect "Password:"
send "$password\r";
send "...\r";
sleep 2
send "logout\r";
telnet.sh host_name port password
{echo "command1"; echo "command2"; sleep 2; } | telnet localhost 4212
82OpenSSH#
- Instal·lació / Installation
-
-
server
client
installation
service firewall
CentOS
yum install openssh-serversystemctl [enable,start,status,stop] sshd.service
Cygwin
Mageia dnf install openssh-serversystemctl [enable,start,status,stop] sshd.service/etc/shorewall/rules.drakx
ACCEPT net fw tcp 22 -
Ubuntu sudo apt-get install openssh-server
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
-
- Default port: 22
- Especificació dels usuaris autoritzats / Specify allowed users (Step 5):
-
- /etc/ssh/ssh_config
-
- AllowUsers ...
- Change port (from default 22 to 10022)
-
- server
-
- sshd
-
/etc/ssh/sshd_config-
- Port 10022
- sshd-xinetd
-
/etc/xinetd.d/sshd-xinetd-
- port = 10022
- obrir el port 10022 al tallafoc
- client
-
ssh -p 10022 username@server
- Muntatge d'un sistema de fitxers remot en un directori local / Mount remote filesystem in a local directory:
-
urpmi sshfs-fusemkdir /mnt/local_dir/sshfs remote_user@remote_address:/remote_dir /mnt/local_dir/ -o uid=local_user_numerical_id -o gid=local_group_numerical_id
- Cyphers
- SSH:
How to disable weak ciphers?
sshd -T | grep ciphers | sed -e "s/\(3des-cbc\|aes128-cbc\|aes192-cbc\|aes256-cbc\|arcfour\|arcfour128\|arcfour256\|blowfish-cbc\|cast128-cbc\|rijndael-cbc@lysator.liu.se\)\,\?//g" >>/etc/ssh/sshd_config- echo "ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com" >>/etc/ssh/sshd_config
- SSH:
How to disable weak ciphers?
- OpenSSL
- Parell de claus / Key pairs:
storage
generation server
client
server pair
(ssh-server) /etc/ssh/ssh_host_rsa_key
~/.ssh/known_hosts
[client pair] ssh-keygen via ssh-copy-id:
- ~username/.ssh/authorized_keys
- ~/.ssh/id_rsa
- any other location specified by
ssh-keygen -f filename
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Autenticació sense contrasenya / Password-less authentication (optional):
-
- server:
-
- install ssh server
- /etc/ssh/sshd_config
-
PubkeyAuthentication yes# only pair of keys is allowed:
PasswordAuthentication no
- setup from client:
-
- if you do not have the pair of keys, generate them:
ssh-keygen -t rsa -C id_for_remote_server_name -f ~/.ssh/keys/id_for_remote_server_name.pem- this will generate:
~/.ssh/keys/id_for_remote_server_name.pem~/.ssh/keys/id_for_remote_server_name.pem.pub
- this will generate:
- if you generared the pair with openssl (
remote_server.pem), extract the public key and convert it to pub (PKCS8) format (id_rsa_remote_server.pub): -
openssl rsa -in remote_server_name.pem -out remote_server_name.public.pem -outform PEM -puboutssh-keygen -i -f remote_server_name.public.pem -m PKCS8 > id_rsa_remote_server_name.pub
- if you do not have the pair of keys, generate them:
-
-
- copy the public part (
id_for_remote_server_name.pem.pub) to the remote server. Use one of the following:- Option A:
- on remote server, enable password
authentication:
- /etc/ssh/sshd_config
PasswordAuthentication yes
- sshd in Ubuntu:
- /etc/ssh/sshd_config.d/50-cloud-init.conf
/etc/ssh/sshd_config.d/60-cloudimg-settings.conf (AWS EC2)PasswordAuthentication yes
- /etc/ssh/sshd_config.d/50-cloud-init.conf
- sudo systemctl restart sshd.service
- /etc/ssh/sshd_config
- on local server:
ssh-copy-id -i ~/.ssh/keys/id_for_remote_server_name.pem.pub myremoteusername@remoteserver- Problemes / Problems
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.myremoteusername@remoteserver: Permission denied (publickey).- see sshd in AWS EC2 Ubuntu
- to be able to copy cert using
password, it should be:
debug1: Authentications that can continue: publickey, password
- review logs in server:
sudo journalctl -xeAuthorizedKeysCommand /usr/share/ec2-instance-connect/eic_run_authorized_keys myremoteusername SHA256:xxx failed, status 22
- on remote server, disable password
authentication:
- /etc/ssh/sshd_config
PasswordAuthentication no
- sudo systemctl restart sshd.service
- /etc/ssh/sshd_config
- on remote server, enable password
authentication:
- Option B:
- from remote server, manually paste the content
of
remote_server_name.pem.pubto the authorized keys file of the user you will use in further ssh connections:- /home/myuser/.ssh/authorized_keys
ssh-rsa ... id_for_remote_server_name
- /home/myuser/.ssh/authorized_keys
- from remote server, manually paste the content
of
- Option A:
- this will create a line in the remotehost file
~username/.ssh/authorized_keys, with the following content: -
ssh-rsa AAA... id_for_remote_server_name- but it can be completed as (SSH configuration tricks):
-
command="program" ssh-dsa AAAABtce9euch… user@example.com
- copy the public part (
- connection from client:
-
- connexió al servidor utilitzant la clau privada / connection to the server using the private key:
-
ssh -i ~/.ssh/keys/id_for_remote_server_name.pemusername@remoteserver- or, if you generated your key pair with openssl:
-
ssh -i ~/.ssh/keys/remoteserver.pemusername@remoteserver
- per a evitar l'opció -i , i no haver de posar username / to avoid -i option and specification of username:
-
- ~/.ssh/config
-
Host etiqueta_remoteserver
HostNameremoteserver
Userusername
IdentityFile ~/.ssh/id_rsa_remoteserver
chmod 600 ~/.ssh/config(si altres usuaris tenent permisos, ssh no funcionarà / if others than user have write permissions, ssh will not work)sshetiqueta_remoteserver
- timeout
-
ssh -o ConnectTimeout=6000 ...
- execució remota / remote execution:
-
- usuari
-
sshusername@remoteserver my_commandsshusername@remoteserver'bash -s' < local_script.sh
- root / sudo
(to avoid error:
sudo: sorry, you must have a tty to run sudo) -
sshusername@remoteserver -t 'sudo my_command'- alternatively, configure sudoers file on remote server
- copy file from remote to local
-
scp -i ~/.ssh/keys/parell_claus.pem usuari@adreca_ip:/tmp/remote_file .
- Tanca la sessió / End session
-
Enter + ~ + .
- Mantenir la sessió oberta (alguns encaminadors desconnecten les sessions inactives al cap d'uns minuts) / Keep the session open (some routers disconnect inactive sessions after some minutes)
-
- How to prevent Linux SSH client from disconnecting using ServerAliveInterval
- Use one of the following solutions
-
- On server
-
- /etc/ssh/sshd_config
-
# send a keepalive signal every 120 seconds
ClientAliveInterval 120
- On client
-
- /etc/ssh/ssh_config
-
# send a keepalive signal every 120 seconds
ServerAliveInterval 120
- Problemes / Problems
- "sign_and_send_pubkey:
no mutual signature supported", "no mutual
signature algorithm"
- SSH-RSA key rejected with message "no mutual signature algorithm"
- OpenSSH
8.2
- Future deprecation notice
- Bye bye RSA keys?
- Why are rsa-sha2-512 and rsa-sha2-256 supported but not reported by ssh -Q key?
- Fast and dirty solution
- one-time:
ssh -o PubkeyAcceptedKeyTypes=+ssh-rsa ...
- permanently: from your local computer,
allow connections with old rsa-sha (IMPORTANT:
bad idea):
sudoecho "PubkeyAcceptedKeyTypes +ssh-rsa" >/etc/ssh/ssh_config.d/60-allow_ssh-rsa.conf
- one-time:
- Solution
- use other signature algorithms
The authenticity of host 'x.x.x.x (x.x.x.x)' can't be established.
[...]
Are you sure you want to continue connecting (yes/no)?WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.-
- Solució / Solution
ssh-keygen [-f ~/.ssh/known_hosts] -R remote_ip_address_with_problemsssh-keygen -R remote_ip_address_with_problems
- Solució / Solution
- "sign_and_send_pubkey:
no mutual signature supported", "no mutual
signature algorithm"
- Control version with SSH
-
- Subversion with SSH
- Bitbucket / GitLab (git) with SSH
-
- Use the SSH protocol with Bitbucket Cloud
- Set up SSH for Git and Mercurial on Mac OSX/Linux
- Configure multiple SSH identities for GitBash, Mac OSX, & Linux
- Simple setup
-
- Create a key pair (or get the one generated by e.g. weblate)
-
ssh-keygen -f ~/.ssh/keys/gitlab-user_i-id_from_work -t ed25519
- ~/.ssh/config
-
# GitLab.com server
Host gitlab.com
RSAAuthentication yes
IdentityFile ~/.ssh/keys/gitlab-user_i-id_from_work
git clone git@gitlab.com:accountname_i/repo_a.git
- Complete setup
-
-
identity
Bitbucket account / GitLab user
git remote name
.ssh/config account account can access to repositories
each identity has a key pair;
an identity replaces accountname/password, and must be unique in Bitbucket/GitLab;
an account can have several identitiesmust register the identity keys non-own repositories (e.g. a team) must grant permissions to the account, but should not register key pairs
bitbucket-account_i-id_from_home
Host bb-aci-id1
HostName bitbucket.org
IdentityFile ~/.ssh/keys/bitbucket-account_i-id_from_homeaccountname_iaccountname_i/repo_a.gitaccountname_j/repo_d.gitteamname_k/repo_m.git
git@bb-aci-id1:accountname_i/repo_a.gitgit@bb-aci-id1:accountname_j/repo_d.gitgit@bb-aci-id1:teamname_k/repo_m.git
bitbucket-account_i-id_from_work Host bb-aci-id2
HostName bitbucket.org
IdentityFile ~/.ssh/keys/bitbucket-account_i-id_from_workgit@bb-aci-id2:accountname_i/repo_a.gitgit@bb-aci-id2:accountname_j/repo_d.gitgit@bb-aci-id2:teamname_k/repo_m.gitbitbucket-account_ii-id_from_home Host bb-0acii-id1
HostName bitbucket.org
IdentityFile ~/.ssh/keys/bitbucket-account_ii-id_from_homeaccountname_iiaccountname_ii/repo_b.gitaccountname_jj/repo_e.gitteamname_kk/repo_n.gitgit@bb-acii-id1:accountname_ii/repo_b.gitgit@bb-acii-id1:accountname_jj/repo_e.gitgit@bb-acii-id1:teamname_kk/repo_n.gitbitbucket-account_ii-id_from_production_server Host bb-acii-id2
HostName bitbucket.org
IdentityFile ~/.ssh/keys/bitbucket-account_ii-id_from_production_servergit@bb-acii-id2:accountname_ii/repo_b.gitgit@bb-acii-id2:accountname_jj/repo_e.gitgit@bb-acii-id2:teamname_kk/repo_m.gitAquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Steps
-
- Create
key pairs (maybe several for each account
in Bitbucket; you don't need to create a key
pair to access to a team account: just use one
of your key pair):
- Bitbucket
-
ssh-keygen -f ~/.ssh/keys/bitbucket-account_i-id_from_home-t ed25519-C "Bitbucket: identity to login asaccountname_i, from home"ssh-keygen -f ~/.ssh/keys/bitbucket-account_i-id_from_work-t ed25519-C "Bitbucket: identityto login asaccountname_i, from work"ssh-keygen -f ~/.ssh/keys/bitbucket-account_ii-id_from_home-t ed25519-C "Bitbucket: identity to login asaccountname_ii, from home"ssh-keygen -f ~/.ssh/keys/bitbucket-account_ii-id_from_production_server-t ed25519-C "Bitbucket: identityto login asaccountname_ii, from work"
- GitHub
ssh-keygen-f gitlab-account_i-id_from_home-t ed25519 -C "your_email@example.com"ssh-keygen-f gitlab-account_i-id_from_home-t rsa -b 4096 -C "your_email@example.com"
- GitLab
-
ssh-keygen -f gitlab-account_i-id_from_home -t ed25519 -C "user@example.org" -b 4096- ...
- ~/.ssh/config
- Bitbucket
-
Host bb-aci-id1
HostName bitbucket.org
IdentityFile ~/.ssh/keys/bitbucket-account_i-id_from_home
Host bb-aci-id2
HostName bitbucket.org
IdentityFile ~/.ssh/keys/bitbucket-account_i-id_from_workHost bb-acii-id1
HostName bitbucket.org
IdentityFile ~/.ssh/keys/bitbucket-account_ii-id_from_home
Host bb-acii-id2
HostName bitbucket.org
IdentityFile ~/.ssh/keys/bitbucket-account_ii-id_from_production_server
- GitHub
Host gh-aci-id1
HostName github.com
IdentityFile~/.ssh/keys/github-account_i-id_from_homeHost gh-aci-id2
HostName github.com
IdentityFile~/.ssh/keys/github-account_i-id_from_work
- GitLab
-
Host gl-aci-id1
HostName gitlab.com
IdentityFile ~/.ssh/keys/gitlab-account_i-id_from_homeHost gl-aci-id2
HostName gitlab.com
IdentityFile~/.ssh/keys/gitlab-account_i-id_from_work- ...
- Add public keys to accounts:
- Bitbucket (web interface Settings: SECURITY / SSH Keys):
-
xclip -selection clipboard < ~/.ssh/keys/...:-
- into accountname_i:
-
bitbucket-account_i-id_from_home.pubbitbucket-account_i-id_from_work.pub
- into accountname_ii:
-
bitbucket-account_ii-id_from_home.pubbitbucket-account_ii-id_from_production_server.pub
- GitHub
- User -> Settings -> SSH and PGP keys
- Title:
github-account_i-id_from_home - Key: (
xclip -selection clipboard < ~/.ssh/keys/github-account_i-id_from_home.pub)
- GitLab (Group -> Members)
-
- Profile settings -> SSH Keys
xclip -selection clipboard < ~/.ssh/keys/gitlab-account_i-id_from_home.pub-
- into accountname_i:
-
gitlab-account_i-id_from_home.pubgitlab-account_i-id_from_work.pub
- into accountname_ii:
gitlab-account_ii-id_from_home.pubgitlab-account_ii-id_from_work.pub
- Clone repo:
git clone git@gl-aci-id1:accountname_i/repo_a.git
- Change repository configuration
- ~/src/repo_a/.git/config
-
url = git@bb-aci-id1:accountname_i/repo_a.git
- ~/src/repo_b/.git/config
-
url = git@bb-acii-id1:accountname_ii/repo_b.git
- Create
key pairs (maybe several for each account
in Bitbucket; you don't need to create a key
pair to access to a team account: just use one
of your key pair):
-
- Shh! OpenSSH Secrets Here
-
- Password-less SSH logins
- ssh-agent (ssh password caching)
-
- X11 forwarding (abans
DISPLAY/ fomerlyDISPLAY) -
- How to forward X over SSH from Ubuntu machine?
- servidor ssh / ssh server (remote)
-
- CentOS
-
sudo yum install xorg-x11-xauth
- /etc/ssh/sshd_config
-
X11Forwarding yes
- client ssh (local)
-
ssh -X nom_servidor_ssh- No cal establir la variable d'entorn
DISPLAY/ No need to specify environment variableDISPLAY - Resolució de problemes / Problem resolution
-
- al servidor / in server
-
ssh -X nom_servidor_sshX11 forwarding request failed on channel 0- Solució / Solution
ssh -v -X nom_servidor_ssh-
debug1: Requesting X11 forwarding with authentication spoofing.
debug1: Remote: No xauth program; cannot forward with spoofing.
- Install xauth:
- CentOS
sudo yum install xorg-x11-xauth
- CentOS
- al client / in client
-
- (run a program with gui, e.g. xterm)
-
X11 forwarding is disabled to avoid man-in-the-middle attacks.- Solució / Solution
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast-
- Solució / Solution
-
export LIBGL_DEBUG=verbose; xterm-
libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
...
- CentOS
-
sudo yum provides/usr/lib64/dri/tls/swrast_dri.sosudo yum install mesa-dri-drivers
- Redireccionament
d'àudio / Audio forwarding
- How to carry audio over SSH?
- PulseAudio
- PulseAudio over network
- Network audio with PulseAudio made (somewhat) easy
- X11 forwarding over SSH & Pulseaudio
-
local sink (has audio hardware)
remote source (does not have audio hardware)
dependencies
sudo urpmi ...
- sudo yum install pulseaudio-utils
- if you are going to use gstreamer, it must
contain pulseaudio:
- gst-inspect-1.0 | grep pulse
configure PulseAudio (/etc/pulse/default.pa)
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24 auth-anonymous=1
restart PulseAudio systemctl --user restart pulseaudio.socket pulseaudio.service
check that tcp module is loaded
pacmd list-modules | grep module-native-protocol-tcp
set PulseAudio remote server pax11publish -e -S <sink_ip_address>
connect to remote
ssh -X <remote_user>@<remote_source_ip_address>
check audio server
- pavucontrol (urpmi pavucontrol)
- xprop -root PULSE_SERVER (yum install
xorg-x11-utils)
- <sink_ip_address>
- pavucontrol (yum install pavucontrol)
play file containing audio
- ffplay ...
- gst-launch-1.0 -v audiotestsrc wave=5 ! audioconvert ! volume volume=0.2 ! pulsesink
- gst-launch-1.0 playbin uri=file:/path/to/bbb.mp4
- mplayer ...
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- NOTE: if using VirtualBox, do not activate audio device in remote virtual machine
- (needed?) al servidor / on server
paprefs- Servidor de xarxa: Habilita l'accés a la xarxa
per als dispositius de so locals
- sembla que no funciona; editeu
/etc/pulse/default.pa i afegiu-hi:
load-module module-native-protocol-tcp auth-ip-acl...
- sembla que no funciona; editeu
/etc/pulse/default.pa i afegiu-hi:
- Servidor de xarxa: Habilita l'accés a la xarxa
per als dispositius de so locals
- Enabling audio in VirtualBox and using Alsa (has lipsync
issues)
- al client / on client (vm)
- CentOS
sudo yum install alsa-utils alsa-firmware alsa-lib alsa-oss
sudo usermod -a -G audio my_user_in_vmalsamixer- increase volume
- CentOS
- al client / on client (vm)
- LDAP
- Problemes / Problems
-
- See also: problems with OpenVPN
- SSH Frequently Asked Questions
- SSH session gets clogged/stuck
- Prevent your SSH connection from freezing
- Solució / Solution
-
- proveu la WiFi en lloc d'ethernet
- MTU
-
- ...
83Logs#
- syslog
-
- logger and syslog
- Exemples / Examples
logrotate-
- A Complete Guide to Managing Log Files with Logrotate
- HowTo: The Ultimate Logrotate Command Tutorial with 10 Examples
- General:
-
/etc/logrotate.conf-
size 100k
- For a given program (e.g. celery):
-
- /etc/logrotate.d/celery
-
/var/log/celery/*log {
daily
rotate 10
size 5M
compress
maxage 30
}
- run, with verbose
sudo logrotate -v /etc/logrotate.d/celery
- only debug (dry-run)
sudo logrotate -d /etc/logrotate.d/celery
- force
sudo logrotate -f /etc/logrotate.d/celery
- If using SELinux:
-
sudo chcon -u system_u -t etc_t /etc/logrotate.d/celery
- debug
- Debugging Logrotate problems
sudo cat /var/lib/logrotate/status
- Options
- ...
group directive description default
(logrotate.conf)mode create [<permissions> <user> <group>]create new (empty) log files after rotating old ones.
renaming a log file (say myapp.log) to myapp.log.1, before creating a new myapp.log file will be created to continue loggingcreatecopytruncatethe myapp.log file is copied to a new myapp.log.1 file, then the original file is emptied (truncated), allowing the application to continue writing to it as if it were a new file. This mode is useful if your application or process does not handle log file rotation gracefully by automatically switching to the new log file after rotation
compress
#compress
dateextuse date as a suffix of the rotated file #dateext
include <dir>packages drop log rotation information into this directory include /etc/logrotate.d
rotate <number>log files are rotated <number> times before old ones are removed rotate 4
su <user> <group>log rotation is performed with the <user> and <group> su root admcondition
daily
weekly
...
weeklysize <size>logrotate will trigger rotation when log file reaches <size> in size.
Once the size threshold is crossed, rotation will be initiated regardless of the time schedule (e.g. daily).
minsize <size>rotation will not occur until the file reaches a minimum of <size> even if the time schedule (e.g. daily) is met
maxsize <size>specifies that the log files are rotated once they exceed the stated file size, even when the time interval has not yet been reached
missingokcontinue log rotation without reporting any error if any of the specified log files are missing
notifemptyensures that log files are not rotated if they are empty. If a log file is empty, it won't trigger rotation
delaycompressdelays compression of the rotated log files until the next rotation cycle
sharedscriptsensures that the commands or scripts specified in the prerotate or postrotate
directive are executed only once, regardless of the number of log files being rotated
postrotate
endscriptencloses the commands or scripts to be executed after log rotation
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- ...
- logtop
- logger (command interface to syslog)
-
- #! /bin/bash
logger ... - also to a file
-
- logger -s ...
- #! /bin/bash
- server
84Iomega NAS#
- Iomega Storage Manager
-
urpmi libjpeg62 libupnp3export LD_LIBRARY_PATH=/usr/bin/Iomega\ Storage\ Manager/lib/
85Xiaomi Band#
- Temes / Themes
- Descàrrega / Download
- Change
Mi Band 4 Theme!
- Download
- AmazfitBipTools_Mi4_0.0.2.zip
- WINEPREFIX=~/.win_32 WINEARCH=win32 wine
WatchFace.exe
- WatchFace.exe unpacks and packs Amazfit
Bip downloadable watch faces and resource
files.
Usage examples:
WatchFace.exe watchface.bin - unpacks watchface images and config
WatchFace.exe watchface.json - packs config and referenced images to bin file
WatchFace.exe mili_chaohu.res - unpacks resource file images
WatchFace.exe mili_chaohu - packs folder content to res file
- WatchFace.exe unpacks and packs Amazfit
Bip downloadable watch faces and resource
files.
- WINEPREFIX=~/.win_32 WINEARCH=win32 wine
WatchFace.exe
- template.bin
- AmazfitBipTools_Mi4_0.0.2.zip
- Passos / Steps
- Descarregueu-vos el fitxer de les utilitats:
- si no el teniu, creeu un directori:
mkdir ~/src - des del navegador, aneu a: https://fwd.duc1607.ooo/mi-band-4-theme, i descarregueu-vos AmazfitBipTools_Mi4_0.0.2.zip a ~/src
- aneu al directori on l'heu desat i
descomprimiu-lo:
cd ~/src
unzip AmazfitBipTools_Mi4_0.0.2.zipcd AmazfitBipTools_Mi4_0.0.2
- si no el teniu, creeu un directori:
- Descarregueu-vos
un fitxer .bin que servirà com a base (p.ex. mario_odyssey_06-37039-e65bd5a5ee.bin),
a ~/src/
AmazfitBipTools_Mi4_0.0.2/mario_odyssey_06-37039-e65bd5a5ee.bin - Descomprimiu-lo:
WINEPREFIX=~/.win_32 WINEARCH=win32 wine WatchFace.exe mario_odyssey_06-37039-e65bd5a5ee.bin
- Aneu a la nova carpeta
mario_odyssey_06-37039-e65bd5a5ee:
cd mario_odyssey_06-37039-e65bd5a5ee
- Modifiqueu les imatges que vulgueu, per exemple la
imatge de fons, 0000.png (PNG image data,
8-bit/color RGBA, non-interlaced)
- Gimp
- Fitxer / Obre...
- la nova imatge que voleu posar al rellotge
- Imatge / Escala la imatge...
- Amplada: 120
- Alçada: 240
- Resolució X: 96 píxels/in
- Resolució Y: 96 píxels/in
- Capa / Transparència / Afegeix canal alfa
- Imatge / Mode / Indexat
- Fitxer / Exporta com a...
- 0000.png
- Fitxer / Obre...
- Dimensions
- Background: 120x240
- ...
- Gimp
- Opcionalment, modifiqueu el fitxer json: ~/src/AmazfitBipTools_Mi4_0.0.2/mario_odyssey_06-37039-e65bd5a5ee/mario_odyssey_06-37039-e65bd5a5ee.json
- Empaqueteu de nou el directori:
cd ~/src/AmazfitBipTools_Mi4_0.0.2WINEPREFIX=~/.win_32 WINEARCH=win32 wine WatchFace.exe mario_odyssey_06-37039-e65bd5a5ee/mario_odyssey_06-37039-e65bd5a5ee.json- us generarà un nou fitxer:
mario_odyssey_06-37039-e65bd5a5ee/mario_odyssey_06-37039-e65bd5a5ee_packed.bin
- Connecteu el telèfon Android a l'ordinador, amb un cable USB (haureu de donar permís des del telèfon a la connexió per USB per a desenvolupadors)
- Trobeu quin directori de l'aplicació MiFit voldreu
sobreescriure amb el nou bin, fent servir l'eina
adb:~/Android/Sdk/platform-tools/adb devices
~/Android/Sdk/platform-tools/adb shellcd/storage/sdcard0/Android/data/com.xiaomi.hm.health/files/watch_skin_local/ls -l- trieu algun d'aquests directoris, per
exemple:
mrrfZikKuBb7MXFrNKu8VyHE0lLXKRcnO0xCyJ0w
- trieu algun d'aquests directoris, per
exemple:
exit
- Poseu aquest fitxer, fent servir ADB, dins d'un
directori de MiFit al vostre dispositiu
Android (
/storage/sdcard0/Android/data/com.xiaomi.hm.health/files/watch_skin_local/):- cd
~/src/AmazfitBipTools_Mi4_0.0.2/mario_odyssey_06-37039-e65bd5a5ee
~/Android/Sdk/platform-tools/adb pushmario_odyssey_06-37039-e65bd5a5ee_packed.bin/storage/sdcard0/Android/data/com.xiaomi.hm.health/files/watch_skin_local/mrrfZikKuBb7MXFrNKu8VyHE0lLXKRcnO0xCyJ0w
- cd
- Des de MiFit, instal·leu el tema com faríeu habitualment
- ...
- Descarregueu-vos el fitxer de les utilitats:
- Download
- amazfitbip/tools
86TimeTracker#
- User guide
- Installation (Installation instuctions, Upgrade instructions, Ubuntu installation)
-
- Dependencies
-
- Install MySQL and set the root password
urpmi task-lamp-phpurpmi apache-mod_php php-pear php-pear-DB php-mbstring [php-smarty php-mysql php-pear-MDB2_Driver_mysql]
- download:
unzip -d /var/www anuko_time_tracker.zip- Information about version, changelog, troubleshooting:
-
- timetracker/readme.txt
chmod 777 WEB-INF/templates_c- Configure Timetracker:
-
cd /var/www/timetracker/WEB-INF/; cp config.php.dist config.php- /var/www/timetracker/WEB-INF/config.php
-
define("DSN",'mysql://tt_user:tt_password@localhost/timetracker');define("APP_NAME",'timetracker');define('MAIL_SMTP_HOST', 'smtp.your_server.com');
- Configure Apache (may not be needed for Ubuntu):
-
- /etc/httpd/conf/webapps.d/timetracker.conf
-
Alias /timetracker /var/www/timetracker
<Directory "/var/www/timetracker">
Order allow,deny
Allow from All
</Directory>
- /etc/httpd/conf/httpd.conf
-
<Directory "/var/www/timetracker">
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
- For a first time installation:
-
mysql -u root -p-
CREATE DATABASE timetracker;GRANT ALL ON timetracker.* TO 'tt_user'@'localhost' IDENTIFIED BY 'tt_password';FLUSH PRIVILEGES;exit;
mysql -u root -p -D timetracker < mysql.sql- Check that database is working
-
mysql -u tt_user -p-
- > password:
tt_password > use timetracker;> show tables;
- > password:
- http://localhost/timetracker/dbinstall.php
-
- Create
- For an upgrade (and restore from backup):
-
mysql -u root -p-
GRANT ALL ON timetracker.* TO 'tt_user'@'localhost' IDENTIFIED BY 'tt_password';FLUSH PRIVILEGES;exit;
mysql -v -v -v -u root -p < backup_timetracker.sql- Check that database is working
-
mysql -u tt_user -p-
- > password:
tt_password > use timetracker;> show tables;
- > password:
- http://localhost/timetracker/dbinstall.php
-
- Update:
-
- sequentially click all Update buttons, from your_old_version up to 1.3.3
- if you are not sure about what your_old_version is, click on ALL Update buttons, starting from the very first Update button
- Upgrade
- Timeout
-
- /etc/php.ini
-
- session.gc_maxlifetime=28800
- /usr/lib/php/maxlifetime (used in /etc/cron.d/php)
-
- max=28800
- Problems
-
- Activate PHP display errors
- Check readme.txt: BLANK PAGES IN ANUKO TIME TRACKER
- "The server encountered an internal error and was unable
to complete your request. Error message:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script." -
- Solution: check dependencies (urpmi)
87Kimai#
- Install
-
- urpmi php-pdo_mysql
- mysql -u root -p
-
- CREATE DATABASE kimaidb;
- /etc/httpd/conf/webapps.d/kimai.conf
-
- Alias /kimai /var/www/kimai_0.9.0.1082
<Directory "/var/www/kimai_0.9.0.1082">
Order allow,deny
Allow from All
</Directory>
- Alias /kimai /var/www/kimai_0.9.0.1082
- chown apache.apache -R /var/www/kimai_0.9.0.1082/compile
- chown apache.apache -R /var/www/kimai_0.9.0.1082/extensions
- chown apache.apache -R /var/www/kimai_0.9.0.1082/temporary
- open browser:
-
- http://localhost/kimai
- default user: admin/changeme
88Weblate#
- Descàrrega / Download
-
- git
- Quick setup guide
-
- Serving static files
- Weblate with GitLab as OAuth provider
- Django
- Dependències / Dependencies
-
- Mageia
-
urpmi ...
- CentOS
-
sudo yum install gcc libxml2-devel libxslt-devel libjpeg-devel
- Pip
-
virtualenv envsource env/bin/activatepip install psycopg2 uwsgipip install python-social-auth-
- to avoid error "
No module named social.apps.django_apps"
- to avoid error "
pip install -r requirements.txtpip install --upgrade pippip install -r requirements-optional.txt-
- Additional dependencies:
-
- for tesserocr
-
- CentOS
-
sudo yum install tesserocr-devel
- Download
-
git clone https://github.com/nijel/weblate.git
- Setup
-
cd weblatecp weblate/settings_example.py weblate/settings.py- settings.py
-
- ...
./manage.py migrate./manage.py createsuperuser./scripts/generate-locales-
- Problemes / Problems
-
*** Git <https://git-scm.com/> is too old! ***
Installed version 1.8.3.1, required 1.8.5-
- Solució / Solution
-
- Install a newer version of git (CentOS)
./manage.py runserver 0.0.0.0:8000
- Problemes / Problems
-
- Git conflicts
-
ssh ...cd /var/lib/weblate/data/vcs/<my_project>/<my_component>/sudo su djangogit status- Web GUI:
-
- (?) Rebase
- Fresh installation: ERROR: accounts.VerifiedEmail.social: (fields.E300) #1405
-
accounts.VerifiedEmail.social: (fields.E300) Field defines a relation with model 'UserSocialAuth', which is either not installed, or is abstract.
- Error 500
- When creating a component:
-
- admin:
-
fatal: There is no merge to abort (MERGE_HEAD missing). (128)
- /var/log/messages
-
ERROR my_project/my_component: failed merge on repo: fatal: ambiguous argument '@': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]' (128)-
- Produced by:
-
cdmy_project/my_componentgit log -n 1 --format=format:%H @- e.g. with CentOS and git 1.8.3.1
- working fine with git 2.7.4 (Mageia)
- Solution. One of the following
-
- upgrade git
sed -i "s/'log', '-n', '1', '--format=format:%H', '@'/'log', '-n', '1', '--format=format:%H', 'HEAD'/" weblate/weblate/trans/vcs.py
- (when debugging from Eclipse) OperationalError: no such table: trans_project
-
- Solution
-
- Do not use sqlite3
- "Android String Resource" not present in File Format list
-
- Solution
-
pip install Babel- also installed with:
pip install -r requirements-optional.txt
- Hierachical JSON files are flattened
-
- Weblate and i18next json files
-
- Solució / Solution
-
cd /var/lib/weblate/scripts/wget https://gist.githubusercontent.com/saily/f8a9f72c6b064d51f09040d66e981240/raw/5bcb059b5ff0339584745b7bfc707d6adc79e2a8/json_restore_hierarchychmod +x json_restore_hierarchy- settings.py
-
PRE_COMMIT_SCRIPTS = (
'/var/lib/weblate/scripts/json_restore_hierarchy',
)
sudo systemctl restart emperor.uwsgi.service- Admin -> Components -> MyComponent
-
- Pre-commit script:
json_restore_hierarchy
- Pre-commit script:
- Usage
-
- admin
-
- SSH (http://<weblate>/admin/ssh/)
-
- Public SSH key
-
- stored in .../weblate/data/ssh/
-
- id_rsa
- id_rsa.pub
- this is the id that will be used in git transactions; you need to add id_rsa.pub as a valid public key (identity) associated to your account in your git origin (e.g. GitLab)
- Server key
-
- stored in .../weblate/data/ssh/known-hosts
- Add server key: gitlab.com
- Project (http://<weblate>/admin/trans/)
-
- Component
-
- Repository URL:
git@gitlab.com:my_group/my_project.git - Push repository URL:
git@gitlab.com:my_group/my_project.git -
Django
Angular 2
Android
Source code repository:
git@gitlab.com:my_group/my_project.git
Repository push URL:
git@gitlab.com:my_group/my_project.git
Repository branch:
master
File mask:
locale/*/LC_MESSAGES/django.po
src/locale/messages.*.xlf
app/src/main/res/values-*/strings.xml
Monolingual base language file:
src/messages.xlf app/src/main/res/values/strings.xml
File format:
Gettext PO file
XLIFF translation file
Android String Resource
New translation:
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- Repository URL:
- Weblate and GitLab
89DNS server#
- Info
-
- ...
- Eines / Tools
- Prerequisites
-
- make sure the hostname contains a full name and domain
- Firewall
-
- port 53
- [port 953 for rndc]
-
- needed by OpenStack Designate
- Bind
-
- Installation
-
- Mageia
-
- Option 1: Mageia MCC
-
urpmi drakwizard- MCC: Serveis de xarxa -> Configura DNS
-
wizard action
wizard field affected
Servidor DNS mestre
DNS extern
/etc/resolv.conf: nameserver
nom de domini per a la cerca
/etc/resolv.conf: search
(domain guessed from hostname)
/etc/resolv.conf: domain
Afegeix ordinador al DNS
/var/lib/named/var/named/zone/db.your.domain.hostsAquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
# service named start
- Option 2: Config files
-
urpmi bind- /etc/named.conf
-
filereferences are relative to/var/lib/named/var/named/
- CentOS
- Configuration
-
- /etc/named.conf
-
zone "." IN {
type hint;
file "named.ca";
};
- caching-nameserver
-
- /etc/named.rfc1912.zones
-
zone "localhost" IN {
type master;
file "named.localhost";
allow-update { none; };
};
...
- /var/named/
-
- named.ca
- named.localhost
- ...
- rdnc
-
- Key generation:
-
dnssec-keygen -a hmac-md5 -b <bit-length> -n HOST <key-file-name>
- configuration
/etc/named.conf
/etc/rndc.conf key "rndc-key" {
algorithm hmac-md5;
secret "...";
};controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- command line options
-
rndc rndc -s 127.0.0.1 -p 953 addzone toto.org '{ type slave; masters { 127.0.0.1 port 5354;}; };'- Problems
-
- rndc: 'addzone' failed: permission denied
-
- check SELinux ([RESOLVED] bind-chroot rndc dumpdb fails when selinux is enf)
-
setsebool -P named_write_master_zones 1
- Check
90VPN#
- Servidor / Server
-
- OpenVPN
-
- HOWTO (openvn.net)
-
- Static Key Mini-HOWTO (using one static key) (one server + one client)
- Howto (using X509 PKI, bidirection authentication) (one server + several clients)
- Bridging and routing
- Secure Communications with OpenVPN on Debian 6 (Squeeze)
- OpenVPN (Ubuntu 12.04)
- Bridging and routing
- Mageia
-
urpmi openvpn(same package for client and server)/usr/share/openvpn/easy-rsa/2.0- configuration from MCC ?
- Problemes / Problems
-
- client-disconnect script at server is not executed
-
- Solució / Solution
-
- Disconnect reason within client-disconnect scope?
- make sure that the client has the following directive in the configuration file:
-
explicit-exit-notify
- Steps (static key)
- Steps (X509 PKI)
-
- Create CA, server and client certificates:
-
cp -pr /usr/share/openvpn/easy-rsa/2.0/* /etc/openvpncd /etc/openvpn. ./vars./clean-all./build-ca./build-key-server server./build-key client1./build-dh
- Copy the needed files to the server:
-
- ca.crt
- server.crt
- server.key
- Copy the needed files to the client:
-
- ca.crt
- client1.crt
- client1.key
- server.conf
-
cp /usr/share/openvpn/sample-config-files/server.conf /etc/openvpn/- certificates
-
ca ca.crtcert server.crtkey server.keydh dh1024.pem
- bridging option (you previoulsy need to make a bridge between tap and ethx)
-
server-bridge ...dev tap
- routing option
-
server ...dev tun
- Open port 1194 on the firewall
- Client
-
-
command setting file
vpn-start ... /etc/sysconfig/network-scripts/vpn.d/SSL openvpn nom_openvpn openvpn/nom_openvpn.conf IPSec vpnc nom_vpnc vpnc/nom_vpnc.conf Aquesta taula continua cap a la dreta — desplaça-la o gira el mòbil.
- MCC (Mageia)
-
- Xarxa i Internet -> Configura una connexió VPN per a l'accés a una xarxa segura
-
- Cisco VPN Concentrator
- OpenVPN
- vpn-start (part of initscripts package)
-
- openvpn (for connection to OpenVPN servers)
- vpnc (for connection to Cisco servers)
- PPTP
-
urpmi kvpn pptp-linux webminmodprobe -v ppp_mppe- Diagnosis HOWTO (PPTP Client)
- Trouble with MPPE
- Mageia: Bug 2894 - mppe support for pptp
-
urpmi.addmedia --wget --distrib MageiaLinux.ru-i586- http://packages.mageialinux.ru/mageia2/i586/urpmi vpnpptp-allde
- poptop: haciendo túneles VPN de Windows a Linux (o de Linux a Linux)
- https://localhost:10000
- (ln -s /sbin/ip /bin/ip)
- VPN (PPTP, i.e. microsoft) setup (nameserver issue)
- GRE support:
-
iptables -I FORWARD -p 45 -d xx.xx.xx.xx -j ACCEPT
- routes (one of the following):
-
route add -net xx.xx.xx.xx netmask 255.255.255.255 dev ppp0ip route add xx.xx.xx.xx/25 dev ppp0
- L2TP over IPsec (Cisco)
-
/etc/sysconfig/network-scripts/vpn.d/vpnc/nom_vpn_cisco.conf-
IPSec gateway x.x.x.x
IPSec ID nom_grup
IPSec secret contrasenya_grup
Xauth username nom_usuari
Xauth password contrasenya_usuari- Note: it may be necessary to put the same value on nom_grup and nom_usuari; contrasenya_grup and contrasenya_usuari
# vpn-start vpnc nom_vpn_cisco- it calls vpnc
- to debug:
-
/usr/sbin/vpnc /etc/sysconfig/network-scripts/vpn.d/vpnc/toto.conf --pid-file /var/run/vpnc-toto.pid --debug 2 --no-detach
- Problemes / Problems:
-
vpnc[xxxx]: HMAC mismatch in ESP mode-
- Solució / Solution
-
- use the latest svn version:
-
- urpmi libgnutls-devel lib64gcrypt-devel
- svn checkout http://svn.unix-ag.uni-kl.de/vpnc/trunk/ vpnc
- cd vpnc
- make
- # make install
- Solució / Solution
- OpenVPN (SSL)
-
urpmi openvpn/etc/sysconfig/network-scripts/vpn.d/openvpn/nom_openvpn.conf- client
remote myremote.example.org 443
capath /etc/pki/tls/rootcerts
auth-user-pass nom_openvpn.txt
ns-cert-type server
- client
/etc/sysconfig/network-scripts/vpn.d/openvpn/nom_openvpn.txt- myname
mypassword
- myname
chmod 400 /etc/sysconfig/network-scripts/vpn.d/openvpn/credentials.txt# vpn-start openvpn nom_openvpn- it calls openvpn
- to debug:
openvpn --config /etc/sysconfig/network-scripts/vpn.d/openvpn/nom_openvpn.conf ...
- Problemes / Problems
-
- Troubleshooting Connection Problems
- MTU
-
- vegeu també / see also: ssh problems
- MTU, Partial Loss of Internet Connection, and Performance (Netgear)
- PPP + SSL
- openfortivpn
- Instal·lació des de codi font / Installation from
source code
- Dependències / Dependencies
- Mageia
sudo urpmi git gcc automake autoconf openssl-devel make pkg-config ppp
- Mageia
- Passos / Steps
cd ~srcgit clone https://github.com/adrienverge/openfortivpn.gitcd openfortivpn
./autogen.sh./configure --sysconfdir=/etcmakesudo make install
- Dependències / Dependencies
- Ús / Usage
- sense fitxer de configuració
openfortivpn -v vpn-gateway:10443 --username=foo --password=bar --trusted-cert xxx
- amb fitxer de configuració
- /etc/openfortivpn/myconfig
host = vpn-gateway
port = 10443
username = foo
password = bar
# the value of xxx will be given as an advice the first time you run openfortivpn without it
trusted-cert = xxx
openfortivpn -v -c /etc/openfortivpn/myconfig
- /etc/openfortivpn/myconfig
- sense fitxer de configuració
- Problemes / Problems
- no es troben les pàgines web (perquè es fa
servir el servidor DNS habitual, i no el nou,
subministrat pel servidor VPN)
- Solució / Solution
- cal obrir el navegador després d'haver establert la VPN; no abans
- cal canviar l'ordre en l'escriptura al
fitxer /etc/resolv.conf, per a donar
preferència als nous valors (la
interfície
ppp*ha de tenir preferència sobre les altres): - /etc/resolvconf/interface-order
# interface-order(5)
lo.inet6
lo.inet
lo.@(dnsmasq|pdnsd)
lo.!(pdns|pdns-recursor)
lo
tun*
tap*
ppp*
em+([0-9])?(_+([0-9]))*
p+([0-9])p+([0-9])?(_+([0-9]))*
*
- Solució / Solution
- Cal deshabilitar el tallafoc
- quins ports? De moment: tot, sense tallafoc
- no es troben les pàgines web (perquè es fa
servir el servidor DNS habitual, i no el nou,
subministrat pel servidor VPN)
- Instal·lació des de codi font / Installation from
source code
- openfortigui
- Instal·lació / Installation
- Dependències / Dependencies
- Mageia
sudo urpmi git gcc automake autoconf openssl-devel make pkg-config ppp
- Mageia
- Passos / Steps
cd ~srcgit clone https://github.com/theinvisible/openfortigui.gitcd openfortigui && git submodule init && git submodule updateqmake && make -j4- sudo ./openfortigui
- Dependències / Dependencies
- Ús / Usage
- ...
- Instal·lació / Installation
- FortiGate (Fortinet)
-
- FortiClient
downloads
- FortiClient VPN (MS Windows, MacOS, Linux, iOS, Android)
- Linux Downloads
- repo.fortinet.com
- Linux version for Fortinet VPN client (Ubuntu forums)
- FortiClient SSL VPN for Linux
-
urpmi xterm ppp libgtk+-x11-2.0_0(32 bit)./forticlientsslvpn
- User_Guide.pdf
- FortiClient
downloads
- openfortivpn
-
91DHCP#
urpmi dhcp-serverurpmi drakwizard-basedrakwizard(MCC)- Manpage of dhcp.conf (fr)
- MCC: Serveis de xarxa -> Configura DHCP
/etc/dhcpd.conf-
DHCPD_INTERFACE = "eth1";ddns-update-style none;
subnet 192.168.0.0 netmask 255.255.255.0 {
# default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "domain.org";
# Seting up an ip address is better here
option domain-name-servers ns.domain.org;
option nis-domain "domain.org";
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed address
host ns {
next-server fixed.domain.org;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 192.168.0.10;
}
}
- service dhcpd start
- LDAP
-
- DHCP with LDAP support
- how to configure isc-dhcp-server-ldap + slapd?
apt-get install isc-dhcp-server isc-dhcp-server-ldap slapd- ldap-server
- ldap-port
- ldap-base-dn
- PXE
92PXE#
- PXE boot on Mandriva
- MediaMVP PXE config
- PXE on VirtualBox
- PXE Documentation: HOWTO setup a PXE 2.x server under Linux
urpmi tftp-server/etc/dhcpd.conf-
-
ddns-update-style none;
subnet 192.168.1.0 netmask 255.255.255.0 {
# default gateway
option routers 192.168.1.12;
option subnet-mask 255.255.255.0;
option domain-name "xarxacasa.net";
option domain-name-servers 192.168.1.12;
range dynamic-bootp 192.168.1.21 192.168.1.253;
default-lease-time 43200;
max-lease-time 21600;
host mvp1 {
hardware ethernet 00:0d:fe:00:6c:39;
fixed-address 192.168.1.30;
filename "dongle.bin";
}
} # for explanation in french go to : http://www.delafond.org/traducmanfr/man/man5/dhcpd.conf.5.html}
ddns-update-style none;
allow booting;
allow bootp;
# Your dhcp server is not master on your network !
#not authoritative;
# Your dhcpd server is master on your network !
authoritative;
#not authoritative;
#Interface where dhcpd is active
DHCPD_INTERFACE = "eth1";
# Definition of PXE-specific options
# Code 1: Multicast IP address of bootfile
# Code 2: UDP port that client should monitor for MTFTP responses
# Code 3: UDP port that MTFTP servers are using to listen for MTFTP requests
# Code 4: Number of secondes a client must listen for activity before trying
# to start a new MTFTP transfer
# Code 5: Number of secondes a client must listen before trying to restart
# a MTFTP transfer
# define Option for the PXE class
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;
#Define options for pxelinux
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
site-option-space "pxelinux";
# These lines should be customized to your setup
#option pxelinux.configfile "configs/common";
#option pxelinux.pathprefix "/pxelinux/files/";
#filename "/pxelinux/pxelinux.bin";
option pxelinux.magic f1:00:74:7e;
option pxelinux.reboottime 30;
#if exists dhcp-parameter-request-list {
# Always send the PXELINUX options
# append dhcp-parameter-request-list 208, 209, 210, 211;
# append dhcp-parameter-request-list 208,211;
# }
#Class that determine the options for Etherboot 5.x requests
class "Etherboot" {
#if The vendor-class-identifier equal Etherboot-5.0
match if substring (option vendor-class-identifier, 0, 9) = "Etherboot";
# filename define the file retrieve by the client, there nbgrub
# our tftp is chrooted so is just the path to the file
filename "/etherboot/nbgrub";
#Used by etherboot to detect a valid pxe dhcp server
option vendor-encapsulated-options 3c:09:45:74:68:65:72:62:6f:6f:74:ff;
# Set the "vendor-class-identifier" field to "PXEClient" in dhcp answer
# if this field is not set the pxe client will ignore the answer !
option vendor-class-identifier "Etherboot";
vendor-option-space PXE;
option PXE.mtftp-ip 0.0.0.0;
# IP of you TFTP server
next-server 172.16.14.90;
}
# create the Class PXE
class "PXE" {
# if the "vendor-class-identifier" is set to "PXEClient" in the client dhcp request
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
# filename define the file retrieve by the client, there pxelinux.0
# our tftp is chrooted so is just the path to the file
# If you prefer use grub, use pxegrub compiled for your ethernet card.
#filename "/PXEClient/pxegrub";
filename "/X86PC/linux/linux.0";
# Set the "vendor-class-identifier" field to "PXEClient" in dhcp answer
# if this field is not set the pxe client will ignore the answer !
option vendor-class-identifier "PXEClient";
vendor-option-space PXE;
option PXE.mtftp-ip 0.0.0.0;
# IP of you TFTP server
next-server 172.16.14.90;
}
# the class know exist just for deny the response to other DHCP request
class "known" {
match hardware;
one-lease-per-client on;
ddns-updates on;
ddns-domainname = "";
option domain-name "";
option domain-name-servers 172.16.14.90;
ddns-hostname = pick-first-value(ddns-hostname, option host-name);
option fqdn.no-client-update on;
set vendor_class_identifier = option vendor-class-identifier;
}
# TAG: COMPUTER_LIST_BEGIN
#host compute9{
# hardware ethernet 00:02:b3:3f:7e:b7;
# fixed-address compute9;
# TAG: COMPUTER_LIST_END
# subnet 192.168.200.0 netmask 255.255.255.0 {
subnet 172.16.14.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option routers 172.16.14.1;
default-lease-time 28800;
max-lease-time 86400;
option domain-name "";
option domain-name-servers 172.16.14.90;
next-server 172.16.14.90;
pool {
range 172.16.14.129 172.16.14.254;
# deny members of "PXE";
# deny members of "Etherboot";
}
# pool {
# range 192.168.200.200 192.168.200.254;
# give an address of the the pool for PXE client and deny the other
#allow members of "PXE";
#deny members of "known";
#allow members of "Etherboot";
# }
-
93gPXE#
94iPXE#
- iPXE (wp)
- Network-booting machines over HTTP
- iPXE: Boot iPXE firmware (Chau Chee Yang)
95VTigerCRM#
- Installation with LAMP
-
- Cómo instalar y configurar vtiger CRM 5.0.x.
- Install Apache
-
urpmi apache
- Download and deploy VTiger (or checkout svn version)
-
cd /var/wwwwget -O vtigercrm-5.4.0.tar.gz http://sourceforge.net/projects/vtigercrm/files/vtiger%20CRM%205.4.0/Core%20Product/vtigercrm-5.4.0.tar.gz/downloadtar xvzf vtigercrm-5.4.0.tar.gz
- Config PHP
-
urpmi apache-mod_php php-gd php-imap php-openssl php-curl php-mysql php-iconv/etc/php.ini-
allow_call_time_pass_reference = On
error_reporting = ... E_WARNING & ~E_NOTICE
safe_mode = Off
display_errors = On
file_uploads = On
max_execution_time = 600
memory_limit = 64M
log_errors = Off
output_buffering = On
register_globals = Off
short_open_tag = On
- Config Apache
-
cd/var/wwwchmod -R 775vtigercrmchown -R apache.apache vtigercrm- Create
/etc/httpd/conf/webapps.d/vtigercrm.conf -
Alias /vtigercrm /var/www/vtigercrm
<Directory "/var/www/vtigercrm">
Order allow,deny
Allow from All
</Directory>
<Directory "/var/www/vtigercrm/bin">
Order allow,deny
Deny from All
</Directory>
service httpd restart
- Config MySQL
-
- Assegureu-vos que heu establert la contrasenya de root / Make sure that root password has been set
- Add database (
vtigercrm540) and user (vtigeradmin): -
mysql -u root -pmysql> create database vtigercrm540;mysql> grant all privileges on vtigercrm540.* to vtigeradmin@"localhost" identified by "some_password";
- Config VTiger
-
- Open http://localhost/vtigercrm
-
- Database information:
-
- Host name:
localhost - User name:
vtigeradmin - Database name:
vtigercrm540 - (disable) Create database
- (?) Populate database with demo data
- Host name:
- Espereu uns minuts... / Wait for some minutes...
- Installation from SVN
-
- latest
-
svn checkout http://trac.vtiger.com/svn/vtiger/vtigercrm/trunk/
- 6.0.0
-
svn checkout http://trac.vtiger.com/svn/vtiger/vtigercrm/branches/6.0.0/6.0.0/ vtigercrm6
- Utilització / Usage
- Problemes / Problems
-
- Lead import blank page
-
- Lead import from csv not working
- Re: Problem import CSV data
- account import fails in vtiger5.1.0
Fatal error: Call to undefined function iconv() in /var/www/vtigercrm6/vtiger6/modules/Import/readers/FileReader.phpon line 74- Solució / Solution:
-
- make sure that php-iconv is installed
-
urpmi php-iconv
- code:
-
- uploadAndParse
-
- vtiger6/modules/Vtiger/views/Import.php
- modules/Import/resources/Import.js
- validateFileUpload
-
- modules/Import/helpers/Utils.php
PHP Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0-
- Solució / Solution
-
- make sure that on /etc/php.ini you have the mysql.trace_mode set to off (not on):
-
mysql.trace_mode = Off
- SMTP mail not working (5.4)
96WebDAV#
- Apache WebDAV configuration
- How To Set Up WebDAV With Apache2 On Mandriva 2009.1
- How to set up WebDAV with Apache2 on Debian Etch
- Servidor / Server
-
- urpmi apache-mod_dav
- mkdir -p /var/www/toto
- chown apache:apache /var/www/toto
- Add user
test_user: -
htpasswd -c /var/www/passwd.dav test_user
- httpd.conf:
-
-
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
Alias /toto /var/www/toto
<Location /toto>
Dav on
AuthType Basic
AuthName "toto_webdav"
AuthUserFile /var/www/passwd.dav
Require valid-user
</Location>
<Directory "/var/www/toto">
Options -Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
-
service httpd restart
- Client
-
- cadaver
-
- urpmi cadaver
- cadaver http://webdav_server/toto/
- Nautilus
-
- dav://webdav_server/toto/
- Dolphin
-
- webdav://server[:8080]/toto
- Windows browser
-
- \\server[:8080]\toto
- davfs2
-
- Instal·lació / Installation
-
- Mageia
-
urpmi davfs2
- Ubuntu
-
sudo apt-get install davfs2
- /etc/fstab
-
# from Mageia
http://webdav_server/toto/ /mnt/http davfs2 defaults 0 0# from Ubuntu
http://webdav_server/toto/ /mnt/http davfs defaults 0 0
- /etc/davfs2/davfs2.conf
-
- man davfs2.conf
- /etc/davfs2/secrets
-
/mnt/http nom_ususari contrasenya
- Problemes / Problems
-
- File exists
-
- davfs2 on Karmic claims non existent files exist
- Solució / Solution
-
- /etc/davfs2/davfs2.conf
-
if_match_bug 1
- cache not synced often enough
-
- /etc/davfs2/davfs2.conf
-
delay_upload 0
- fusedav
-
- Automatically Mounting WebDAV in Ubuntu with a FuseDAV Init Script
- Instal·lació
-
- Ubuntu
-
sudo apt-get install fusedav
97Wiki (mediawiki)#
- WikiMatrix
- Instal·lació de
Mediawiki 1.16.5 (
/usr/share/doc/mediawiki-1.16.5/INSTALL): -
- urpmi mediawiki (
/usr/share/doc/mediawiki/README.urpmi) mediawiki-create /var/www/mediawikiln -s /usr/share/mediawiki/skins /var/www/mediawiki/etc/httpd/conf/webapps.d/mediawiki.conf:-
Alias /mediawiki /var/www/mediawiki
<Directory "/var/www/mediawiki">
Order allow,deny
Allow from All
</Directory>
<Directory "/var/www/mediawiki/bin">
Order allow,deny
Deny from All
</Directory>
/etc/httpd/conf/httpd.conf-
<Directory "/var/www/mediawiki">
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
- Check that MySQL is running
service httpd restart- open
http://server_address/mediawiki/ -
- "Please set up the wiki first".
- Use superuser account: yes
- prefix: mw_
cd /var/www/mediawiki/config; mv LocalSettings.php ..- Logo:
-
cp logotip.png/var/www/mediawiki/LocalSettings.php-
$wgLogo = "/mediawiki/logotip.png";
- urpmi mediawiki (
- Upgrade to 1.16.5 (
/usr/share/doc/mediawiki-1.16.5/UPGRADE,/usr/share/doc/mediawiki/README.urpmi) -
mysql -u root -p < backup_mediawiki.sqlcp -pr /tmp/backup/var/www/mediawiki /var/wwwcd /var/www/mediawiki[cp LocalSettings.php LocalSettings.php.bo]rm -f /var/www/mediawiki/{index.php,api.php,opensearch_desc.php}
mediawiki-create /var/www/mediawiki
rm -rf /var/www/mediawiki/config/- modify LocalSettings.php
-
if( defined( 'MW_INSTALL_PATH' ) ) {
$IPLOCAL = MW_INSTALL_PATH;
} else {
$IPLOCAL = dirname( __FILE__ );
}
$IP = '/usr/share/mediawiki';require_once( "$IPLOCAL/extensions/..."
- cp AdminSettings.sample AdminSettings.php
- modify AdminSettings.php:
-
$wgDBadminuser = 'wgDBuser';
$wgDBadminpassword = 'wgDBpassword';
- modify LocalSettings.php (*)
-
## $wgDBTableOptions = "TYPE=InnoDB";
$wgDBTableOptions = "ENGINE=InnoDB";- temporarilly modify:
-
- $wgDBuser="root" (to have permissions to create new tables)
- Modify /usr/sbin/mediawiki-updateall
-
- #mw-createinstance "$path"
mediawiki-updateall(performs an update.php to each instance in /etc/mediawiki/instances)- Check that the user
$wgDBuser(usuallywikiuser) with password$wgDBpasswordhas access to database$wgDBname(usuallywikidb) (all variables in LocalSettings.php.bo): -
mysql -u wgDBuser -p
- Instal·lació de Mediawiki (Cómo instalar MediaWiki en Mandriva Linux)
-
urpmi mediawiki wget http://download.wikimedia.org/mediawiki/1.13/mediawiki-1.13.3.tar.gz (mediawiki-1.15.1-1mdv2010.0.noarch.rpm)- /etc/httpd/conf/webapps.d/mediawiki.conf:
Alias /mediawiki /var/www/mediawiki
<Directory "/var/www/mediawiki">
Order allow,deny
Allow from All
</Directory>
<Directory "/var/www/mediawiki/bin">
Order allow,deny
Deny from All
</Directory>
- Check that MySQL is running
- open
http://server_address/mediawiki/- "Please set up the wiki first".
- Use superuser account: yes
- prefix: mw_
mv /var/www/mediawiki/config/LocalSettings.php /var/www/mediawiki/- Open
http://localhost/mediawiki/index.php
- Upgrade Mediawiki
-
- ssh user@server
- cd /var/www/mediawiki/
- mv LocalSettings.php LocalSettings.php.old
- firefox -no-remote http://server_address/mediawiki/config/index.html
-
- Use superuser account
- prefix: mw_
- PHP debug
- Servidor de correu / Mail server
-
- Postfix
-
chkconfig postfix onservice postfix start
- Email settings
-
$wgPasswordReminderResendTime
- Llengües
-
- Installation:
-
- copy templates from Template:Languages, Template:Languages/Lang
- Non English reference page:
- Configuració / Configuration
-
- Alphabetical list of parameters
/var/www/mediawiki/LocalSettings.php-
if( defined( 'MW_INSTALL_PATH' ) ) {
$IPLOCAL = MW_INSTALL_PATH;
} else {
$IPLOCAL = dirname( __FILE__ );
}
$wgExtraNamespaces = array(
100 => "NewName1",
101 => "NewName1_Discussion",
102 => "NewName2",
103 => "NewName2_Discussion",
);
# no es permeten edicions anònimes
$wgGroupPermissions['*']['edit'] = false;
# extensions de fitxers que es poden pujar
$wgFileExtensions = array_merge($wgFileExtensions, array('doc', 'xls','mpp', 'pdf', 'svg', 'zip'));
#<math>
$wgUseTeX = true;
#permet el protocol file://
$wgUrlProtocols[] = "file:";
# per a debugar
$wgShowExceptionDetails = true;
# permet referències a imatges externes
$wgAllowExternalImages = true;
- Usuaris / Users
- Aplicacions
-
- mwlib (Python) (PediaPress)
-
urpmi python-setuptools libpython-devel gcc-c++ python-imaging libxslt-devel python-reportlab python-pygmentseasy_install mwlibeasy_install mwlib.rl(per a generar pdf) (readme.txt)- Problems:
-
- timelib: ... undefined reference to `sincos'
-
- Solution:
- mwlib.ext-0.12.3: ... undefined reference to `log10'
-
- Solution:
-
- mwlib group: easy_install mwlib.rl not working: undefined log10
- commit: link with -lm if possible
- install the latest version from git:
-
# cd /usr/lib/python2.7/site-packages#git clone git://github.com/pediapress/mwlib.ext.git#cd mwlib.ext#python setup.py install
- Examples
-
mw-render --list-writersmw-render --config=http://localhost/mediawiki/ --writer=rl --output=./p.pdf Pàgina_Principal
- Configuració
-
-
/usr/lib/python2.x/site-packages/mwlib.rl-0.aa.bb-py2.x.egg/mwlib/rl/pdfstyles.py-
titlepagefooter = _(u'Peu de pàgina del títol')pagefooter = _(u'Peu de pàgina')show_creation_date = Falseshow_article_attribution = False(without "Article Sources and Contributors" and "Image Sources, Licenses and Contributors" sections)
- odf
-
/usr/lib/python2.x/site-packages/mwlib-0.cc.dd-py2.x-linux-i686.egg/mwlib/odfstyles.py
- Plantilles / Templates
-
- Templates
-
- Copying from one wiki to another
-
- source wiki:
-
- Special:Export (check "Include templates")
- destination wiki:
-
- Special:Import (cal entrar amb permisos d'administració: WikiSysop)
- Citation templates (la pàgina resultant conté referències COinS, importables pel Zotero)
-
- Wikipedia:COinS
- Template:Cite_journal (commons: source) (wikipedia: source)
- Template:Cite_book (commons: source) (wikipedia: source)
- Extensions
-
- Collection / Pdf Writer (es necessita mwlib, mwlib.rl) (readme.txt)
-
- Help
mw-serve -i localhost(engega el servidor mwlib per a ser accedit des de l'API de mediawiki) (el nom del servidor, en aquest cas localhost, ha de ser coherent amb el valor indicat a$wgCollectionMWServeURL)-
- per a fer-ho de forma automàtica quan engega l'ordinador:
-
- /etc/rc.d/init.d/mw-serve
- ln -s /etc/rc.d/init.d/mw-serve /etc/rc5.d/S99mw-serve
- chkconfig mw-serve on
urpmi php-curlcd /var/www/mediawiki/extensionssvn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Collection/var/www/mediawiki/LocalSettings.php-
- require_once("$IP/extensions/Collection/Collection.php");
- $wgCollectionMWServeURL = "http://localhost:8899";
- $wgCollectionFormats = array(
'rl' => 'PDF',
'odf' => 'ODT',
);
- open port: 8899/tcp
/var/www/mediawiki/skins/MonoBook.php-
-
<?php
if(isset($GLOBALS['wgSpecialPages']['Book'])) {
Collection::printPortlet();
}
?>
-
- Hauríeu de veure una nova capseta a l'esquerra, sobre la capseta "eines", anomenada "create a book". Si no es veu, buideu la memòria cau del vostre navegador
- Comprovació:
-
wget "http://localhost/mediawiki/index.php?title=Especial:Book/render_article/&arttitle=Pàgina_principal&oldid=2&writer=rl"wget "http://localhost/mediawiki/index.php?title=Especial:Book/render_article/&arttitle=Pàgina_principal&oldid=2&writer=odf"- Si hi ha error del tipus 500, verifiqueu
-
tail /var/log/httpd/error_log
- Problems
-
- Fatal error: Unsupported operand types in .../extensions/Collection/Collection.php on line 192
-
- Solution:
-
- get a previous version:
-
svn co -r 79875 http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Collection/
- Bibwiki (*) (*)
-
urpmi php-mbstring- Download the latest image (0.99e-rc1)
- Afegiu les entrades a 'ca' al fitxer Bibwiki.i18n.php (copieu-les de 'en')
-
- haureu d'accedir a la pàgina especial:
mediawiki/index.php/Especial:Bibliography
- haureu d'accedir a la pàgina especial:
cp BibwikiSettings.Default.php BibwikiSettings.php- Settings:
/var/www/mediawiki/extensions/<bibwiki_path>/BibwikiSettings.php (copy BibwikiSettings.Default.php) -
$wgBibPath = '/var/www/mediawiki/bib';$wgDefaultBib = 'my.bib';- Export
-
urpmi tetex(/usr/bin/bibtex)- Exporting via BibTeX
$wgEnableExport = true;$wgBibTeXExecutable = '/usr/bin/bibtex';$wgTempDir = '/tmp';$wgBibStyles = array('plain', 'abbrv','ieeetr');(styles available under/usr/share/texmf/bibtex/bst or /usr/share/texmf-dist/bibtex/bst/base/)
- Afegir / Add InProceedings:
-
- Bibwiki.body.php:
-
elseif ($wgRequest->getVal("type") == "InProceedings") {
$wgOut->addHTML("@".$wgRequest->getVal("type")."{*,\n");
$wgOut->addHTML('author = '.$wgValueDelimLeft.$wgValueDelimRight.','."\n");
$wgOut->addHTML('title = '.$wgTitleDelimLeft.$wgTitleDelimRight.','."\n");
$wgOut->addHTML('titleaddon = '.$wgTitleDelimLeft.$wgTitleDelimRight.','."\n");
$wgOut->addHTML('booktitle = '.$wgTitleDelimLeft.$wgTitleDelimRight.','."\n");
$wgOut->addHTML('year = '.$wgValueDelimLeft.$wgValueDelimRight.','."\n");
$wgOut->addHTML('pages = '.$wgValueDelimLeft.$wgValueDelimRight.','."\n");
$wgOut->addHTML('address = '.$wgValueDelimLeft.$wgValueDelimRight.','."\n");
$wgOut->addHTML('note = '.$wgValueDelimLeft.$wgValueDelimRight.','."\n");
$wgOut->addHTML('keywords = '.$wgValueDelimLeft.$this->mFilter.$wgValueDelimRight.','."\n");
$wgOut->addHTML('bibdate = '.$wgValueDelimLeft.strftime($wgDateTimeFormat,time()).$wgValueDelimRight.",\n");
$wgOut->addHTML("}");
}print('<li><a href="'.Bibliography::getLocalURL(array('view='.$wgRequest->getVal("view"), 'action=new', 'type=InProceedings', $bibquery, $keywordquery)).'">'.wfMsg('bibwiki_inproceedings').'</a></li>');
- Bibwiki.i18n.php, for each language:
-
"bibwiki_inproceedings" => "Inproceedings",
- Problemes / Problems
-
- The style file: plain.bst
I couldn't open database file toto.bib -
- Solution: modify /var/www/mediawiki/extensions/Bibwiki-0.99d/Bblfile.php
-
fputs($f, '\bibdata{'.str_replace('.bib','',$bibliography->mBibfile->getName())."}\n");must befputs($f, '\bibdata{'.str_replace('.bib','',$bibliography->mBibfile->getAbsoluteName())."}\n");
- "Program doesn't seem to be BibTeX. Check the
output and
$wgBibTeXExecutableinBibwikiSettings.php.
Output of the program:
I couldn't open file name `/tmp/bibexport.blg'" -
- Solution:
-
/usr/share/texmf/web2c/texmf.cnf (*)-
openout_any = a
- Problems with accents at exported text.
-
- Solution: modify /var/www/mediawiki/extensions/Bibwiki-0.99d/Bblfile.php
-
elseif ($cmd == "'" and $arg != "" and stristr('aeiouy', $arg) !== false)
return '&'.$arg.'acute;';
elseif ($cmd == "`" and $arg != "" and stristr('aeiouy', $arg) !== false)
return '&'.$arg.'grave;';
- "Too many commas in name..."
-
- Solution: modify the entry so as there is the word "and" to separate author names.
- "No es troba la pàgina especial que busqueu"
-
- comproveu el nom en català (sota l'apartat 'ca') que figura a Bibwiki.i18n.php
- proveu amb
mediawiki/index.php/Especial:Bibliography
- The style file: plain.bst
- Cite (references as footnotes)
- Cerca / Search
-
- Category:Search extensions
- Lucene-search
- SphinxSearch
-
urpmi sphinx- download SphinxSearch-0.6.1 to /tmp/SphinxSearch-0.6.1
-
- sphinx.conf
-
sql_user =...(same as in LocalSettings.php)sql_pas = ...(same as in LocalSettings.php)sql_db = ...(same as in LocalSettings.php)- check sql_query sql_query_info (prefix coherent with $wgDBprefix in LocalSettings.php)
morphology = stem_ca(?)
mkdir /var/data/ /var/data/sphinxsphinx-indexer --config sphinx.conf --all- search --config sphinx.conf "paraula"
- crontab -e:
-
- tototototot
- mkdir /var/www/mediawiki/extensions/SphinxSearch
- cp /usr/share/doc/sphinx/api/sphinxapi.php /var/www/mediawiki/extensions/SphinxSearch
- cd /var/www/mediawiki/extensions/SphinxSearch
- svn export http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ExtensionFunctions.php
- mv /tmp/SphinxSearch-0.6.1/sphinx.conf /etc/sphinx/
- cp /tmp/SphinxSearch-0.6.1/* /var/www/mediawiki/extensions/SphinxSearch/
- service sphinx-searchd restart
- LocalSettings.conf
-
- require_once( "$IP/extensions/SphinxSearch/SphinxSearch.php" );
- minus sign:
-
- Possible bug with negation in 0.9.8 r871
-
- charset_table = ... , U+2D
- Editors WYSIWYG
-
- FCKeditor (Official)
-
- cd /var/www/mediawiki/extensions
svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/FCKeditor- /var/www/mediawiki/LocalSettings.php
-
# extensió FCKEditor (http://www.mediawiki.org/wiki/Extension:FCKeditor_%28by_FCKeditor_and_Wikia%29)
require_once("$IPLOCAL/extensions/FCKeditor/FCKeditor.php");
$wgFCKEditorToolbarSet = "Wiki";
- indent/outdent buttons
-
- /var/www/mediawiki/extensions/FCKeditor/fckeditor_config.js
-
- FCKConfig.ToolbarSets['Wiki'] = [
...
['Outdent','Indent'],
...
- FCKConfig.ToolbarSets['Wiki'] = [
- FCKeditor (use FCKeditor (Official) instead)
- FCKeditor (by Mafs)
- Semantic mediawiki
- math / LATeX
-
urpmi make ocamlcd mediawiki/mathmake
- Edició / Edition
98Wordpress#
- Instal·lació / Installation
-
- Dependències / Dependencies
-
- Mageia
-
- urpmi wordpress
-
- notes d'instal·lació / installation notes:
-
/usr/share/doc/wordpress/README.install.urpmi
- Configuració / Set-up
-
- assegureu-vos que hi ha un servidor MySQL/MariaDB funcionant, amb un usuari root protegit per contrasenya / make sure that MySQL/MariaDB database server is running, with a root user protected with password
- creeu un base de dades per a Wordpress i un usuari /
create a database for Wordpress and a user:
mysql -u root -p-
CREATE DATABASE nom_bd_wp;GRANT ALL PRIVILEGES ON nom_bd_wp.* TO "usuari_wp"@"localhost" IDENTIFIED BY "contrasenya_wp";FLUSH PRIVILEGES;EXIT
- obriu / open: http://localhost/wordpress/
- l'auxiliar crearà / the wizard will create:
-
/var/www/wordpress/wp-config.php(/var/www/html/wp-config.php)-
DB_NAME (nom_bd_wp)DB_USER(usuari_wp)DB_PASSWORD(contrasenya_wp)DB_HOST(localhost)
- Setting up WordPress behind Amazon Cloudfront
- Problemes / Problems
-
- Error 500; and /var/log/httpd/error_log reports:
-
- /var/www/wordpress/.htaccess: RewriteEngine not allowed here
- Solució / Solution:
-
- internal server error 500: RewriteEngine not allowed here (3 posts)
- .htaccess: RewriteEngine not allowed here
- wordpress.conf
-
...
AllowOverride Options FileInfo
...
- Redireccionaments / Redirects
99Zotero#
- Zotero (eina de bibliografia)
-
- Developers
-
- Make your site Zotero ready
- Making COinS (COinS)
- Generació de COinS des de WikiMedia / Generation of COinS from WikiMedia: cite book
- Word processor plugins
-
- Installation path:
-
- Openoffice:
/usr/lib/ooo/ - LibreOffice:
/opt/libreoffice/
- Openoffice:
- word processor plugin troubleshooting
-
urpmi java-1.6.0-sun-plugin
- IEEE URL missing (again)
-
~/.mozilla/firefox/xxxxx.default/zotero/styles/ieee-w-url.csl
- LyZ (for LyX)
http://www.francescpinyol.cat/utilitats.html
Darrera modificació: 31 de juliol de 2026 / Last update: 31st July
2026