Saturday, April 26, 2014

Enabling/Disabling startup services in linux


Redhat, CentOS

ADD a service (in this example vsftpd)
 
# chkconfig vsftpd --add
# chkconfig  vsftpd  on --level 2,3,5


REMOVE a service (in this example vsftpd)

# chkconfig  vsftpd  off 
# chkconfig vsftpd --del


The new process will be added to /etc/init.d and a softlink will be put in all the required /etc/rcX.d folders (X stands for the runlevel)

While to start and stop a service...

# service vsftpd start
# service vsftpd stop
 

All the info you are looking for are available here:
http://www.aboutlinux.info



Friday, April 25, 2014

Authentication in SSH/SFTP via private/public keys

SSH/SFTP  login with public/private keys between a linux machine (server) and a windows (client)

This is a small guide, for mostly personal use, that's why it is not very detailed.
Anyway, the content is derived from the two references below:


(1) http://www.howtoforge.com/ssh_key_based_logins_putty
(2) http://sshkeychain.sourceforge.net/

- Generate keys with PuttyGen
     2048 bit, SSH-2 RSA
    add a key comment like name@machine
    add a passphrase (this is optional and I haven't done it)
- Save  the keys in a safe place
    NOTE: You can also export the private key in other format (SSH, openSSH)
- Copy the public key on the server you want to login into
    in the file  ~/.ssh/authorized_key2
- MODIFY the access of ~/.ssh to be readable/writeable/executable ONLY by that user:
        "chmod 0700 ~/.ssh"
- MODIFY the access of ~/.ssh/autorized_key2 to be readable/writeable ONLY by that user:
        "chmod 0600 ~/.ssh/authorized_keys2"   
- Disable the login with password by modifying (e.g. with vi) the file  "/etc/ssh/sshd_config" as it follows:
   
    Protocol 2
    PasswordAuthentication no
    UsePAM no

   
NOTE: in /etc/ssh there is ssh_config and sshd_config choose the right one!

- Restart the SSH server
    /etc/init.d/sshd restart

That's it.

Monday, March 31, 2014

could not find or load main class [java]

If you got this error "could not find or load main class" trying to execute your freshly compiled java program you have a problem with your classpath variable that doesn't include your current folder.
Solution:

Open the Control Panel -> System -> Advanced System Settings -> Advanced [table] -> environment variables and then "edit" your CLASSPATH adding a dot "." at the end.

PS
You have to re-open your Windows console to make the change active.

From the Oracle documentation
"The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings."

Monday, March 24, 2014

Oracle Database 11g R2: installation hangs [on Windows]!

You are on Windows and Your oracle 11g installation freezes/blocks/stops after the requirements page?

Probably there is an easy solution:

log in as administrator. Even if you tried to install the oracle database11g as a user with admin rights, this is not enough! You have to log in as Amistrator, then it works (probably)!


Oracle 11g R2 client install. hangs on step 5 of 7 in VM with Win. 2008 R2

Friday, March 14, 2014

ASCII, UNICODE, UTF-8, UTF-16, ... character set, encoding ecc

Here I found THE resource on the subjects: character set and encoding.
It's a small and effective guide to the mysterious world of character sets, encodings, Unicode, all that stuff.

http://www.joelonsoftware.com/articles/Unicode.html

Wednesday, March 12, 2014

How to remove Oracle DB 11 and 12 in Windows


http://stackoverflow.com/questions/8450726/how-to-uninstall-completely-remove-oracle-11g-client

http://docs.oracle.com/cd/E16655_01/install.121/e17720/remove_oracle_sw.htm#LADBI7824

  • Uninstall all Oracle components using command line uninstaller located at ORACLE_HOME\deinstall\deinstall
  • Run regedit.exe and delete the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE key. This contains registry entires for all Oracle products.
  • Delete any references to Oracle services left behind in the following part of the registry: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Ora* It should be pretty obvious which ones relate to Oracle.
  • Reboot your machine.
  • Delete the "C:\Oracle" directory, or whatever directory is your ORACLE_BASE.
  • Delete the "C:\Program Files\Oracle" directory.
  • Empty the contents of your "C:\temp" directory.
  • Empty your recycle bin.