Category Archives: Centos

Data privacy ( LUKS )

3-lukscryptsetup luksFormat /dev/vdb1 ( insert password )
cryptsetup luksOpen /dev/vdb1 crypdisk

now you can format the device pointing the dev mapper :

mkfs -t ext4 /dev/mapper/vdb1

mkdir /secret ; mount /dev/mapper/cryptdisk /secret

vi /etc/passfile

<password>

adding the config to crypttab :

cryptdisk /dev/mapper/vdb1   /etc/passfile

adding the config to fstab :

/dev/mapper/vdb1     /secret      ext4    defaults 0 0

JBoss 7 as Service on linux Redhat

jboss-at-7

Create a file under /etc/init.d/ called jboss

chmod 755 jboss
vi /etc/init.d/jboss and add the following text :

#!/bin/sh
### BEGIN INIT INFO
# Reference: http://stackoverflow.com/questions/6880902/start-jboss-7-as-a-service-on-linux
# Provides: jboss
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop JBoss AS v7.0.0
### END INIT INFO
#
#source some script files in order to set and export environmental variables
#as well as add the appropriate executables to $PATH
#[ -r /etc/profile.d/java.sh ] && . /etc/profile.d/java.sh
#[ -r /etc/profile.d/jboss.sh ] && . /etc/profile.d/jboss.sh

export JBOSS_HOME=/opt/jboss-as-web-7.0.2.Final/

case “$1” in
start)
echo “Starting JBoss AS 7.0.2”
sudo -u jboss sh ${JBOSS_HOME}/bin/standalone.sh -b 0.0.0.0 > /dev/null 2>&1 &
;;
stop)
echo “Stopping JBoss AS 7.0.0”
sudo -u jboss sh ${JBOSS_HOME}/bin/jboss-admin.sh –connect command=:shutdown > /dev/null 2>&1 &
;;
*)
echo “Usage: /etc/init.d/jboss {start|stop}”
exit 1
;;
esac

exit 0

with standalone.sh -b 0.0.0.0 means that jbossis binded on all ip’s

chkconfig –add jboss && chkconfig jboss on

mrepo per Spacewalk

Use mrepo to download the files.

– tar xvf mrepo-0.8.6.tar
– cd mrepo-0.8.6/ && make install
– cp rhel4es.conf /etc/mrepo.conf.d
– cp mrepo.conf /etc/
– vi /etc/sysconfig/rhn/sources
– add : up2date default
– add up2date-uuid
– uuidgen
– vi /etc/sysconfig/rhn/up2date-uuid/
– add: rhnuuid=4a9179f7-b462-497e-b40a-1876df68a530
5. Generate SystemIDs’
– gensystemid -u -p –release=4ES
–arch=i386 /opt/apps/spacewalk/mrepo/4ES-i386/
– gensystemid -u -p –release=4AS
–arch=x86_64 /opt/apps/spacewalk/mrepo/4AS-x86_64/

6. Download Content
– rhnget –download-all -s /opt/apps/spacewalk/mrepo/4ES-i386/systemid
-vv rhns:///rhel-i386-es-4 /opt/apps/spacewalk/rpms/rhel4es-i386/