Archivos por Etiqueta: ubuntu

Linux: Convert OGM to AVI

Una simple chuleta para convertir video en formato .ogm a formato .avi en Ubuntu 14.04:

avconv -i "input.ogm" -vcodec copy -acodec libmp3lame -ac 2 -ar 44100 "output.avi"

Si tu reproductor no soporta el formato del stream de video de original y necesitas cambiar el codec puedes usar “-vcodec mpeg4”, aunque el proceso será mucho más lento.

Para ver la lista de codecs soportados:

avconv -codecs

La alternativa de “avconv” es “mencoder”:

mencoder "input.ogm" -o "output.avi" -of avi -ovc copy \
  -oac mp3lame -lameopts mode=0:preset=128 -alang Spanish,es

El paquete Ubuntu es libav-tools / mencoder.

Referencias:
avconv.1
mencoder.1

Anuncios

Linux: Setting Hostname from DHCP-Server in Ubuntu

Si quieres que tu Linux coja el nombre de Host desde DHCP (probado en Ubuntu 12.04 -Precise-)

#!/bin/sh
# Filename: /etc/dhcp/dhclient-exit-hooks.d/hostname
# Purpose:  Set the hostname of the system provided by DHCP (option 12).
#
case "$reason" in
  BOUND|RENEW|REBIND|REBOOT)
    if [ "$new_host_name" != "" ]; then
      echo $new_host_name > /etc/hostname;
      hostname $new_host_name;
    fi
    echo dhclient-exit-hooks.d/hostname: Dynamic Hostname = $new_host_name;
  ;;
esac

El script aparentemente tiene acceso a estas variables de entorno (la documentacion no las explica todas):

interface=eth0
reason=RENEW
# ---
new_expiry=1391268994
new_dhcp_lease_time=300
new_dhcp_message=ACME
new_dhcp_message_type=5
new_dhcp_server_identifier=192.168.1.1
new_network_number=192.168.1.0
new_subnet_mask=255.255.255.0
new_broadcast_address=192.168.1.255
new_ip_address=192.168.1.101
new_routers=192.168.1.1
new_host_name=test1
new_domain_name=acme.com
new_domain_name_servers=192.168.1.1 192.168.1.2
# ---
old_expiry=1391268724
old_dhcp_lease_time=300
old_dhcp_message=ACME
old_dhcp_message_type=5
old_dhcp_server_identifier=192.168.1.1
old_network_number=192.168.1.0
old_subnet_mask=255.255.255.0
old_broadcast_address=192.168.1.255
old_ip_address=192.168.1.101
old_routers=192.168.1.1
old_host_name=test1
old_domain_name=acme.com
old_domain_name_servers=192.168.1.1 192.168.1.2

Referencias:
man 8 dhclient-script
man 5 dhclient.conf

OpenVPN: tun y tap

Despues de haber usado VPNs IPSec, L2TP, PPTP y PPP/SSH… sin duda me quedo con OpenVPN.

Aqui pongo varios ejemplos de configuraciones (para un “TUN” -Routing IP- y un “TAP” -Bridge Ethernet-) (Edit [2017.04.25] la configuracion y las pruebas han sido sobre Ubuntu 16.04 en el server y Windows 7 en el cliente, el articulo inicial fue para Ubuntu 12.04 -cambian pocas cosas-), si no funciona el “redirect-gateway def1” (para que todo el trafico salga a traves de la vpn) o alguna otra opcion es posible que debas arrancar el openvpn-gui con privilegios administrativos:

# Primero generamos el Diffie-Hellman (en el server)
openssl gendh -out dh-2048.pem 2048
# Generamos Shared-Secret (en el Server)
# Este fichero es compartido en server y clientes
openvpn --genkey --secret secret.key

