Wednesday, February 27, 2013

Software installed via repository and via untarring

As of March 31, 2013

Via Ubuntu repository

sudo apt-get install apache2
sudo apt-get install subversion
sudo apt-get install mysql-server
sudo apt-get install mysql-client

Via download and untarring

jdk1.7.0_15
apache-maven-2.2.1
apache-tomcat-7.0.37
jboss-as-7.1.1.Final
eclipse-juno
apache-activemq-5.8.0

Changing the default (bash) shell

One way of changing the default login shell, which happens to be the bash shell is as follows. You need to be an administrative user to do it.

sudo vi /etc/paswd

Find you user name in the above file and change the bash invocation on that line to another shell type.

Note that the csh or ksh is not installed by default in Ubuntu, so if you need those shells, you have to install them from the Ubuntu repository.

Environment variables

In Windows, environment variables, once set - either at the user level or the system level are available regardless of how many new command prompt windows are opened.

In Linux, it is a different story. If you need to have environment variables available to all your shell windows - interactive or not, you need to export them after setting them first. Without the export, the environment variable is only available for the current shell and will not be seen in another shell.

Thursday, February 2, 2012

Linux kernel version you're running


There are many ways to find out as shown below. As can be seen here, I am running Linux kernel version 3 on my Ubuntu 11.10 installation.

suraj@suraj-Satellite-T135D:~$ uname -r
3.0.0-15-generic
suraj@suraj-Satellite-T135D:~$
suraj@suraj-Satellite-T135D:~$ more /proc/version
Linux version 3.0.0-15-generic (buildd@crested) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #26-Ubuntu SMP Fri Jan 20 1
7:23:00 UTC 2012
suraj@suraj-Satellite-T135D:~$
suraj@suraj-Satellite-T135D:~$ dmesg | grep Linux
[    0.000000] Linux version 3.0.0-15-generic (buildd@crested) (gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) ) #26-Ubuntu SMP Fri Jan 20 17:23:00 UTC 2012 (Ubuntu 3.0.0-15.26-generic 3.0.13)
[    0.182604] [Firmware Bug]: ACPI: BIOS _OSI(Linux) query ignored
[    0.656368] Linux agpgart interface v0.103
[   19.260366] Linux video capture interface: v2.00
suraj@suraj-Satellite-T135D:~$
suraj@suraj-Satellite-T135D:~$ ls /boot
abi-3.0.0-12-generic     config-3.0.0-15-generic      memtest86+_multiboot.bin     vmcoreinfo-3.0.0-14-generic
abi-3.0.0-13-generic     grub                         System.map-3.0.0-12-generic  vmcoreinfo-3.0.0-15-generic
abi-3.0.0-14-generic     initrd.img-3.0.0-12-generic  System.map-3.0.0-13-generic  vmlinuz-3.0.0-12-generic
abi-3.0.0-15-generic     initrd.img-3.0.0-13-generic  System.map-3.0.0-14-generic  vmlinuz-3.0.0-13-generic
config-3.0.0-12-generic  initrd.img-3.0.0-14-generic  System.map-3.0.0-15-generic  vmlinuz-3.0.0-14-generic
config-3.0.0-13-generic  initrd.img-3.0.0-15-generic  vmcoreinfo-3.0.0-12-generic  vmlinuz-3.0.0-15-generic
config-3.0.0-14-generic  memtest86+.bin               vmcoreinfo-3.0.0-13-generic
suraj@suraj-Satellite-T135D:~$

Proxy settings and tinyproxy

Browser Details




System proxy settings in Ubuntu (11.10)

Navigate to System Settings - Network - Wireless.

Internet connection using laptop Wi-Fi to Netgear Wireless Router / Comcast Broadband



Internet connection using laptop Wi-Fi to AT&T Elevate 4G Wireless Broadband



Navigate to System Settings - Network - Proxy.

This is the default setting (no proxy).



Manual proxy configuration

Tuesday, January 31, 2012

Startup services and run levels

The /etc directory has (among other) the following directory entries.


drwxr-xr-x  2 root root     4096 2012-01-29 12:20 rc0.d
drwxr-xr-x  2 root root     4096 2012-01-29 12:20 rc1.d
drwxr-xr-x  2 root root     4096 2012-01-29 12:20 rc2.d
drwxr-xr-x  2 root root     4096 2012-01-29 12:20 rc3.d
drwxr-xr-x  2 root root     4096 2012-01-29 12:20 rc4.d
drwxr-xr-x  2 root root     4096 2012-01-29 12:20 rc5.d
drwxr-xr-x  2 root root     4096 2012-01-29 12:20 rc6.d


Each of these corresponds to a particular runlevel.


In Ubuntu, runlevel 0 is for powerdown, runlevel 6 is for reboot, runlevel 1 is for single user mode and runlevels 2-5 represent regular multi-user mode with GUI and are all the same. (Other Linux OSes may make a distinction but Ubuntu does not).


Let's take a look at the run level 5 directory.


