giovedì 6 agosto 2009

Estendere il disco Root con LVM ed ext3

Per estendere la partizione root (/) su lvm seguire i seguenti passaggi:

Dò per scontato che sulla macchina sia già installato un disco aggiuntivo con una partizione lvm libera (8e), e che il filesystem di root / sia ext3.

Creiamo il
physical volume in lvm:
pvcreate /dev/sdbx
vgextended VolGroup00 /dev/sdbx

Controlliamo quanto spazio abbiamo
vgdisplay |grep Free
Free  PE / Size       255 / 7,8GB

Estendiamo il device
lvextend -l255 /dev/VolGroup00/LogVol00

E alla fine facciamo il resize della partizione.
resize2fs /dev/VolGroup00/LogVol00

Essendo un filesystem ext3 e l'operazione che eseguiamo è di aumentare lo spazio possiamo eseguire l'operazione "a caldo", se invece dovevamo diminuire lo spazio del disco dovevamo farlo a sistema fermo.


lunedì 15 giugno 2009

Installare JasperServer 3.5 RC su Centos 5

L'installazione di JasperServer su Centos 5.2 è abbastanza semplice, a patto di installare tomcat5 e java scaricandoli direttamente dal sito dei produttori. I passi per l'installazione sono i seguenti:

1) Installazione di java JDK6 Sun
Per rendere le cose più semplici ho utilizzato il pacchetto java-1.6.0-sun-compat-1.6.0.06-1jpp.i586.rpm in questo modo vengono settate altre variabili si sistema (tipo la configurazione di alternatives) e semplifica notevolmente la configurazione.
1. Quindi scaricare il pacchetto dal sito
http://mirrors.dotsrc.org/jpackage/1.7/generic/non-free/RPMS/java-1.6.0-sun-compat-1.6.0.06-1jpp.i586.rpm
2. Scaricare dal sito Java Sun Archive la versione di jdk 6u6 (jdk-6u6-linux-i586-rpm.bin) perché altrimenti si avranno degli errore durante l'installazione di java-1.6.0-sun-compat
3. Rendere eseguibile il file jdk-6u6-linux-i586-rpm.bin
#chmod +x jdk-6u6-linux-i586-rpm.bin 4. Eseguire il file
#./jdk-6u6-linux-i586-rpm.bin
Verrà richiesto di accettare il contratto e poi verranno scompattati alcuni file *.rpm
5. Installare tutti i pacchetti:
#rpm -ivh java-1.6.0-sun-compat-1.6.0.06-1jpp.i586.rpm jdk-6u6-linux-i586.rpm
opzionalmente si possono installare anche i pacchetti sun-javadb-*
6. Creare un file in /etc/profile.d chiamato java.sh e inserire le seguenti linee:
export JAVA_HOME="/usr/java/default"
export JAVA_PATH="$JAVA_HOME"
export PATH="$PATH:$JAVA_HOME"
export JRE_HOME="/usr/java/default/jre"
E l'installazione di java è completata.

2) Installazione di tomcat 5
L'installazione di Tomcat è abbastanza semplice. Leggendo in internet è stato consigliato di installare tomcat 5.5.26, ma non credo ci siano molte differenze se installate un'altra versione.
1. Scaricare da archivio il apache-tomcat-5.5.26.tar.gz
2. Scompattarlo
#gunzip -cd apache-tomcat-5.5.26.tar.gz |tar xvf -
3. Spostare la cartella creata in /usr/share
#mv apache-tomcat-5.5.26 /usr/share/tomcat5
4. Creare in /etc/init.d lo script di avvio di tomcat:

###################################tomcat5-start###################################
#
#!/bin/bash
# This is the init script for starting up the
# Jakarta Tomcat server
#
# chkconfig: 345 91 10
# description: Starts and stops the Tomcat daemon.
#
# THIS SCRIPT RUNS TOMCAT AS ROOT - BE AWARE
# Source function library.
. /etc/rc.d/init.d/functions
# Get config.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
# Here I installed Tomcat 5
tomcat=/usr/share/tomcat5
startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh
TOMCAT_USER="tomcat"
export CATALINA_PID=$tomcat/logs/catalina.pid
# Link created by the Sun JRE rmp
export JAVA_HOME=/usr/java/latest

start(){
echo -n $"Starting Tomcat service: "
#daemon -c
#su - $TOMCAT_USER -c "$startup"
$startup
RETVAL=$?
echo
}
stop(){
#action $"Stopping Tomcat service: " su - $TOMCAT_USER -c "$shutdown"
action $"Stopping Tomcat service: " $shutdown
RETVAL=$?
echo
}

restart(){
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
# This doesn't work ;)
status tomcat
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac

exit 0
#
####################################tomcat5-end###################################


5. Per comodità ho modificato lo script /usr/share/tomcat5/bin/catalina.sh aggiungendo la seguente riga:
export CATALINA_PID=/usr/share/tomcat5/logs/catalina.pid
Per avere il file .pid del demone tomcat.
6. Modificare il file /usr/share/tomcat5/conf/tomcat-user.xml creando i ruoli manger e admin e assegnandoli a un utente. Ora rimane da lanciare /etc/init.d/tomcat5 start e collegarsi all'indirizzo http://localhost:8080 e vedere se il tutto funziona :D


3) Installazione di Mysql5
Finalmente posso utilizzare i pacchetti pronti di CentOS 5.2 quindi per installare Mysql basta lanciare il comando:
#yum install mysql mysql-server e il gioco è fatto. :D



4) Installazione di JasperServer

mercoledì 20 maggio 2009

Gestione Repository CentOS

DAG o RPMGORDE

Aggiungere la chiave
wget http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm --import RPM-GPG-KEY.dag.txt

Aggiungere il repository
I386
Scaricare pacchetto:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2.2.el5.rf.i386.rpm
Verifica file:
rpm -K rpmforge-release-0.5.2.2.el5.rf.i386.rpm
Installa Repo:
rpm -ivh rpmforge-release-0.5.2.2.el5.rf.i386.rpm

x86_64
Scaricare pacchetto:
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2.2.el5.rf.x86_64.rpm
Verifica file:
rpm -K rpmforge-release-0.5.2.2.el5.rf.x86_64.rpm
Installa Repo:
rpm -ivh rpmforge-release-0.5.2.2.el5.rf.x86_64.rpm


SAMBA ENTERPRISE

Installare la chiave

wget http://ftp.sernet.de/pub/sernet-build-key-1.0-1.noarch.rpm
rpm -ivh  sernet-build-key-1.0-1.noarch.rpm

Aggiungere il repository
cd /etc/yum.repos.d
wget http://ftp.sernet.de/pub/samba/tested/centos/5/sernet-samba.repo

UTILIZZO DEI REPO

Per cercare/installare pacchetti da repository disabilitati aggiungere il seguente parametro: --enablerepo
Esempio: --enablerepo=dag

lunedì 11 maggio 2009

Pulire Cache Windows Update

Per poter liberare un pò di spazio dal disco in windows è consigliato ognitanto fare un pò di pulizia nella cache di windows update (aggiornamenti di windows).

L'operazione è abbastanza semplice:

Per Windows XP/Vista/2003

  1. Fermare il servizio windows update
    1. Avvio --> Esegui --> Cmd
    2. net stop wuauserv
  2. Cancellare tutti i file della Cache
    1. Avvio --> Esegui --> Cmd
    2. cd c:\windows (oppure cd %windir%)
    3. rd /s SoftwareDistribution
    4. y
  3. Avviare il servizio di windows update
    1. Avvio --> Esegui --> Cmd
    2. net start wuauserv
E il gioco è fatto.

Prima del punto 3 è consigliabile fare una defframmentazione del disco.

venerdì 24 aprile 2009

Ubuntu Client in Samba Domain

Questi sono i passi che ho fatto per mettere una workstation Ubuntu 9.04 in un dominio Windows gestito da Samba. Pacchetti da installare: winbind samba samba-common libpam-mount smbfs File da modificare: /etc/pam.d/common-account:
account sufficient pam_winbind.so
/etc/pam.d/common-auth
#auth required pam_cups.so debug
auth required pam_mount.so use_first_pass
auth sufficient pam_winbind.so use_first_pass
auth required pam_unix.so nullok_secure use_first_pass
/etc/pam.d/common-session
session required pam_unix.so nullok_secure
session required pam_mkhomedir.so skel=/etc/skel/ umask=0022
#session optional pam_cups.so debug min_uid=1000
session optional pam_mount.so
/etc/pam.d/common-password
password sufficient pam_winbind.so
password required pam_unix.so nullok obscure min=4 max=8 md5
/etc/security/pam_mount.conf.xml

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE pam_mount SYSTEM "pam_mount.conf.xml.dtd">
<pam_mount>

<debug enable="0" />

<luserconf name=".pam_mount.conf.xml" />

<mntoptions allow="nosuid,nodev,loop,encryption,fsck,nonempty,allow_root,allow_other" />
<mntoptions require="nosuid,nodev" />
<path>/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin</path>

<msg-authpw>password:</msg-authpw>
<msg-sessionpw>reenter password:</msg-sessionpw>

<logout wait="0" hup="0" term="0" kill="0" />

<mkmountpoint enable="1" remove="true" />