Aunque la parte de la creacion de los certificados X.509 no la explico aqui (server.{crt,key} & client.{crt,key}); a modo de resumen (usando solo certificados auto-firmados):

  • dh-2048.pem: es privado, estará solo en el servidor (owner{root:root} perm{600})
  • server.crt: es publico, compartido entre todos -servidor y clientes-
  • server.key: es privado, estará solo en el servidor (owner{root:root} perm{600})
  • client.crt: es publico, generado para cada cliente
  • client.key: es privado, estará solo en el cliente
  • ca.crt: es publico, estará solo en el servidor con permisos restringidos (owner{root:root} perm{644}), todos los client.crt se meten dentro de este fichero de modo concatenado, es la lista de clientes permitidos

Para poder dar soporte a clientes UDP/1194 (standard) y TCP/443 (firewall-friendly) hay que crear 2 ficheros diferentes en el server y asignar 2 rangos de IPs separados (para que no haya problemas con las las rutas).

Leer más de esta entrada

Lubuntu: Disable automount (LXDE)

Si te has vuelto mico buscando como desactivar el automount de un dispositivo USB en Lubuntu/LXDE:

Este comando es la solución:

pcmanfm

lubuntu pcmanfm disable automount

La pista (pq por mas que busqué en la configuración no encontré nada) fue el anuncio de la pagina de Lubuntu:

== Features ==
* Based on the lightweight LXDE desktop environment.
* Pcmanfm 0.9.10, a fast and lightweight files manager using gio/gvfs.
* Openbox, the fast and extensible, default windows-manager of LXDE.
* Lightdm, using the simple GTK greeter
* Chromium, the open-source version of Google Chrome.
* … and, of course, based on Ubuntu 12.04 LTS.

See the complete list of applications on https://wiki.ubuntu.com/Lubuntu/Applications

Otros metodos para otros sistemas:
Disable automount in Nautilus

Configuracion Conky (Ubuntu 10.04)

Aqui está mi configuracion del Conky (Ubuntu 10.04: /etc/conky/conky.conf).


# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_hints undecorated,below,skip_taskbar
background no

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# fiddle with window
use_spacer yes
use_xft yes

# Update interval in seconds
update_interval 3.0

# Minimum size of text area
minimum_size 160 600

# Draw shades?
draw_shades no

# Text stuff
draw_outline no # amplifies text if yes
draw_borders no

uppercase no # set to yes if you want all text to be in uppercase

# Stippled borders?
stippled_borders 1

# border width
border_width 1

# Default colors and also border colors, grey90 == #e5e5e5
default_color white
default_shade_color red
default_outline_color grey90

own_window_colour black
own_window_transparent yes

# Text alignment
alignment top_right

override_utf8_locale yes
xftfont Terminus:size=8
xftalpha 1.0

# stuff after ‘TEXT’ will be formatted on screen
TEXT
${color green}${time %a, %e %B %G} ${time %H:%M:%S}${color}
${color red}=${color}UpTime: $uptime
${color red}=${color}Battery: ${battery_short} ${battery_time}

${color red}=${color}CPU: $cpu% ${acpitemp}ºC
${cpugraph 20,48 00ff00 00ff00}${cpugraph cpu1 20,46 ff0000 ff0000}${cpugraph cpu2 20,46 ff0000 ff0000}
Processes: $processes Run: $running_processes
${top name 1} ${top cpu 1}%
${top name 2} ${top cpu 2}%

${color red}=${color}MEM: $memperc% $mem/$memmax
${membar 3,140}
${top_mem name 1} ${top_mem mem 1}%
${top_mem name 2} ${top_mem mem 2}%

${color red}=${color}DiskI/O: ${diskio /dev/sda} ${diskio /dev/sdb}
${diskiograph /dev/sda 20,70 00ff00 00ff00}${diskiograph /dev/sdb 20,70 ff0000 ff0000}
${top_io name 1} ${top_io io_perc 1}%
${top_io name 2} ${top_io io_perc 2}%

ROOT:  ${fs_used_perc}% ${fs_free /}/${fs_size /}
${fs_bar 3,140 /}