suraj@suraj-Satellite-T135D:/etc/rc5.d$ ls -l
total 4
-rw-r--r-- 1 root root 677 2011-12-15 01:40 README
lrwxrwxrwx 1 root root  26 2012-01-02 08:00 S20clamav-freshclam -> ../init.d/clamav-freshclam
lrwxrwxrwx 1 root root  20 2011-10-30 22:30 S20kerneloops -> ../init.d/kerneloops
lrwxrwxrwx 1 root root  27 2011-10-30 22:30 S20speech-dispatcher -> ../init.d/speech-dispatcher
lrwxrwxrwx 1 root root  19 2012-01-29 08:14 S20tinyproxy -> ../init.d/tinyproxy
lrwxrwxrwx 1 root root  29 2011-10-30 22:30 S20unattended-upgrades -> ../init.d/unattended-upgrades
lrwxrwxrwx 1 root root  19 2011-10-30 22:30 S25bluetooth -> ../init.d/bluetooth
lrwxrwxrwx 1 root root  20 2011-10-30 22:30 S50pulseaudio -> ../init.d/pulseaudio
lrwxrwxrwx 1 root root  15 2011-10-30 22:30 S50rsync -> ../init.d/rsync
lrwxrwxrwx 1 root root  15 2011-10-30 22:30 S50saned -> ../init.d/saned
lrwxrwxrwx 1 root root  19 2011-10-30 22:30 S70dns-clean -> ../init.d/dns-clean
lrwxrwxrwx 1 root root  18 2011-10-30 22:30 S70pppd-dns -> ../init.d/pppd-dns
lrwxrwxrwx 1 root root  14 2011-10-30 22:30 S75sudo -> ../init.d/sudo
lrwxrwxrwx 1 root root  17 2012-01-29 12:20 S92tomcat6 -> ../init.d/tomcat6
lrwxrwxrwx 1 root root  22 2011-10-30 22:30 S99acpi-support -> ../init.d/acpi-support
lrwxrwxrwx 1 root root  21 2011-10-30 22:30 S99grub-common -> ../init.d/grub-common
lrwxrwxrwx 1 root root  18 2011-10-30 22:30 S99ondemand -> ../init.d/ondemand
lrwxrwxrwx 1 root root  18 2011-10-30 22:30 S99rc.local -> ../init.d/rc.local
 

Let's take a look at the README file in this directory.


suraj@suraj-Satellite-T135D:/etc/rc5.d$ more README
The scripts in this directory are executed each time the system enters
this runlevel.

The scripts are all symbolic links whose targets are located in
/etc/init.d/ .

To disable a service in this runlevel, rename its script in this
directory so that the new name begins with a 'K' and a two-digit
number, and run 'update-rc.d script defaults' to reorder the scripts
according to dependencies.  A warning about the current runlevels
being enabled not matching the LSB header in the init.d script will be
printed.  To re-enable the service, rename the script back to its
original name beginning with 'S' and run update-rc.d again.

For a more information see /etc/init.d/README.

Monday, January 30, 2012

Tomcat installation



Note
Tomcat6 and Tomcat7 cannot be installed at the same time as a Ubuntu service. You have to make a choice. Otherwise the apt-get command is going to give you a package dependency error on the second tomcat installation (whichever one it is). If you want to install both of them at the same time, the only option is to extract the compressed tar and not install - with either one or both the versions of Tomcat.

Installation

Tomcat 6 is available from the Ubuntu repository, so we can use apt-get to download and install the package for us.
cgirl@cgirl-Satellite-T135D:~$ sudo apt-get install tomcat6
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  authbind libcommons-dbcp-java libcommons-pool-java libecj-java libtomcat6-java tomcat6-common
Suggested packages:
  libgeronimo-jta-1.0.1b-spec-java ecj libecj-java-gcj tomcat6-docs tomcat6-admin tomcat6-examples
  tomcat6-user libtcnative-1
The following NEW packages will be installed:
  authbind libcommons-dbcp-java libcommons-pool-java libecj-java libtomcat6-java tomcat6 tomcat6-common
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/4,633 kB of archives.
After this operation, 5,984 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Preconfiguring packages ...
Selecting previously deselected package libcommons-pool-java.
(Reading database ... 252142 files and directories currently installed.)
Unpacking libcommons-pool-java (from .../libcommons-pool-java_1.5.6-1_all.deb) ...
Selecting previously deselected package libcommons-dbcp-java.
Unpacking libcommons-dbcp-java (from .../libcommons-dbcp-java_1.4-1ubuntu1_all.deb) ...
Selecting previously deselected package libecj-java.
Unpacking libecj-java (from .../libecj-java_3.5.1-3_all.deb) ...
Selecting previously deselected package libtomcat6-java.
Unpacking libtomcat6-java (from .../libtomcat6-java_6.0.32-5ubuntu1.1_all.deb) ...
Selecting previously deselected package tomcat6-common.
Unpacking tomcat6-common (from .../tomcat6-common_6.0.32-5ubuntu1.1_all.deb) ...
Selecting previously deselected package tomcat6.
Unpacking tomcat6 (from .../tomcat6_6.0.32-5ubuntu1.1_all.deb) ...
Selecting previously deselected package authbind.
Unpacking authbind (from .../authbind_1.2.0build3_amd64.deb) ...
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Setting up libcommons-pool-java (1.5.6-1) ...
Setting up libcommons-dbcp-java (1.4-1ubuntu1) ...
Setting up libecj-java (3.5.1-3) ...
Setting up libtomcat6-java (6.0.32-5ubuntu1.1) ...
Setting up tomcat6-common (6.0.32-5ubuntu1.1) ...
Setting up tomcat6 (6.0.32-5ubuntu1.1) ...