</pam_mount>
/etc/samba/smb.conf
workgroup = DOMAIN
server string = %h
security = domain
encrypt passwords = true
wins server = xxx.xxx.xxx.xxx
password server = *
domain master = false
preferred master = false
local master = no
lm announce = false
hosts allow = xxx.xxx.xxx.xxx, 127.0.0.1
hosts deny = all
socket options = TCP_NODELAY IPTOS_LOWDELAY
log file = /var/log/samba/log.%U
log level = 2
pam password change = yes
interfaces = eth0, lo
winbind uid = 1000-10000
winbind gid = 1000-10000
winbind enum users = yes
winbind enum groups = yes
winbind use default domain = yes
winbind cache time = 15
template shell = /bin/bash
template homedir = /home/%U
/etc/nsswitch.conf
passwd:         compat winbind
group:          compat winbind
shadow:         compat
Dopo aver modificato i file riavviare samba e winbind. Effettuare il join nel dominio: net rpc join -S serverpdc -U root Effettuare una verifica wbinfo -u wbinfo -g Dovrebbero venire visualizzati tutti gli utenti e i gruppi del dominio. Ora non rimane che configurare pam_mount per montare le cartelle degli utenti al login. Io ho impostato che venga caricato un file di configurazione di pam_mount diverso per ogni utente, il file si deve trovare nella home dell'utente e si deve chiamare .pam_mount.conf.xml. Questo nome lo si può cambiare modificando nel file /etc/security/pam_mount.conf.xml il parametro <luserconf name=".pam_mount.conf.xml"></luserconf> Questo è un esempio del file .pam_mount.conf.xml:

<pam_mount>
<volume fstype="smbfs" server="doaminserver" path="folder1" mountpoint="~/Server/folder1" />
<volume fstype="smbfs" server="domainserver" path="folder2" mountpoint="~/Server/folder2" />
<volume fstype="smbfs" server="domainserver" path="%(USER)" mountpoint="~/Server/%(USER)" />
</pam_mount>
Dove path è la cartella condivisa sul server, mountpoint è dove verrà montata la cartella. Riavviare il client e il gioco è fatto. Problemi D. Il comando su con utente di dominio non funziona.. R. Ho risolto modificando il file sudouser (visudo) aggiungendo gli utenti hai quali voglio abilitare il comando su. Fonti: http://foss.stat.unipd.it/mediawiki/index.php/Debian_Client_in_a_Samba_Domain http://tech.canterburyschool.org/tech/UbuntuWorkstations/AuthenticationSetup

giovedì 26 febbraio 2009

Shortcuts di Bash

Navigando in internet ho trovato questo elenco di tasti rapidi da utilizzare con bash:

____________CTRL Key Bound_____________
Ctrl + a - Jump to the start of the line
Ctrl + b - Move back a char
Ctrl + c - Terminate the command
Ctrl + d - Delete from under the cursor
Ctrl + e - Jump to the end of the line
Ctrl + f - Move forward a char
Ctrl + k - Delete to EOL
Ctrl + l - Clear the screen
Ctrl + r - Search the history backwards
Ctrl + R - Search the history backwards with multi occurrence
Ctrl + u - Delete backward from cursor
Ctrl + xx - Move between EOL and current cursor position
Ctrl + x @ - Show possible hostname completions
Ctrl + z - Suspend/ Stop the command

____________ALT Key Bound___________
Alt + < - Move to the first line in the history
Alt + > - Move to the last line in the history
Alt + ? - Show current completion list
Alt + * - Insert all possible completions
Alt + / - Attempt to complete filename
Alt + . - Yank last argument to previous command
Alt + b - Move backward
Alt + c - Capitalize the word
Alt + d - Delete word
Alt + f - Move forward
Alt + l - Make word lowercase
Alt + n - Search the history forwards non-incremental
Alt + p - Search the history backwards non-incremental
Alt + r - Recall command
Alt + t - Move words around
Alt + u - Make word uppercase
Alt + back-space - Delete backward from cursor

----------------More Special Keybindings-------------------

Here "2T" means Press TAB twice

$ 2T - All available commands(common)
$ (string)2T - All available commands starting with (string)
$ /2T - Entire directory structure including Hidden one
$ 2T - Only Sub Dirs inside including Hidden one
$ *2T - Only Sub Dirs inside without Hidden one
$ ~2T - All Present Users on system from "/etc/passwd"
$ $2T - All Sys variables
$ @2T - Entries from "/etc/hosts"
$ =2T - Output like ls or dir


Fonte: http://linuxhelp.blogspot.com/2005/08/bash-shell-shortcuts.html

martedì 11 novembre 2008

chmod e umask

  • chmod 777 is the same as umask=000 (or rwx)
  • chmod 666 is the same as umask=111 (or rw-)
  • chmod 555 is the same as umask=222 (or r-x)
  • chmod 444 is the same as umask=333 (or r--)
  • chmod 333 is the same as umask=444 (or -wx)
  • chmod 222 is the same as umask=555 (or -w-)
  • chmod 111 is the same as umask=666 (or --x)
  • chmod 000 is the same as umask=777 (or ---)

lunedì 10 novembre 2008

Gestione cache dns windows xp/vista

Per svuotare la cache dns in windows XP/Vista bisogna lanciare da linea di comando il seguente comando:

ipconfig /flushdns

in Vista, se è attivo l'UAC, bisogna aprire una shell comandi con diritti di amministratore.

Con ipconfig /displaydns visualizziamo tutta la cache.