Tomcat is installed with CATALINA_HOME in /usr/share/tomcat6 and CATALINA_BASE in /var/lib/tomcat6 - tomcat6

I think it is a good question.
I found it also confusing. I installed tomcat few minutes ago (after a while) and I notice they are two different "webapps" places.
at /usr/share/tomcat6/webapps/default_root/
at /var/lib/tomcat6/webapps/ROOT/
The content of both are the same but none of them are symlinks.
When I started tomcat it says:
Quote:
This is the default Tomcat home page. It can be found on the local filesystem at: /var/lib/tomcat6/webapps/ROOT/index.html
Tomcat6 veterans might be pleased to learn that this system instance of Tomcat is installed with CATALINA_HOME in /usr/share/tomcat6 and CATALINA_BASE in /var/lib/tomcat6
So, based in this information, the /usr/share/... folder was kept for backward compatibility, right?
But according to what you posted libs are being read from the CATALINA_HOME instead of CATALINA_BASE.
Perhaps they still keep that default reference to prevent other systems to stop working after updating?
Good observation!
UPDATE:
I read this at: /usr/share/tomcat6/bin/catalina.sh :
Quote:
# CATALINA_HOME May point at your Catalina "build" directory.
#
# CATALINA_BASE (Optional) Base directory for resolving dynamic portions
# of a Catalina installation. If not present, resolves to
# the same directory that CATALINA_HOME points to.
When we read at: /etc/init.d/tomcat6 :
(at the beginning)
CATALINA_HOME=/usr/share/$NAME
(then...)
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
However, If you try to start TOMCAT manually (as I did long time ago) with:
sudo /usr/share/tomcat6/bin/startup.sh
It displays:
Quote:
Using CATALINA_BASE: /usr/share/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME: /usr
touch: cannot touch `/usr/share/tomcat6/logs/catalina.out': No such file or directory
/usr/share/tomcat6/bin/catalina.sh: 357: cannot create /usr/share/tomcat6/logs/catalina.out: Directory nonexistent
So, why here CATALINA_BASE is set to the same as CATALINA_HOME?
/usr/share/tomcat6/logs/ do not exist, but exists in /var/lib/tomcat6/logs/
I see that my logs are writing into /var/lib/... when starting Tomcat from the init.d script. So its better starting it from there.

I'm not an expert on Tomcat but I was having this same problem and I was able to restart the server with the command:
sudo /etc/init.d/tomcat6 restart

CATALINA_HOME -- tells "org.apache.catalina.startup.Bootstrap" where to look for required /lib /bin and other -- which are dependencies to run the server . It is basically your Tomcat installation home directory.
CATALINA_BASE -- expects a certain directory structure to scan for (once started). For example /conf to find server.xml and web.xml which is specific to a web application. as long as you have got that directory structure and content, CATALINA_BASE can be any directory.

I've seen that.
The proper and cute way is to create a "setenv.sh" script into your CATALINA_HOME/bin folder(in your case "/usr/share/tomcat6/bin/setenv.sh").
The contents of your setenv.sh:
#!/bin/sh
export CATALINA_BASE=/new/catalinabase/path
So there is no need to modify catalina.sh by yourself. If setenv.sh is present in bin directory, catalina.sh will execute it automatically.

I can't tell you why CATALINA_HOME and CATALINA_BASE are the same in startup.sh (resp. catalina.sh) - that's really strange.
Of course you can start Tomcat via the init.d script. But sometimes you may want to start it via startup.sh/catalina.sh (e.g. for debugging).
So as a workaround/hack you can correct the problem by adding the following line at the beginning of /usr/share/tomcat6/bin/catalina.sh
export CATALINA_BASE=/var/lib/tomcat6

I could do this by executing this command,
$ service tomcat6 start
which reinitialized my CATALINA_* path and starts the tomcat instance

chmod +x startup.sh
chmod +x shutdown.sh
chmod +x catalina.sh
chmod +x setclasspath.sh
chmod +x bootstrap.jar
chmod +x tomcat-jni.jar
hope it will be work.

Related

Subgit installer For windows

I am trying to migrate from SVN to Git with history data and someone suggests me to use SubGit for this.
I downloaded the zip file and found that there is subgit.bat available in the bin folder after extracting it.
I don't know how to run subgit and ensure subgit installed on my windows system or not because it's throwing me subgit: Command not found
SubGit doesn't require any special installation, you can just unzip it and start to use, the bin/subgit.bat is actually SubGit start script. For convenience sake, it may worth to add the path to SubGit 'bin' folder to PATH environment variable so that subgit can start without issuing the full path every time.
The 'Command not found' error means that Windows cannot find the 'subgit' command -- it happens when there is no program called 'subgit' neither in PATH, nor in current directory. To resolve it either use full path to the 'subgit.bat' file to start the program (like, c:\subgit\bin\subgit.bat) or add SubGit bin directory path to PATH.

how to install check_inode plugin in nagios

i have to install a plugin on a red hat server where nagios is already configured.
the plugin to be installed is inode_checker which i got from this link
how to install inode checker in nagios
but when i opened this link i could find a shell script here.
now i am not sure whether i have to place the shell script directly on the server in the location /usr/local/nagios/libexec/ or is there any other way to do it since the other plugins available in this location seems to be different and i am not able to open them.
what am i doing wrong here?please advise.
Yes, this is a bash script so simply download and place it in the folder where you have other scripts sitting. Make sure to make it executable like
chmod +x scriptname
Then you should be able to use it in nagios by creating a Command object. You can find the location of the folder where your scripts are located by looking at the resources.cfg file which should hold something like below:
$USER1$=/usr/lib64/nagios/plugins
Hope this helps.

What are the right ownership & permissions to the CakePHP app/tmp folder for production?

I would like to know the answers and explanation to the following questions:
Which user/group should own the cake files?
If different, which user/group should own the app/tmp folder? (and subfolders)
With the right user/group, what are the correct permissions for production of both folders and files? (which also if set correctly should work on development)
Where is storing of uploaded files done and what ownership/permissions need to be set to that folder. Where should it be relative to app/?
I know 777 fixes errors, but I would like to set it up correctly.
I have heard 660 should be more than enough for production if everything is correctly set up.
Who needs to have read access, who needs to have write access and does anyone need execute?
NOTE: I think I have found the answers and since no one has written a good answer, I will write it.If you are more knowledgeable on the topic and see errors or security issues please let me know, I will correct them.
1) CakePHP ownership
The CakePHP files should be owned by you, the user of the machine (whatever you log in with). Do not have root as owner!
OSX: the johnsmith part of /Users/johnsmith
Linux: the johnsmith part of /home/johnsmith
2) app/tmp ownership.
As per CakePHP documentation:
...make sure the directory app/tmp and all its subdirectories in your
cake installation are writable by the web server user.
Option 1:
The user owner needs to be apache's user. The group owner can be the group that you belong to, so that you also have access to this folder through finder/CLI. Do not have root as owner!
OSX: Apache is preinstalled on OSX lately and the default user of apache is _www. However if you are not sure you can find it out by typing terminal ps aux | grep httpd while apache runs. The last line is the command you just typed, so look above it.
Now that you know your apache user, you have to assign it to app/tmp/. You do this with the following command: sudo chown -R _www app/tmp/
Linux: The default user on linux is usually www-data with group www-data. If you are not sure, use ps aux | grep httpd to find out the user and sudo chown -R _www app/tmp/ to assign ownership to apache of that folder.
Option 2:
You can keep yourself as the user owner, but you set up the group owner to be the a group that apache belongs to. By default apache has it's own group, but you could create a new group and add apache to it.
OSX: The group of apache on OSX by default is the same os the user: _www. You then have to run the following command to se up the ownership: sudo chown -R :_www app/tmp/. Now if you check the permissions with ls -l you should see both your username (johnsmith) and the new group owner - _www.
Linux:* By default the group of apache is www-data so use the same commands to change ownership: sudo chown -R :www-data app/tmp/.
NOTE: Debian/Ubuntu use www-data, while CentOS uses apache.
3) Permissions
For the site to run, apache needs read and write without execute. For you to access it (assuming you are in the group that owns app/tmp) you also need read and write if you will edit manually things with terminal/finder. All other users should have no rights whatsoever. So:
OSX&Linux: sudo chmod -R 660 app/tmp/. The -R part is to do it recursively for all inside folders. The first 6 is for the user owner (OSX:_www or Linux:www-data), the second 6 is for the group owner (OSX:staff or Linux: johnsmith), the 0 is for all other users/guests.
NOTE: According to this pull request for CakePHP it looks like CakePHP 2.4 will have ability to create subfolders in app/tmp/ which means it will need a 7 instead of 6 for the user now becoming 760.
4) Uploads folder
If you want to upload files, you need a similar setup for the img/uploads folder, or wherever you upload. The ownership will be the same, but the permissions need to have execute rights for renaming purposes and folder creation. so the previously 660 should now be 760. Also, ideally, the uploads are out of the webroot/ directory, for which an absolute path is required.
For all files in app/tmp and subfolders you only need rw for the web server process and if needed to use the CLI, the console user.
If someone runs console commands with a user that has super rights or is in the wrong group it messes up things because what one creates can't be read or written from the other and then there are warning or failure messages. Some people (including me when I'm too lazy) fix that with 777 :)

fatal error when starting postgres on solaris

I'm trying to install postgres on a sun solaris sparc instance in my home directory.
Everything is fine except when I try to start postgres server, I get the following error
FATAL: "/home/reic/var/lib/pgsql/data" is not a valid data directory
DETAIL: File "/home/reic/var/lib/pgsql/data/PG_VERSION" is missing.
I used the command pg_ctl -l logfile start to start the server.
I have followed all the necessary steps for installation on sun solaris.
Any idea as to why is this happening ?
Solution:
All the necessary files are there in the PGDATA directory and I ran it as the same user which is trying to start the server. The problem is with the placement of env variables in the .bashrc instead of .bash_profile file. Apparently the customisations are not propagated to sub shells when the env variables are put in .bashrc.
My bad for not realising this! Thank you all....

xdebug not loading. not found in phpinfo() after apache restart

I've been scouring every resource I could find, but came up empty. I get the dreaded "Waiting for Connection" message in NetBeans 6.9 when I start a debug session. After much reading, most folks are able to get phpinfo() to display that it loaded the xdebug module. Not so with me.
I downloaded the source through SVN using this call
svn co svn://svn.xdebug.org/svn/xdebug/xdebug/trunk xdebug
I switched to the xdebug directory and then ran phpize on the source
sudo /Applications/MAMP/bin/php5/bin/phpize
Password:
grep: /Applications/MAMP/bin/php5/include/php/main/php.h: No such file or directory
grep: /Applications/MAMP/bin/php5/include/php/Zend/zend_modules.h: No such file or directory
grep: /Applications/MAMP/bin/php5/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
A big fat nothing! The referenced directories don't even exist. So, I make the assumption that any .ini tweaking I do beyond this point is useless. If I do a whereis php, I find it in /usr/bin. That's the default php pre-loaded with the OS. I don't want that one. I need to use the php installed with MAMP. I cannot believe how insanely frustrating it is to get this thing working!
For the record, my xdebug section in my php.ini looks like this:
[xdebug]
; xdebug config for Linux and Mac OS X
zend_extension="/Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
xdebug.profiler_enable=1
xdebug.profiler_output_name=xdebug.cachegrind-out.%s.%p
xdebug.remote_log="/Applications/MAMP/logs/xdebug_log.log"
It's a mish-mash of many different attempts to get xdebug to work. So, I don't know which pieces are valid or not.
I throw myself on the mercy of the experts because I obviously am not one of them. I have absolutely no idea how to proceed at this point.
Thanks in advance.
To use phpize in the MAMP directory instead of your system path, you should add MAMP's directory for PHP binaries to your $PATH. Below I'm using MAMP 1.9.1, which offers PHP 5.2 and PHP 5.3. We'll assume you're compiling for PHP 5.3.
Open or create ~/.bash_profile and put the following contents:
#Add MAMP binaries to path
export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH"
You may also need to chmod the binaries inside /Applications/MAMP/bin/php5.3/bin to be executable:
chmod 755 /Applications/MAMP/bin/php5.3/bin/pear
chmod 755 /Applications/MAMP/bin/php5.3/bin/peardev
chmod 755 /Applications/MAMP/bin/php5.3/bin/pecl
chmod 755 /Applications/MAMP/bin/php5.3/bin/phar
chmod 755 /Applications/MAMP/bin/php5.3/bin/phar.phar
chmod 755 /Applications/MAMP/bin/php5.3/bin/php
chmod 755 /Applications/MAMP/bin/php5.3/bin/php-config
chmod 755 /Applications/MAMP/bin/php5.3/bin/phpcov
chmod 755 /Applications/MAMP/bin/php5.3/bin/phpize
Restart your Terminal session for the new $PATH to be loaded. Run the command which phpize and it should display /Applications/MAMP/bin/php5.3/bin/phpize. If not, the path to phpize in your MAMP directory is not being loaded in your $PATH. Use echo $PATH in Terminal to make sure /Applications/MAMP/bin/php5.3/bin is in the $PATH.
To get xDebug to compile, you need the header files from when PHP was compiled. These are available on the MAMP website in a DMG, and called "MAMP Components": http://www.mamp.info/en/downloads/index.html
Unpack MAMP Components and copy MAMP_src to your Desktop. Unpack MAMP_src/php-5.3.2.tar.gz and move it into the include path present in php-config --includes which should include /Applications/MAMP/bin/php5.3/include/php.
cd ~/Desktop/MAMP_src
tar -xvzf php-5.3.2.tar.gz
mkdir -p /Applications/MAMP/bin/php5.3/include
mv php-5.3.2/ /Applications/MAMP/bin/php5.3/include/php
You can now run phpize in the xDebug source dir.
I had a similar problem with XAMPP on Mac OSX 10.6.
I got no version Numbers when running phpize in the xdebug download directory.
PHP Api Version:
Zend Module Api No:
Zend Extension Api No
I had to install the 'Development Package' which adds /Applications/XAMPP/xamppfiles/include and other files to your XAMPP install. Installing the Development Package also fixed pecl so I tried using pecl to install xdebug.
pecl install xdebug
but apache failed to start with error
Failed loading /Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so: dlopen(/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so, 9): no suitable image found. Did find:
/Applications/XAMPP/xamppfiles/lib/php/php-5.3.1/extensions/no-debug-non-zts-20090626/xdebug.so: mach-o, but wrong architecture
I tried compiling from source and got the same 'wrong architecture' errors
Finally I just used the KomodoIDE binary from active state which worked.
I just started working with xdebug myself due to problems with PHP 5.3.1. I had used PECL per instructions a couple weeks ago but it looks like phpize is the new black. I looked over the new instructions (generated from my phpinfo()) # http://xdebug.org/find-binary.php
this is of note:
Run: phpize
As part of its output it should show:
Configuring for:
PHP Api Version: 20090626
...
Zend Extension Api No: 220090626
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
2 things:
have you checked that phpize is up to date?
if that doesnt work try these instructions: http://xdebug.org/docs/install

Resources