Configure Redhat To Start Certain Applications At Boot

March 6th, 2006 § 0 comments § permalink

This page will describe a couple of ways in which you can get Linux (specifically RedHat) to start certain applications (any application really) at boot time. Some of the common apps that people may want to configure to start automatically are Apache, MySQL, Tomcat, JBoss, Zope, xinetd, etc. Most versions of RedHat should come with this handy tool called chkconfig

You may find that it is not in your path by default (eg: on my linux box, chkconfig is in /sbin, but I did not have /sbin in my path by default. So I added /sbin to my path first, in order to gain access to chkconfig easily on the commandline, without having to type /sbin/chkconfig. The first thing you might want to try is something like the following:

netfs           0:off   1:off   2:off   3:on    4:on    5:on    6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
xinetd based services:
chargen-udp: off
rsync: off
chargen: off
daytime-udp: off
daytime: off
echo-udp: off
echo: off
services: off
servers: off
time-udp: off
time: off
cups-lpd: off
sgi_fam: on
ktalk: off
cvspserver: on

The output above is a partial output of the command

chkconfig —list

What the output is basically telling you is which apps that have startup scripts in /etc/init.d are configured to be in an on/off state at which run level. In my example, I want to configure my linux machine to have httpd (which is Apache) start on boot, so the command I want to type to get this to happen is:

chkconfig httpd on

This will ensure that my service httpd from /etc/init.d is in a started state at (by default) run levels 2, 3, 4, and 5 (for all intents and purposes, these run levels indicate a “normal” machine state, describing what all of the run levels mean is much beyond the scope of this document). Now if I reboot my machine, I will notice that httpd was started automatically at boot.

Java SSL Trust Manager

March 6th, 2006 § 0 comments § permalink

How to write a Trust Manager that will allow you to make an HttpsURLConnection to any host, without requiring valid certs, etc.

// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType ) {
}
public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType ) {
}
}
};
// Install the all-trusting trust manager
try {
SSLContext sc = SSLContext.getInstance( "SSL" );
sc.init( null, trustAllCerts, new java.security.SecureRandom() );
HttpsURLConnection.setDefaultSSLSocketFactory( sc.getSocketFactory() );
}
catch ( Exception e ) {
//We can not recover from this exception.
e.printStackTrace();
}
HttpsURLConnection urlc = (HttpsURLConnection) new URL( url ).openConnection();

Create Symbolic Link In Linux

March 6th, 2006 § 0 comments § permalink

This page describes how to create a symbolic link in linux

For example, I want to create a symbolic link in my /usr/local directory called mysql that symbolically links to /usr/local/mysql-standard-4.0.18-pc-linux-i686

Here is what I do:

shell> cd /usr/local
shell> ln -s /usr/local/mysql-standard-4.0.18-pc-linux-i686 mysql
shell> ls -l mysql
shell> lrwxrwxrwx 1 mysql mysql 46 May 30 13:59 mysql -> /usr/local/mysql-standard-4.0.18-pc-linux-i686

The last two commands are just to demonstrate that the link was created. Do a directory listing with ls -l mysql and then you can see that now there is a link mysql that points to the directory /usr/local/mysql-standard-4.0.18-pc-linux-i686.

PNG Transparency Fix For Internet Explorer

March 6th, 2006 § 0 comments § permalink

Recently I’ve been working on a web-app that uses some .png files with transparency in them. Internet Explorer totally screws up the transparency and renders it grey.

There’s a great fix for it here:

http://homepage.ntlworld.com/bobosola/pnghowto.htm

Rumor has it this will go away in Internet Explorer 7, which will be released with Vista probably in 2027 later this year.

Windows FTP And SFTP Client

March 6th, 2006 § 0 comments § permalink

The absolute best ftp and sftp client I have found for Windows (and again, by “best” – I usually mean that it’s free, and works fantastic) is FileZilla.

FileZilla is an open source project over at SourceForge, and you can take a look at it here:

http://filezilla.sourceforge.net/