Monthly Archives: November 2013
JBoss Application Server in windows
JBoss Application Server (or JBoss AS) is a cross platform( usable on any operating system that supports Java) open-source Java EE-based application server. JBoss AS was developed by JBoss, now a division of Red Hat.
Features
Aspect-oriented programming (AOP) support
Clustering
Deployment API
Distributed caching (using JBoss Cache, a standalone product)
Distributed deployment (farming)
Enterprise JavaBeans versions 3 and 2.1
Failover (including sessions)
Hibernate integration (for persistence programming; Java Persistence API or JPA)
Java Authentication and Authorization Service (JAAS)
Java EE Connector Architecture (JCA) integration
Java Management Extensions
Java Server Pages (JSP) / Java Servlet 2.1/2.5 (Tomcat)
JBossWS (JBoss Web Services) for Java EE web services like JAX-WS
JDBC
Load balancing
Management API
OSGi framework
RMI-IIOP (JacORB, contraction of Java and CORBA)
SOAP with Attachments API for Java (SAAJ)
Teiid data virtualization system
Latest stable version (AS7)Design flexibility.
•Unparalleled Speed
In the highly optimized boot process of AS 7, services are started concurrently to eliminate unnecessary waits and to tap into the power of multi-core processors. Non-critical services are kept on ice until first use.
•Modular Design
AS 7 does classloading right. It uses JBoss Modules to provide true application isolation, hiding server implementation classes from the application and only loading the classes your application needs. Modules, packaged as collections of classes, are peers that remain isolated unless explicitly defined as a dependency of another module. Visibility rules have sensible defaults, yet can be customized.
•Exceptionally Lightweight
These optimizations enable AS 7 to run with stock JVM settings and on small devices. It also leaves more headroom for application data and supports higher scalability.
Server profiles can be used to trim unneeded capabilities, allowing to make the server as lean as possible.
•Elegant Administration
The centralized configuration also unifies management. The same configuration file can be used for multiple servers in domain mode. In contrast, standalone mode controls a single instance, similar to how previous versions of JBoss AS were launched.
•Strict Compliance
more strict compliance to the portability expectations of our community of users.
•Easily Testable
Arquillian—a component model for integration tests that execute inside the real runtime environment.
By removing the clutter from your tests and handling deployment and test execution, Arquillian enables you to write tests for just about any use case your application encounters: real tests.
•First class, modern components
Hibernate Core(http://www.hibernate.org/)
Transactions(http://www.jboss.org/jbosstm)
Infinispan(http://www.jboss.org/infinispan)
IronJacamar(http://www.jboss.org/ironjacamar)
RESTEasy(http://www.jboss.org/resteasy)
Weld(http://www.seamframework.org/Weld)
HornetQ(http://www.jboss.org/hornetq)
JGroups(http://www.jgroups.org/)
Mojarra(http://java.net/projects/mojarra/)
Apache CXF(http://cxf.apache.org/)
Arquillian(http://www.jboss.org/arquillian)
Installing and starting JBoss AS on Windows
download from:http://www.jboss.org/jbossas/downloads/
JBoss Web comes with Windows service executable that can run JBoss Web Server as service.
Remember it is a java based,so check java installed properly(supported version,use JDK and path is added)
check with java -version
Installing service
To install the JBoss Web server as Windows service use the provided service.bat batch file
. Change directory to the JBossWeb bin directory
C:\> cd c:\jbossweb-4.0.4RC1-windows-i586\bin
. Install the service
C:\> service.bat install
Starting the service
To start the JBoss Web server as Windows service use Control pannel or net start command.
Start the service
C:\> net start JBossWebServer
. The JBoss Web Server 4 service is starting.
. The JBoss Web Server 4 service was started successfully.
check it is working
Open browser, enter URL: http://localhost:8080
When running in service mode the console output is redirected to the file run.log. You can inspect the file for any errors during service startup.
Stop the service
C:\> net stop JBossWebServer
. The JBoss Web Server 4 service was stopped successfully.
When running in service mode the console output is redirected to the file shutdown.log. You can inspect the file for any errors during service shutdown.
Stopping the service
To restart the JBoss Web server as Windows service use Control pannel.
Removing the service
To remove the JBoss Web server as Windows service use the provided service.bat batch file.
Change directory to the JBossWeb bin directory
C:\> cd c:\jbossweb-4.0.4RC1-windows-i586\bin
. Remove the service
C:\> service.bat uninstall
Reff:https://docs.jboss.org/author/display/AS7/Documentation
http://www.roseindia.net/jboss/buildingwebapplicationwithant.shtml
steps to install mrtg
Step # 1 : Make sure snmp server installed
Please note that snmpd configuration does not require using mrtg with remote network devices such as Routers and switches. If you just want mrtg graphs for router or switch then please refer to step # 4 (as all these devices comes preconfigured with snmpd software).
Run rpm commands query option to find out snmp server installed or not:
# rpm -qa | grep snmp
If snmp installed then please refer step # 2; otherwise snmp server and utils were not present and your need to install them using following steps (login as a root user):
(a) Visit rpmfind.net to get snmp server and utilities rpms. If you are fedora user then use yum command as follows to install it:
# yum install net-snmp-utils net-snmp
(b) If you are RHEL subscriber then use up2date command as follows to install:
#up2date -v -i net-snmp-utils net-snmp
Step # 2 : Determine if snmp server is running or not
Run ‘ps’ command to see if snmp server is running or not:
# ps -aux | grep snmp
Output:
root 5512 0.0 2.3 5872 3012 pts/0 S 22:04 0:00 /usr/sbin/snmpd
Alternatively, you can try any of the following two commands as well:
# lsof -i :199
Output:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAMEsnmpd 5512 root 4u IPv4 34432 TCP *:smux (LISTEN)
OR try out netstat command:
# netstat -natv | grep ‘:199’
Output:
tcp 0 0 0.0.0.0:199 0.0.0.0:* LISTEN
If you found service is running or listing on port 199 then please see step #3; otherwise start service using following command:
# service snmpd start
Make sure snmpd service starts automatically, when linux comes us (add snmpd service):
# chkconfig –add snmpd
Step # 3 : Make sure snmp server configured properly
Run snmpwalk utility to request for tree of information about network entity. In simple words query snmp server for your IP address (assigned to eth0, eth1, lo etc):
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.0.3 = 2
If you can see your IP address then please proceed to step 4; else it is a time to configure snmp server as follows (by default RHEL and RH 8/9 are not configured for snmp server for security reason):
Configure SNMP
(1) Edit file /etc/snmp/snmpd.conf using text editor: # vi /etc/snmp/snmpd.conf
Change/Modify line(s) as follows:
Find following Line:
com2sec notConfigUser default public
Replace with (make sure you replace 192.168.0.0/24 replace with your network IPs) following lines: com2sec local localhost public
com2sec mynetwork 192.168.0.0/24 public
Scroll down bit and change:
Find Lines:
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
Replace with:
group MyRWGroup v1 local
group MyRWGroup v2c local
group MyRWGroup usm local
group MyROGroup v1 mynetwork
group MyROGroup v2c mynetwork
group MyROGroup usm mynetwork
Again scroll down bit and locate following line:
Find line:
view systemview included system
Replace with:
view all included .1 80
Again scroll down bit and change:
Find line:
access notConfigGroup “” any noauth exact systemview none none
Replace with:
access MyROGroup “” any noauth exact all none noneaccess MyRWGroup “” any noauth exact all all none
Scroll down bit and change:
Find lines:
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root (configure /etc/snmp/snmp.local.conf)
Replace with (make sure you supply appropriate values): syslocation Linux (RH3_UP2), Home Linux Router.syscontact Vivek G Gite <vivek@nixcraft.com>
For your convenient, here is my /etc/snmp/snmpd.conf file. Feel free to use this file. Make sure you make backup of your existing file if you use this file as it is.
Start your snmp server and test it:
(a) Make sure when linux comes up snmpd always starts:
# chkconfig snmpd on
(b) Make sure service start whenever Linux comes up (after reboot):
# service snmpd start
(c) Finally test your snmp server:
# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex
Step # 4 : Install mrtg if not installed
Mrtg software may install during initial installation; you can verify if MRTG installed or not with following RPM command:
rpm -qa | grep mrtg
If mrtg already installed please see step # 5; else use rpmfind.net to find MRTG rpm or up2date command to install MRTG software:
# up2date -v -i mrtg
Fedora Linux user can use yum command as follows to install MRTG:
# yum install mrtg
Step # 5 : Commands to Configure mrtg
(a) Create document root to store mrtg graphs/html pages:
# mkdir -p /var/www/html/mymrtg/
(b) Run any one of the following cfgmaker command to create mrtg configuration file:
#cfgmaker –global ‘WorkDir: /var/www/html/mymrtg’ –output /etc/mrtg/mymrtg.cfg public@localhost
OR (make sure your FQDN resolves, in following example i’m using rh9.test.com which is my router FQDN address)
# cfgmaker –global ‘WorkDir: /var/www/html/mymrtg’ –output /etc/mrtg/mymrtg1.cfg public@rh9.test.com
(c) Create default index page for your MRTG configuration:
# indexmaker –output=/var/www/html/mymrtg/index.html /etc/mrtg/mymrtg.cfg
(d) Copy all tiny png files to your mrtg path:
# cp -av /var/www/html/mrtg/*.png /var/www/html/mymrtg/
Step # 6 First test run of mrtg
(a) Run mrtg command from command line with your configuration file:
# mrtg /etc/mrtg/mymrtg.cfg
Note: You may get few warning message for first time; ignore them.
(b) Fire your favorite web browser (like FireFox 😀 ) and type url http://www.your.com/mymrtg/ or http://your-ip/mymrtg/
Step # 7 Create crontab entry so that mrtg graph / images get generated every 5 minutes
(a) Login as a root user or login as a mrtg user and type following command:
# crontab -e
(b) Add mrtg cron job entry to configuration file (append following line to it):
*/5 * * * * /usr/bin/mrtg /etc/mrtg/mymrtg.cfg –logging /var/log/mrtg.log
Save file and you are done with MRTG config issues 🙂
Step # 8 Block ports 161 & 162 at firewall
You do not want to give access to everyone to your snmp server for security reasons. SNMP server uses UDP 161, 162 ports for communication. Use Linux IPTABLES firewall to restrict access to SNMP server
(a) Allow outgoing SNMP server request from your Linux computer. This is useful when you query remote host/router (replace SERVER IO with your real IP):
SERVER=”xxx.xxx.xxx.xxx”
iptables -A OUTPUT -p udp -s $SERVER –sport 1024:65535 -d 0/0 –dport 161:162 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p udp -s 0/0 –sport 161:162 -d $SERVER –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT
(b )Allow incoming SNMP client request via iptables. This is useful when you wish to accept queries for rest of the world (replace SERVER IP with your real IP):
SERVER=”xxx.xxx.xxx.xxx”
iptables -A INPUT -p udp -s 0/0 –sport 1024:65535 -d $SERVER –dport 161:162 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp -s $SERVER –sport 161:162 -d 0/0 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT
Pleae note that above two are just SNMP specific iptables rules. Please consult iptables(8) man page for complete information on iptables
Step # 9 Optional: Protect your MRTG graphs/html pages with password protected directory
Once again, you would like to restrict access to your MRTG reports. This can easily accomplished with Apache webserver’s .htaccess file. If you are on webhosting server with control panel (such as ensim or plesk) then you can use control panel itself to create password-protected directory.
Below is process outlined to protect graphs using apache’s .htaccess file and htpasswd command:
Step # 1: Create .htaccess file in /var/www/html/mymrtg/ directory (add text as follows):
vi /var/www/html/mymrtg/.htaccess
Add following text to file:
AuthName “MRTG Graphs/Html restricted access”
AuthType Basic
AuthUserFile /var/members/.htpasswd
require user mrtgadmin
Step # 2: Create a user and password name (-c assumes first time you are using .htpasswd file):
# htpasswd -c /var/members/.htpasswd mrtgadmin
Installing Tomcat 6 on Ubuntu
If you are running Ubuntu and want to use the Tomcat servlet container, you should not use the version from the repositories as it just doesn’t work correctly. Instead you’ll need to use the manual installation process that I’m outlining here.
Before you install Tomcat you’ll want to make sure that you’ve installed Java. I would assume if you are trying to install Tomcat you’ve already installed java, but if you aren’t sure you can check with the dpkg command like so:
dpkg –get-selections | grep sun-java
This should give you this output if you already installed java:
sun-java6-bin install
sun-java6-jdk install
sun-java6-jre install
If that command has no results, you’ll want to install the latest version with this command:
sudo apt-get install sun-java6-jdk
Installation
Now we’ll download and extract Tomcat from the apache site. You should check to make sure there’s not another version and adjust accordingly.
wget http://apache.hoxt.com/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.tar.gz
tar xvzf apache-tomcat-6.0.14.tar.gz
The best thing to do is move the tomcat folder to a permanent location. I chose /usr/local/tomcat, but you could move it somewhere else if you wanted to.
sudo mv apache-tomcat-6.0.14 /usr/local/tomcat
Tomcat requires setting the JAVA_HOME variable. The best way to do this is to set it in your .bashrc file. You could also edit your startup.sh file if you so chose.
The better method is editing your .bashrc file and adding the bolded line there. You’ll have to logout of the shell for the change to take effect.
vi ~/.bashrc
Add the following line:
export JAVA_HOME=/usr/lib/jvm/java-6-sun
At this point you can start tomcat by just executing the startup.sh script in the tomcat/bin folder.
Automatic Starting
To make tomcat automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown.
sudo vi /etc/init.d/tomcat
Now paste in the following:
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0
You’ll need to make the script executable by running the chmod command:
sudo chmod 755 /etc/init.d/tomcat
The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.
sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat
Tomcat should now be fully installed and operational.
Installing lighttpd under windows
1) Download and install PHP
download the zip package and unzip under c:\
2) Download and install lighttpd
Download win32 version and double click the exe for installation.Use default location for installation “C:\Program Files\Lighttpd”.
3) Start lighttpd
To start lighttpd, go to the lighttpd directory (i.e. “C:\Program Files\lighttpd”), find the file “TestMode.bat” and double-click on it. A console window would open and indicate that the server has been started.
To test that lighttpd is working at this moment, point your browser to http://localhost. You should see a Test Page.
4) Edit lighttpd configuration
Edit the file lighttpd-inc.conf (i.e. “C:\Program Files\Lighttpd\conf\lighttpd-inc.conf”) with the following:
* Remove the comment tag for “mod-cgi”
* Add this line
cgi.assign = ( “.php” => “C:/php/php-cgi.exe” )
5) Edit PHP Configurations
In PHP directory, rename the file php.ini-recommended to php.ini and edit php.ini with the following:
* short_open_tag = On
* display_errors = On
* doc_root = “C:\Progra~1\Lighttpd\htdocs”
6) Test PHP pages serving lighttpd
Create a file info.php under C:\Program Files\Lighttpd\htdocs
Edit the file info.php and add
<?php phpinfo(); ?>
Save the file and open up browser type http://localhost/info.php
Will get the php informations.
xfs filesystem in fedora
XFS is a high-performance journaling file system created by Silicon Graphics, Inc. It is the default file system in IRIX releases 5.3 and onwards and later ported to the Linux kernel. XFS is particularly proficient at parallel IO due to its allocation group based design. This enables extreme scalability of IO threads, filesystem bandwidth, file and filesystem size when spanning multiple storage devices.The filesystem was released under the GNU General Public License in May 2000, and ported to Linux, with the first distribution support appearing in 2001.
* Scalable features and performance from small to truly huge data (petabytes)
* Huge numbers of files (millions)
* Exceptional performance: 500+ MBytes/second
* Designed with log/database (journal) technology as a fundamental part not just an extension to an existing filesystem
* Mission-critical reliability
Scalability of the file system is 2^63 = 9223372036854775808 ie= 9 x 10^18 = 9 exabytes
Installing and configuring XFS on Fedora
#yum install xfsprogs
Find the drive to convert XFS
#fdisk -l
Create a Volume and mount
mkdir volumename
#mkdir /mog
mount -t xfs /dev/sdc /mog
Edit the file in fstab
#echo “/dev/sdc /volume xfs noatime 0 0” >> /etc/fstab
#cat /etc/fstab
http://oss.sgi.com/projects/xfs/
http://www.uoks.uj.edu.pl/resources/flugor/IRIX/xfs-whitepaper.html#architecture
Shrink disk volume using windows 2008 built-in disk management
Shrink disk volume using windows 2008 built-in disk management.
Partition Windows Server 2008 is much easier for the Windows Server 2008 users due to its powerful disk management. Windows Server 2008 is the most recent release of Microsoft Windows’ Server line of operating systems, it has been the first Windows Server Operating System whose Disk Management enables to extend, shirk, format, create, and delete partitions, etc.
Log as an Administrator, go to Server Manager, and find the Administrative Tools folder. Select Computer Management, scroll down till you get to the Storage section, and go to the Disk Management console. Right-click the disk, then you can perform operations on your Windows Server 2008 partitions to shrink partitions.