giovedì 5 maggio 2011
venerdì 1 ottobre 2010
Installare Funambol 8.5.2 con Mysql su Tomcat 5.5 esistente
Queste istruzioni sono state testate sul seguente sistema:
SO: CentOS 5
Application Server: Tomcat 5.5.26
Quindi si dà per scontato che le variabili java (JAVA_HOME, JRE_HOME, ecc.) siano già settate e che tomcat sia installato sotto /usr/share/tomcat5
La cartella dove verrà scompattato Funambol si chiamerà $FUNAMBOL_HOME, mentre la sottocartella ds-server DS_SERVER_HOME
1) Scaricare da http://download.forge.objectweb.org/sync4j/ il file funambol-8.5.2.tgz
2) Scompattarlo in /opt (verrà creata una cartella Funambol)
3) Modificare i permessi di tutta la cartella assegnando come propietario tomcat
chown -R tomcat:tomcat /opt/Funambol
4) Copiare i seguenti file/cartelle
$FUNAMBOL_HOME/tools/tomcat/lib/server-framework-8.5.1.jar /usr/share/tomcat5/common/lib
$FUNAMBOL_HOME/tools/tomcat/lib/tomcat-dbcp.jar /usr/share/tomcat5/common/lib
$FUNAMBOL_HOME/tools/tomcat/lib/core-framework-8.5.0.jar /usr/share/tomcat5/common/lib
$FUNAMBOL_HOME/tools/tomcat/lib/log4j-1.2.14.jar /usr/share/tomcat5/common/lib
$FUNAMBOL_HOME/bin/log4j.properties /usr/share/tomcat5/common/classes/
$FUNAMBOL_HOME/config $DS_SERVER_HOME/
ATTENZIONE,Per ogni modifica effettua a Funambol controllare la cartella di configurazione $FUNAMBOL_HOME/config con $DS_SERVER_HOME/config Non ho ancora capito come modificare
5) Modificare il file $FUNAMBOL_HOME/ds-server/install.properties settando i parametri per Mysql:
dbms=mysql
jdbc.classpath=/usr/share/tomcat5/common/lib/mysql-connector-java-5.1.10.jar
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost/funambol?characterEncoding=UTF-8
jdbc.user=funambol
jdbc.password=funambol
6) Creare il database, utente e password in Mysql
mysql> create database funambol;
mysql> GRANT ALL PRIVILEGES ON funambol.* TO 'funambol'@'localhost' IDENTIFIED BY 'funambol';
7) Valorizzare la variabile J2EE_HOME con il path di tomcat5
export J2EE_HOME=/usr/share/tomcat5
8) Modificare nel file $FUNAMBOL_HOME/bin/install il valore APPSRV settandolo a tomcat5
export APPSRV="tomcat55"
9) Lanciare lo script $FUNAMBOL_HOME/bin/install e rispondere y a tutte le domande
10) Modificare il file /usr/share/tomcat5/bin/setenv.sh mettendo le seguenti righe:
export J2EE_HOME=/usr/share/tomcat5
export FUNAMBOL_HOME=/opt/Funambol/ds-server
export CATALINA_OPTS="-Dfunambol.ds.home=$FUNAMBOL_HOME -Dfile.encoding=UTF-8 -Djava.awt.headless=true -server -Xms256m -Xmx512m"
11) Modificare il file /usr/share/tomcat5/conf/context.xml aggiungendo le seguenti righe:
<Resource name="jdbc/fnblds" auth="Container" type="javax.sql.DataSource"
factory="com.funambol.server.db.DataSourceFactory"
/>
<Resource name="jdbc/fnblcore" auth="Container" type="javax.sql.DataSource"
factory="com.funambol.server.db.DataSourceFactory"
/>
<Resource name="jdbc/fnbluser" auth="Container" type="javax.sql.DataSource"
factory="com.funambol.server.db.DataSourceFactory"
/>
12) Copiare il file mysql-connector-java-5.1.10.jar in
$FUNAMBOL_HOME/inbox-listener/lib
$FUNAMBOL_HOME/ctp-server/lib
$FUNAMBOL_HOME/pim-listener/lib
SO: CentOS 5
Application Server: Tomcat 5.5.26
Quindi si dà per scontato che le variabili java (JAVA_HOME, JRE_HOME, ecc.) siano già settate e che tomcat sia installato sotto /usr/share/tomcat5
La cartella dove verrà scompattato Funambol si chiamerà $FUNAMBOL_HOME, mentre la sottocartella ds-server DS_SERVER_HOME
1) Scaricare da http://download.forge.objectweb.org/sync4j/ il file funambol-8.5.2.tgz
2) Scompattarlo in /opt (verrà creata una cartella Funambol)
3) Modificare i permessi di tutta la cartella assegnando come propietario tomcat
chown -R tomcat:tomcat /opt/Funambol
4) Copiare i seguenti file/cartelle
$FUNAMBOL_HOME/tools/tomcat/lib/server-framework-8.5.1.jar /usr/share/tomcat5/common/lib
$FUNAMBOL_HOME/tools/tomcat/lib/tomcat-dbcp.jar /usr/share/tomcat5/common/lib
$FUNAMBOL_HOME/tools/tomcat/lib/core-framework-8.5.0.jar /usr/share/tomcat5/common/lib
$FUNAMBOL_HOME/tools/tomcat/lib/log4j-1.2.14.jar /usr/share/tomcat5/common/lib
$FUNAMBOL_HOME/bin/log4j.properties /usr/share/tomcat5/common/classes/
$FUNAMBOL_HOME/config $DS_SERVER_HOME/
ATTENZIONE,Per ogni modifica effettua a Funambol controllare la cartella di configurazione $FUNAMBOL_HOME/config con $DS_SERVER_HOME/config Non ho ancora capito come modificare
5) Modificare il file $FUNAMBOL_HOME/ds-server/install.properties settando i parametri per Mysql:
dbms=mysql
jdbc.classpath=/usr/share/tomcat5/common/lib/mysql-connector-java-5.1.10.jar
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost/funambol?characterEncoding=UTF-8
jdbc.user=funambol
jdbc.password=funambol
6) Creare il database, utente e password in Mysql
mysql> create database funambol;
mysql> GRANT ALL PRIVILEGES ON funambol.* TO 'funambol'@'localhost' IDENTIFIED BY 'funambol';
7) Valorizzare la variabile J2EE_HOME con il path di tomcat5
export J2EE_HOME=/usr/share/tomcat5
8) Modificare nel file $FUNAMBOL_HOME/bin/install il valore APPSRV settandolo a tomcat5
export APPSRV="tomcat55"
9) Lanciare lo script $FUNAMBOL_HOME/bin/install e rispondere y a tutte le domande
10) Modificare il file /usr/share/tomcat5/bin/setenv.sh mettendo le seguenti righe:
export J2EE_HOME=/usr/share/tomcat5
export FUNAMBOL_HOME=/opt/Funambol/ds-server
export CATALINA_OPTS="-Dfunambol.ds.home=$FUNAMBOL_HOME -Dfile.encoding=UTF-8 -Djava.awt.headless=true -server -Xms256m -Xmx512m"
11) Modificare il file /usr/share/tomcat5/conf/context.xml aggiungendo le seguenti righe:
<Resource name="jdbc/fnblds" auth="Container" type="javax.sql.DataSource"
factory="com.funambol.server.db.DataSourceFactory"
/>
<Resource name="jdbc/fnblcore" auth="Container" type="javax.sql.DataSource"
factory="com.funambol.server.db.DataSourceFactory"
/>
<Resource name="jdbc/fnbluser" auth="Container" type="javax.sql.DataSource"
factory="com.funambol.server.db.DataSourceFactory"
/>
12) Copiare il file mysql-connector-java-5.1.10.jar in
$FUNAMBOL_HOME/inbox-listener/lib
$FUNAMBOL_HOME/ctp-server/lib
$FUNAMBOL_HOME/pim-listener/lib
mercoledì 31 marzo 2010
Reimpostare il valore Autoincrement in una tabella.
Se si deve resettare la tabella (cioè cancellare tutti i dati) e riportare il campo auto_increment a 0 conviene utilizzare questo comando:
Se invece si vuole modificare il valore Auto Increment si utilizza questo comando:
TRUNCATE TABLE tbl_name Se invece si vuole modificare il valore Auto Increment si utilizza questo comando:
ALTER TABLE theTableInQuestion AUTO_INCREMENT=1234
mercoledì 24 marzo 2010
martedì 2 febbraio 2010
Tomcat 6 su CentOS 5
1.Scaricare dal sito della Sun java 6 update 10 jdk e jre versione bin
2.Scaricare da http://ant.apache.org Apache Ant 1.7.1 versione binaria (apache-ant-1.7.1-bin.tar.bz2)
3.Scaricare da http://tomcat.apache.org/ Apache Tomcat 6.0.20 versione binaria (apache-tomcat-6.0.20.tar.gz)
4.Creare la cartella /usr/java
5.Scompattare i file .bin di java in /usr/java
cd /usr/java
sh /root/jre-6u10-linux-i586.bin
sh /root/jdk-6u10-linux-i586.bin
6.Settare la variabile JAVA_HOME che punti in /usr/java/jdk1.6.0_10
7.Estrarre apache-ant in /usr/share
cd /usr/share
tar jxvf /root/apache-ant-1.7.1-bin.tar.bz2
ln -s apache-ant-1.7.1 apache-ant
8.Estrarre apache-tomcat in /usr/share
cd /usr/share
tar zxvf /root/apache-tomcat-6.0.20.tar.gz
ln -s apache-tomcat-6.0.20 tomcat6
9.Creare il link ad ant
ln -s /usr/share/apache-ant/bin/ant /usr/bin
10.Settare JAVA_HOME nel file catalina.sh in /usr/share/tomcat6/bin
11.Creare il file tomcat6 in /etc/init.d simile a questo:
##################START CUT######################################
#!/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 6
tomcat=/usr/share/tomcat6
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/jdk1.6.0_10
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 tomcat6
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
###################### END CUT #################################
INSTALLAZIONE TOMCAT COMPLETATA
Se si vuole accedere agli appplicativi che girano su tomcat senza dover digitare il numero di porta (8080) allora è necessario configurare il jk connectors o il proxy_ajp.
Per il connector jk seguire i seguenti semplici passi:
1.Scaricare il connector da http://tomcat.apache.org/download-connectors.cgi (Binary Release và bene)
2.Rinominare il file scaricato in mod_jk.so e copiarlo nella cartella modules di apache
3.Creare il file jk_connectors.con in /etc/httpd/conf.d:
LoadModule jk_module modules/mod_jk.so
# Configuration for mod_jk.so.
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkShmFile /var/log/httpd/jk-runtime-status
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount /app/* ajp13
JkMount /app2/* ajp13
4.Creare il file workers.properties in /etc/httpd/conf:
workers.tomcat_home=/usr/share/tomcat6/
workers.java_home=/usr/java/jdk
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.default.lbfactor=1
5.Avviare apache.
2.Scaricare da http://ant.apache.org Apache Ant 1.7.1 versione binaria (apache-ant-1.7.1-bin.tar.bz2)
3.Scaricare da http://tomcat.apache.org/ Apache Tomcat 6.0.20 versione binaria (apache-tomcat-6.0.20.tar.gz)
4.Creare la cartella /usr/java
5.Scompattare i file .bin di java in /usr/java
cd /usr/java
sh /root/jre-6u10-linux-i586.bin
sh /root/jdk-6u10-linux-i586.bin
6.Settare la variabile JAVA_HOME che punti in /usr/java/jdk1.6.0_10
7.Estrarre apache-ant in /usr/share
cd /usr/share
tar jxvf /root/apache-ant-1.7.1-bin.tar.bz2
ln -s apache-ant-1.7.1 apache-ant
8.Estrarre apache-tomcat in /usr/share
cd /usr/share
tar zxvf /root/apache-tomcat-6.0.20.tar.gz
ln -s apache-tomcat-6.0.20 tomcat6
9.Creare il link ad ant
ln -s /usr/share/apache-ant/bin/ant /usr/bin
10.Settare JAVA_HOME nel file catalina.sh in /usr/share/tomcat6/bin
11.Creare il file tomcat6 in /etc/init.d simile a questo:
##################START CUT######################################
#!/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 6
tomcat=/usr/share/tomcat6
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/jdk1.6.0_10
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 tomcat6
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 1
esac
exit 0
###################### END CUT #################################
INSTALLAZIONE TOMCAT COMPLETATA
Se si vuole accedere agli appplicativi che girano su tomcat senza dover digitare il numero di porta (8080) allora è necessario configurare il jk connectors o il proxy_ajp.
Per il connector jk seguire i seguenti semplici passi:
1.Scaricare il connector da http://tomcat.apache.org/download-connectors.cgi (Binary Release và bene)
2.Rinominare il file scaricato in mod_jk.so e copiarlo nella cartella modules di apache
3.Creare il file jk_connectors.con in /etc/httpd/conf.d:
LoadModule jk_module modules/mod_jk.so
# Configuration for mod_jk.so.
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkShmFile /var/log/httpd/jk-runtime-status
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount /app/* ajp13
JkMount /app2/* ajp13
4.Creare il file workers.properties in /etc/httpd/conf:
workers.tomcat_home=/usr/share/tomcat6/
workers.java_home=/usr/java/jdk
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.default.lbfactor=1
5.Avviare apache.
martedì 1 dicembre 2009
Espandere Disco VMWare
Queste sono semplici istruzioni per aumentare la dimensione di disco di una macchina virtuale su vmware esx 3.5.
Estendere un disco virtuale solo se non ci sono delle snapshot attive, altrimenti queste non funzioneranno più.
- Spegnere la macchina virtuale
- Creare una copia di backup del disco da espandere
- Creare una copia di backup del disco da espandere
- Collegarsi alla console del server vmware
- Individuare il disco da modificare
- Lanciare il comando vmkfstools -X K/M/G disk.vmdk questo aumenta il disco di tot Kb/Mb/Gb. Es. vmkfstools -X 10G mydisk.vmdk porta il disco mydisk.vmdk a 10GB
- Avviare la macchina virtuale utilizzando un cd per le modifiche delle partizioni (consiglio gparted) e aumentare la partizione.
- Se la macchina virtuale è windows è consigliabile eseguire un defrag dopo aver avviato windows.
Estendere un disco virtuale solo se non ci sono delle snapshot attive, altrimenti queste non funzioneranno più.
mercoledì 23 settembre 2009
Trucchi Google
1) Ricerca ordinata per data (dal più recente):
Dopo aver effettuato la ricerca aggiungere alla fine del link
Dopo aver effettuato la ricerca aggiungere alla fine del link
&as_qdr=d
martedì 15 settembre 2009
ACL File Sytem avanzate
Comandi per gestione acl:
setfacl -b file - Rimuove le acl estese
setfacl -m u:user1:r file - Aggiunge il permesso all'utente user1 di lettura sul file
setfacl -m g:group1:r file - Aggiunge il permesso al gruppo group1 di lettura sul file
setfacl -x g:"group1" file - Rimuove il gruppo dal file
Altre Opzioni
-R Recursive
--restore=file_backup Ripristana le acl scritte nel file file_backup, creato con il comando getfacl -RP --skip-base.

setfacl -b file - Rimuove le acl estese
setfacl -m u:user1:r file - Aggiunge il permesso all'utente user1 di lettura sul file
setfacl -m g:group1:r file - Aggiunge il permesso al gruppo group1 di lettura sul file
setfacl -x g:"group1" file - Rimuove il gruppo dal file
Altre Opzioni
-R Recursive
--restore=file_backup Ripristana le acl scritte nel file file_backup, creato con il comando getfacl -RP --skip-base.
mercoledì 9 settembre 2009
Configurazioni Varie JasperServer 3.5
1 - Invio Posta elettronica
Per configurare JasperServer 3.5 per inviare i mail bisogna modificare i seguenti file:
js.quartz.properties - Inserire i parametri per l'invio dei mail (smtp server, email mittente, username e password).
applicationContext-report-scheduling.xml - Abilitare l'autenticazione inserendo le seguenti righe dentro il tag <bean id="reportSchedulerMailSender">:
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
</props>
</property>

Per configurare JasperServer 3.5 per inviare i mail bisogna modificare i seguenti file:
js.quartz.properties - Inserire i parametri per l'invio dei mail (smtp server, email mittente, username e password).
applicationContext-report-scheduling.xml - Abilitare l'autenticazione inserendo le seguenti righe dentro il tag <bean id="reportSchedulerMailSender">:
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
</props>
</property>
lunedì 31 agosto 2009
Comandi Utili
Trovare UUID
# blkid
Copia completa partizione con permessi e special files
# cp -dpRx /* /mnt/
Wget download tutti i file gif da una cartella
#wget -r -l1 --no-parent -A.gif http://www.server.com/dir/

# blkid
Copia completa partizione con permessi e special files
# cp -dpRx /* /mnt/
Wget download tutti i file gif da una cartella
#wget -r -l1 --no-parent -A.gif http://www.server.com/dir/
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.

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:
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

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.pidPer 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
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
Prima del punto 3 è consigliabile fare una defframmentazione del disco.
L'operazione è abbastanza semplice:
Per Windows XP/Vista/2003
- Fermare il servizio windows update
- Avvio --> Esegui --> Cmd
- net stop wuauserv
- Cancellare tutti i file della Cache
- Avvio --> Esegui --> Cmd
- cd c:\windows (oppure cd %windir%)
- rd /s SoftwareDistribution
- y
- Avviare il servizio di windows update
- Avvio --> Esegui --> Cmd
- net start wuauserv
Prima del punto 3 è consigliabile fare una defframmentazione del disco.
mercoledì 6 maggio 2009
Dropbox, l’innovativo servizio di storage online
La combinazione di tasti “Ctrl Alt Backspace” disabilitata nelle principali distro. Ecco come riabilitarla | TuxFeed
La combinazione di tasti “Ctrl Alt Backspace” disabilitata nelle principali distro. Ecco come riabilitarla | TuxFeed
Posted using ShareThis
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
____________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
$ 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.
ipconfig /flushdns
in Vista, se è attivo l'UAC, bisogna aprire una shell comandi con diritti di amministratore.
Con ipconfig /displaydns visualizziamo tutta la cache.
Iscriviti a:
Post (Atom)