Desktop: Debian --simplificada--> Ubuntu
Explo: SUSE Linux Enterprise Server 10 SP1 (i586)
# version de linux
$ cat /etc/issue
Ubuntu 8.04.4 LTS \n \l
# usuarios ver este link
cat /etc/passwd
cat /etc/group
#crear usuario
useradd -m -k /etc/skel/ -s /bin/bash new_user_name
#añadir usuario a grupo
usermod -a -G group user
#configuración de entorno
/etc/profile
/etc/profile.d/*.sh
/etc/bash.bashrc -- para proxy global
LAMP -- free, open source software: Linux, Apache, MySQL and Perl/PHP/Python.
WAMP -- Microsoft Windows + Apache, MySQL and Perl/PHP/Python.
MAMP -- Mac OS + Apache, MySQL and Perl/PHP/Python.
# proxy
$ printenv | grep -i proxy
http_proxy=127.0.0.1:8080
ftp_proxy=127.0.0.1:8080
no_proxy=*.local, localhost,127.0.0.1
echo $http_proxy
unset http_proxy
# generico para los servicios
sudo /etc/init.d/apache2 start / stop / restart
sudo /etc/init.d/network start / stop / restart
/etc/network/interfaces
# gestion de aplicaciones
# update lista de aplicaciones disponibles
sudo apt-get update
sudo apt-get install curl
sudo apt-get install apache
# recuperar de una actualización fallida
dpkg --configure -a
# repositorios de aplicaciones
cat /etc/apt/sources.list
# buscar en cache
sudo apt-cache search apache2
#aplicaciones:
sudo apt-get install %application%
apache2 -- apache web server
- arrancar/parar: sudo /etc/init.d/apache2 start / stop / restart
- config: /etc/apache2/apache2.conf
.--> /etc/apache2/sites-enabled/000-default
. . --> /etc/apache2/sites-available/default
. . - /etc/apache2/envvars -
export APACHE_RUN_USER=www-data- logs: /var/log/apache2/access.log /var/log/apache2/error.log
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid
openssh-server -- ssh server -- info
samba -- file and printer server similar to windows
- config en: /etc/samba/smb.conf
- log en: /var/log/samba/log.%m
- arrancar/parar: sudo /etc/init.d/samba start / stop / restart
vi -- editor
vim -- Vi IMproved - enhanced vi editor
subversion -- version control system
php5-install
php5-curl
mysql
mysql-server - MySQL database server
-
gedit - official text editor of the GNOME desktop environment
bluefish - advanced Gtk+ HTML editor
# servicios / aplicaciones
useradd
smb
ssh
sftp
ftp -- noo
svn
php
tofrodos - Converts DOS <-> Unix text files, alias tofromdos: dos2unix, unix2dos
# apache2 -- apache web server
- arrancar/parar: sudo /etc/init.d/apache2 start / stop / restart
- config: /etc/apache2/apache2.conf
- log access: /var/log/apache2/access.log
- log error : /var/log/apache2/error.log
- DocumentRoot: /var/www/
- user and group: www-data
- gestion de módulos: a2dismod a2dissite a2enmod a2ensite
- ls /etc/apache2/mods-available/
- ls /etc/apache2/mods-enabled/
- sudo a2enmod
- sudo a2enmod proxy
- para activar mod_rewrite
mods-enabled/proxy.conf:
- sudo a2enmod proxy_connect proxy_http
- sudo a2enmod proxy_http
- sudo a2enmod rewrite
- sudo vim /etc/apache2/mods-enabled/proxy.conf
- sudo vim /etc/apache2/sites-available/default
- sudo tail -f /var/log/apache2/access.log /var/log/apache2/error.log
#turning ProxyRequests on and allowing proxying from all may allow
#spammers to use your proxy to send email.
ProxyRequests Off
AddDefaultCharset off
Order deny,allow
Deny from all
Allow from 10.113.101.0/24 127.0.0.1
#Allow from .example.com
# Enable/disable the handling of HTTP/1.1 "Via:" headers.
# ("Full" adds the server version; "Block" removes all outgoing Via: headers)
# Set to one of: Off | On | Full | Block
ProxyVia On
/etc/apache2/sites-available/default
RewriteEngine on
RewriteRule ^(/nice-project/football/api-fake/)([^/]+)(/.*)?$ http://localhost/user/projects/nice-project/api-fake/$2.php?u=$3 [P,L,QSA]
-- to serve a single file and once by http -- see this
woof file -- thnx to pyrox
--- wget
wget -r -l2 --no-parent --tries=45 -P./dest-dir/ http://download.conceptronic.net/wireless/CBT100U/
wget --recursive --level=2 --no-parent --tries=45 -P./dest-dir/ http://download.conceptronic.net/wireless/CBT100U/
-r -l2
--recursive --level=2
recursive and maximum depth level
--no-parent
Do not ever ascend to the parent directory when retrieving recursively
--tries=45
number of retries
-P prefix
--directory-prefix=prefix
The directory prefix is the directory where all other files and subdirectories will be saved to
Bash shell scripting tutorial (sh) - functions
Bash shell (sh) bucles -- bucles en sh
Referencia: Bash For Loop Examples
urls="\
http://host/path?player=Bus \
http://host/path?player?player=Bus&club= \
http://host/path?player?player=Bus&club=barce \
http://host/path?player?player=Bus&club=Levante \
";
fileNum=1
for uuu in $urls
do
echo "Doing $fileNum $uuu --"
curl -s --header "Authorization: Basic xxxxxxxxx" \
"$uuu" > out-$fileNum.xml
fileNum=`echo "$fileNum+1" | bc`
done
zip ouput.zip out-*.xml
-- zip recursivo
zip -r output.zip source/*
-. -
logrotate examples other
# ports scanning
nmap -A IP
Instaladores: installjammer - http://www.installjammer.com/
rsync -avH --exclude 'lost+found' /path/source/* /destination/path/
rsync -avz usuario@10.113.101.253:/conxuro/peliculas/* /media/LaCie-MM/conxuro2/peliculas/.
Crear proxy SOCKS 4 en linux ( tunel tunnel)
------
en la máquina de hace de proxy (a_inet.host.com) - la que sale a internet
- tener abierto el puerto 22 (ssh)
en el cliente (cliente.hola.com):
- ssh -D puerto_local user@a_inet.host.com
en el navegador (cliente.hola.com):
- poner proxy SOCKS: localhost:puerto_local
Crear tunel tunnel -- socat
socat TCP4-LISTEN:900 TCP4:192.168.1.9:30
http://www.cyberciti.biz/faq/linux-unix-tcp-port-forwarding/
http://www.netsecure.com.ar/2010/11/26/socat-con-ejemplos/
Time versioning
----------------
datime=`/bin/date -d "-1 day" +%Y%m%d-%H%M%S`
mv /tmp/export.xml /tmp/export-$datime.xml
>cat script-php-sure.sh
source `dirname $0`/../../../../../common/conf/env.sh
export HTTP_HOST=$SERVER_NAME:$SERVER_PORT
php `dirname $0`/script-php.php
2012.10.02
------------
dmesg -- mensajes del núcleo, cambios en el hardware, ..
scp [-r] user@host1:file1 user@host2:file2 - info window-winscp and other
-- sincroniza incluido permisos
rsync -avz user@host:/src_path/bar /dst_path/tmp
rsync -avz * /data/tmp/
rsync -avHz * /data/tmp/
-a, --archive archive mode; same as -rlptgoD (no -H)
-D, --devices preserve devices (root only)
-g, --group preserve group
-H, --hard-links preserve hard links
-l, --links When symlinks are encountered, recreate the symlink on the destination.
-o, --owner preserve owner (root only)
-p, --perms preserve permissions
-r, --recursive This tells rsync to copy directories recursively. See also --dirs (-d).
-t, --times preserve times
-v, --verbose increase verbosity
-z, --compress compress file data during the transfer
rsync tutoriales
rsync official page - documentation and tutorials
http://rsync.samba.org/documentation.html
Utilizando rsync como un servicio - Sitio web de Juan Valencia
http://www.jveweb.net/archivo/2011/01/utilizando-rsync-como-un-servicio.html
El mandato rsync (1a. parte) - linuxparatodos.net
http://www.linuxparatodos.net/portal/article.php?story=2876
El mandato Rsync (2a. parte) - linuxparatodos.net
http://www.linuxparatodos.net/portal/article.php?story=2903
Ubuntu info
* Output of uname -a
* uname -a > uname.txt
* Output of sudo lspci -vvnn
* sudo lspci -vvnn > lspci.txt
* Output of sudo dmidecode
* sudo dmidecode > dmidecode.txt
* Try to suspend/hibernate and then restart the system and attach /var/log/kern.log.0
- usuario para una carperta
backuppc
------------
- necesita apache
- apt-get install backuppc rsync par2
- Mover a repositorio a disco USB y que monte solo en arranque
.. mover la carpeta y sustituir por enlace
- Definir usuario "root"
- http://localhost/backuppc/
- Crear y restaurar un backup de windows con compressión y quitar duplicados
- Utilizar rsync
- Backup del propio servidor samba, SVN, webdav
- backup externo en 2ndo sitio
-.. crontab rsync -- creo que problemas con hardlinks
---> Utilizar este material ya está todo preparado link ------------------------------------
Artículos:
SVN
Tar Command Tutorial with 10 Practical Examples
http://www.thegeekstuff.com/tag/tar-command-examples/
# copiar directorios manteniendo permisos, links, propietario (si eres root)
(cd src_dir && tar cf - *) | (cd dst_dir && tar xvf -)
cd src_dir ; tar czvf dst_dir/tar_file.tgz base_dir/* # note base_dir/ will be included in files path
Guia de Ubuntu en Español - muy buena
Sala Ubuntu - fenomenal
2014.01.08
---
rsync -avH --exclude 'lost+found' /path/source/* /destination/path/
rsync -avz usuario@10.113.101.253:/conxuro/peliculas/* /media/LaCie-MM/conxuro2/peliculas/.
# comprimiendo y hardlinks
rsync -avHz * /data/tmp/
Rsync over SMB
rsync -rlptDv –modify-window=1 [source] [destination]
The “–modify-window” switch tells rsync to relax its timestamp comparison just enough for it to behave.
The remaining switches are useful for backing up to a NAS box, it’s essentially -a (archive mode) expanded, but without preserving ownership or groups (which doesn’t work well on the NAS.)
-a, --archive archive mode; same as -rlptgoD (no -H)
# comprobando contenidos en lugar de fecha/hora de modificación
rsync -av --checksum --dry-run --exclude 'lost+found' /path/source/* /destination/path/
--> ejemplo de errores
netstat -na # network red windows
# FileSytem Type
df -h -T
$ df -h -T
df: «/cygdrive/u»
S.ficheros Tipo Tamaño Usados Disp Uso% Montado en
C:/cygwin/bin ntfs 216G 103G 114G 48% /usr/bin
C:/cygwin/lib ntfs 216G 103G 114G 48% /usr/lib
C:/cygwin ntfs 216G 103G 114G 48% /
C: ntfs 216G 103G 114G 48% /cygdrive/c
D: ntfs 15G 8,1G 7,0G 54% /cygdrive/d
I: vfat 15G 14G 726M 96% /cygdrive/i
J: ntfs 31G 11G 21G 35% /cygdrive/j
------------
dmesg -- mensajes del núcleo, cambios en el hardware, ..
scp [-r] user@host1:file1 user@host2:file2 - info window-winscp and other
-- sincroniza incluido permisos
rsync -avz user@host:/src_path/bar /dst_path/tmp
rsync -avz * /data/tmp/
rsync -avHz * /data/tmp/
-a, --archive archive mode; same as -rlptgoD (no -H)
-D, --devices preserve devices (root only)
-g, --group preserve group
-H, --hard-links preserve hard links
-l, --links When symlinks are encountered, recreate the symlink on the destination.
-o, --owner preserve owner (root only)
-p, --perms preserve permissions
-r, --recursive This tells rsync to copy directories recursively. See also --dirs (-d).
-t, --times preserve times
-v, --verbose increase verbosity
-z, --compress compress file data during the transfer
rsync tutoriales
rsync official page - documentation and tutorials
http://rsync.samba.org/documentation.html
Utilizando rsync como un servicio - Sitio web de Juan Valencia
http://www.jveweb.net/archivo/2011/01/utilizando-rsync-como-un-servicio.html
El mandato rsync (1a. parte) - linuxparatodos.net
http://www.linuxparatodos.net/portal/article.php?story=2876
El mandato Rsync (2a. parte) - linuxparatodos.net
http://www.linuxparatodos.net/portal/article.php?story=2903
Ubuntu info
* Output of uname -a
* uname -a > uname.txt
* Output of sudo lspci -vvnn
* sudo lspci -vvnn > lspci.txt
* Output of sudo dmidecode
* sudo dmidecode > dmidecode.txt
* Try to suspend/hibernate and then restart the system and attach /var/log/kern.log.0
2012.10.29 dell d610
------------
------------
instalacion
--------------
apt-get install gparted
apt-get install backuppc rsync par2
apt-get install subversion
apt-get install libapache2-svn
apt-get install vim
apt-get install ssh
apt-get install tree
apt-get clean
apt-cache search apache2 dav
apt-cache search apache2 subversion
apt-cache search backuppc
apt-cache search svn
ssh
----
Activar
Desactivar
Claves
Acceso desde fuera de casa:
Es seguro ?
Puertos que usa o sólo 1.
--
/etc/passwd
/etc/ssh/sshd_config ojo: PermitRootLogin
root, sudo
------------
sudo activar
sudo desactivar
--
sudo visudo -- info http://www.linuxtotal.com.mx/index.php?cont=info_admon_014
.. Fichero de ejemplo
samba
------
- activar / desactivar
- usuarios y permisos
- poner carpetas personales y compartidas
apache
----------
- instalar: sudo apt-get install
- arrancar/parar: sudo /etc/init.d/apache2 start / stop / restart
- proteger configuración segura, que no de info de lo que está corriendo
- config: /etc/apache2/apache2.conf
.--> /etc/apache2/sites-enabled/000-default -> /etc/apache2/sites-available/default
..--> /etc/apache2/sites-available/default
..--> /etc/apache2/envvars -
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid
--------------
apt-get install gparted
apt-get install backuppc rsync par2
apt-get install subversion
apt-get install libapache2-svn
apt-get install vim
apt-get install ssh
apt-get install tree
apt-get clean
apt-cache search apache2 dav
apt-cache search apache2 subversion
apt-cache search backuppc
apt-cache search svn
ssh
----
Activar
Desactivar
Claves
Acceso desde fuera de casa:
Es seguro ?
Puertos que usa o sólo 1.
--
/etc/passwd
/etc/ssh/sshd_config ojo: PermitRootLogin
root, sudo
------------
sudo activar
sudo desactivar
--
sudo visudo -- info http://www.linuxtotal.com.mx/index.php?cont=info_admon_014
.. Fichero de ejemplo
samba
------
- activar / desactivar
- usuarios y permisos
- poner carpetas personales y compartidas
apache
----------
- instalar: sudo apt-get install
- arrancar/parar: sudo /etc/init.d/apache2 start / stop / restart
- proteger configuración segura, que no de info de lo que está corriendo
- config: /etc/apache2/apache2.conf
.--> /etc/apache2/sites-enabled/000-default -> /etc/apache2/sites-available/default
..--> /etc/apache2/sites-available/default
..--> /etc/apache2/envvars -
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2.pid
- usuario para una carperta
backuppc
------------
- necesita apache
- apt-get install backuppc rsync par2
- Mover a repositorio a disco USB y que monte solo en arranque
.. mover la carpeta y sustituir por enlace
- Definir usuario "root"
- http://localhost/backuppc/
- Crear y restaurar un backup de windows con compressión y quitar duplicados
- Utilizar rsync
- Backup del propio servidor samba, SVN, webdav
- backup externo en 2ndo sitio
-.. crontab rsync -- creo que problemas con hardlinks
---> Utilizar este material ya está todo preparado link ------------------------------------
Artículos:
- Change archive directory
- Move_backup_data
- Removing a client (a computer not to backup anymore)
- Copying the pool
- User Scripts - Client - Windows VSS
- Off-site backups
- Push and Pull Network Backup Strategies
- Time Machine (Mac OS) - en Rsync de wikipedia
- Time Machine for every Unix out there
Articles in goodjobsucking.com
- Rsync over SMB timestamps are rounded to two second interval.
- Backing Up Open Files on Windows with Rsync (and BackupPC)
- Green backups with BackupPC and WOL
- BackupPC and Bare Metal Restore of Windows XP
SVN
-----
- mover a disco USB
.. mover la carpeta configurada en apache y poner link simbolico
- definir proyectos
- usuarios y permisos
.. access-rules con htpasswd en home
- acceso desde web, es seguro y puertos ?
webdav
--------
- def en apache
- usuarios y permisos
- acceso desde web, es seguro y puertos ?
logrotate
------------
/etc/logrotate.conf
/etc/logrotate.d/apache2
/var/log/apache2/*.log
..------------
/etc/logrotate.conf
/etc/logrotate.d/apache2
/var/log/apache2/*.log
Tar Command Tutorial with 10 Practical Examples
http://www.thegeekstuff.com/tag/tar-command-examples/
# copiar directorios manteniendo permisos, links, propietario (si eres root)
(cd src_dir && tar cf - *) | (cd dst_dir && tar xvf -)
cd src_dir ; tar czvf dst_dir/tar_file.tgz base_dir/* # note base_dir/ will be included in files path
Guia de Ubuntu en Español - muy buena
Sala Ubuntu - fenomenal
2014.01.08
---
rsync -avH --exclude 'lost+found' /path/source/* /destination/path/
rsync -avz usuario@10.113.101.253:/conxuro/peliculas/* /media/LaCie-MM/conxuro2/peliculas/.
# comprimiendo y hardlinks
rsync -avHz * /data/tmp/
Rsync over SMB
rsync -rlptDv –modify-window=1 [source] [destination]
The “–modify-window” switch tells rsync to relax its timestamp comparison just enough for it to behave.
The remaining switches are useful for backing up to a NAS box, it’s essentially -a (archive mode) expanded, but without preserving ownership or groups (which doesn’t work well on the NAS.)
-a, --archive archive mode; same as -rlptgoD (no -H)
# comprobando contenidos en lugar de fecha/hora de modificación
rsync -av --checksum --dry-run --exclude 'lost+found' /path/source/* /destination/path/
--> ejemplo de errores
netstat -na # network red windows
# FileSytem Type
df -h -T
$ df -h -T
df: «/cygdrive/u»
S.ficheros Tipo Tamaño Usados Disp Uso% Montado en
C:/cygwin/bin ntfs 216G 103G 114G 48% /usr/bin
C:/cygwin/lib ntfs 216G 103G 114G 48% /usr/lib
C:/cygwin ntfs 216G 103G 114G 48% /
C: ntfs 216G 103G 114G 48% /cygdrive/c
D: ntfs 15G 8,1G 7,0G 54% /cygdrive/d
I: vfat 15G 14G 726M 96% /cygdrive/i
J: ntfs 31G 11G 21G 35% /cygdrive/j