Creating config file /etc/default/tomcat6 with new version
Adding system user `tomcat6' (UID 117) ...
Adding new user `tomcat6' (UID 117) with group `tomcat6' ...
Not creating home directory `/usr/share/tomcat6'.
 * Starting Tomcat servlet engine tomcat6                                                          [ OK ]
Setting up authbind (1.2.0build3) ...

Tomcat is installed as a service.
cgirl@cgirl-Satellite-T135D:/etc/init.d$ ls -l tomcat6
-rwxr-xr-x 1 root root 7149 2011-09-15 05:46 tomcat6
cgirl@cgirl-Satellite-T135D:/etc/init.d$

Here are a few lines from the tomcat6 script shown above.
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=tomcat6
DESC="Tomcat servlet engine"
DEFAULT=/etc/default/$NAME
JVM_TMP=/tmp/tomcat6-tmp

# Run Tomcat 6 as this user ID and group ID
TOMCAT6_USER=tomcat6
TOMCAT6_GROUP=tomcat6
# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in $DEFAULT)
JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-sun /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun /u
sr/lib/j2sdk1.5-ibm"

# Directory where the Tomcat 6 binary distribution resides
CATALINA_HOME=/usr/share/$NAME
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
# Define other required variables
CATALINA_PID="/var/run/$NAME.pid"
CATALINA_SH="$CATALINA_HOME/bin/catalina.sh"


From the above lines, we can conclude this is where Tomcat 6 is actually installed.
cgirl@cgirl-Satellite-T135D:/usr/share/tomcat6$ ls -l
total 16
drwxr-xr-x 2 root root 4096 2012-01-29 12:20 bin
-rw-r--r-- 1 root root   39 2011-09-15 05:46 defaults.md5sum
-rw-r--r-- 1 root root 1960 2011-09-15 05:46 defaults.template
drwxr-xr-x 2 root root 4096 2012-01-29 12:20 lib


We can also conclude that the following directory is where the configuration files and webapps reside.
cgirl@cgirl-Satellite-T135D:/var/lib/tomcat6$ ls -l
total 16
drwxr-xr-x 3 tomcat6 tomcat6 4096 2012-01-29 12:20 common
lrwxrwxrwx 1 root    root      12 2011-10-13 19:07 conf -> /etc/tomcat6
lrwxrwxrwx 1 root    root      17 2011-10-13 19:07 logs -> ../../log/tomcat6
drwxr-xr-x 3 tomcat6 tomcat6 4096 2012-01-29 12:20 server
drwxr-xr-x 3 tomcat6 tomcat6 4096 2012-01-29 12:20 shared
drwxrwxr-x 3 tomcat6 tomcat6 4096 2012-01-29 12:20 webapps
lrwxrwxrwx 1 root    root      19 2011-10-13 19:07 work -> ../../cache/tomcat6



The log file for the server is in this directory (the catalina.out file).
cgirl@cgirl-Satellite-T135D:/var/log/tomcat6$ ls -l
total 16
-rw-r--r-- 1 tomcat6 tomcat6 2253 2012-01-29 14:15 catalina.2012-01-29.log
-rw-r--r-- 1 tomcat6 tomcat6 1927 2012-01-30 19:13 catalina.2012-01-30.log
-rw-r--r-- 1 tomcat6 root    4180 2012-01-30 19:13 catalina.out
-rw-r--r-- 1 tomcat6 tomcat6    0 2012-01-29 12:20 localhost.2012-01-29.log
-rw-r--r-- 1 tomcat6 tomcat6    0 2012-01-30 00:52 localhost.2012-01-30.log

cgirl@cgirl-Satellite-T135D:/var/log/tomcat6$


Here's how a successful startup looks.
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
Jan 29, 2012 2:10:17 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor ROOT.xml
Jan 29, 2012 2:10:18 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 29, 2012 2:10:18 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 665 ms
Jan 29, 2012 2:15:49 PM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Jan 29, 2012 2:15:50 PM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jan 29, 2012 2:15:50 PM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Jan 30, 2012 12:52:57 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 30, 2012 12:52:57 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1367 ms
Jan 30, 2012 12:52:57 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 30, 2012 12:52:57 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
Jan 30, 2012 12:52:57 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor ROOT.xml
Jan 30, 2012 12:52:57 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jan 30, 2012 12:52:57 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 544 ms

 

Here's how a shutdown looks.
Jan 30, 2012 12:59:57 AM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Jan 30, 2012 12:59:58 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Jan 30, 2012 12:59:58 AM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080


Tomcat 6 configuration - server.xml, context.xml and web.xml

 In $CATALINA_BASE/conf, you can find these 3 files.