${color red}=${color}Network:
PPP: ${addr ppp0}${if_match “${addr ppp0}” != “No Address”}
Up: ${upspeed ppp0} Down: ${downspeed ppp0}
${upspeedgraph ppp0 20,70 00ff00 00ff00}${downspeedgraph ppp0 20,70 ff0000 ff0000}${endif}
WLAN: ${addr wlan0} ${if_match “${addr wlan0}” != “No Address”}${wireless_bitrate wlan0}
${wireless_link_bar 3,140 wlan0}
Up: ${upspeed wlan0} Down: ${downspeed wlan0}
${upspeedgraph wlan0 20,70 00ff00 00ff00}${downspeedgraph wlan0 20,70 ff0000 ff0000}${endif}
ETH: ${addr eth0}${if_match “${addr eth0}” != “No Address”}
Up: ${upspeed eth0} Down: ${downspeed eth0}
${upspeedgraph eth0 20,70 00ff00 00ff00}${downspeedgraph eth0 20,70 ff0000 ff0000}${endif}

Kern: $kernel


Eso es todo!

Debian quick-ref

*
=== APT
apt-get update Update packages listings from package repositories as listed in /etc/apt/sources.list. Required whenever that file or the contents of the repositories change.
apt-cache search search-string Search packages and descriptions for search-string.
apt-cache policy package-names Show versions and priorities of available packages.
apt-cache show package-names Show package information incl. description.
apt-cache showpkg package-names Show package dependencies (needed packages).
apt-get install package-names Install packages from repositories with all dependencies.
apt-get upgrade Install newest versions of all packages currently installed.
apt-get dist-upgrade Like apt-get upgrade, but with advanced conflict resolution.
apt-get remove package-names Remove packages with all needed packages.
apt-get autoremove Remove packages that no other packages depend on.
apt-cache depends package-names List all packages needed by the one given.
apt-cache rdepends package-names List all packages that need the one given.
apt-file update Update content listings from package repositories, see apt-get update
apt-file search file-name Search packages for file.
apt-file list package-name List contents of a package.
auto-apt Installs packages automatically if needed, can replace apt-file, needs auto-apt.
aptitude Console interface to APT, needs aptitude.
synaptic GUI interface to APT, needs synaptic.
=== Dpkg
dpkg -l names List packages.
dpkg -I pkg.deb Show package information.
dpkg -c pkg.deb List contents of package file.
dpkg -S filename Show which package a file belongs to.
dpkg -i pkg.deb Install package files.
debsums Audit check sums of installed packages, needs debsums.
dpkg-divert options file Override a package's version of a file.
dpkg –compare-versions v1 gt v2 Compare version numbers, check with echo $?.
dpkg-query -W –showformat=format Query installed packages, format e.g. ‘${Package} ${Version} ${Installed-Size}\n’.
dpkg –get-selections > file Write package selections to file.
dpkg –set-selections < file Set package selections from file.
=== The Network
/etc/network/interfaces Network interface configuration.
ifup, ifdown device Start, stop network interfaces according to files above.
/sbin/ip Show and manipulate network interfaces and routing, needs iproute.
ssh -X user@host Login at other machine.
scp files user@host:path Copy files to other machine (and vice versa).
=== Web Server (Apache2)
/etc/apache2/ Configuration files.
/etc/apache2/sites-available/ Contains virtual hosts. To enable a virtual host, use a2ensite.
/etc/apache2/mods-available/ Contains available modules files. To enable a module, use a2enmod.
=== Configuration
/etc/ All system configuration files are under directory /etc/.
editor files Default text editor. May be nano, emacs, vi, joe.
dpkg-reconfigure package-name Reconfigure a package, e.g. console-common (keyboard), locales (localisation).
update-alternatives options Manage command alternatives.
update-grub After changing /boot/grub/menu.lst.
make-kpkg –initrd –revision=2:my.1.0 –rootcmd fakeroot –uc –us kernel_image Build a kernel packages from sources, if a customised kernel is really needed, needs kernel-package.
m-a a-i module kernel_image Create and install third-party modules (gspca, …), needs module-assistant.
*
A %d blogueros les gusta esto: