Showing posts with label Linux. Show all posts
by
Rohit Patel
Rohit Patel
THE BEST OPEN SOURCE SECURITY TOOLS
by
Rohit Patel
Rohit Patel
How to Add the RPMforge Repository in RHEL/CentOS 5
How to Add the RPMforge Repository in RHEL/CentOS 5
RPMforge is a third party RPM repository for Red HatEnterprise Linux or CentOS. here i am going to show how to add the RPMforge repository in Red Hat Enterprise Linux or CentOS 5.
Install yum-priorities
yum install yum-priorities
Plugins are enabled in CentOS 5 by default. To make sure that yum-priorities is enabled. Just type following command to check it:-
vi /etc/yum/pluginconf.d/priorities.conf
Download and install package (i386 – 32bit)
wget http://packages.sw.be/rpmforge-release /rpmforge-release-0.3.6-1.el5.rf.i386.rpm# install the rpmforge yum reporpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm# clean up after ourselvesrm rpmforge-release-0.3.6-1.el5.rf.i386.rpm
Download and install package (x86_64 – 64bit)
wget http://packages.sw.be/rpmforge-release/ rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm# install the rpmforge yum reporpm -Uhv rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm# clean up after ourselvesrm rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
Set priorities
Edit the .repo files in /etc/yum.repos.d/ by adding
priority=N #Note: N is an integer number from 1 to 99vim /etc/yum.repos.d/CentOS-Base.repo[base], [addons], [updates], [extras] ... priority=1[centosplus],[contrib] ... priority=2vim /etc/yum.repos.d/rpmforge.repo [rpmforge] priority=10
Final step, install DAG GPG key
wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt rpm --import RPM-GPG-KEY.dag.txt rm RPM-GPG-KEY.dag.txt
------------------------------------------------------------------------------------------------------------------------
FEED
SUPPORT US
VISIT COUNTER !!
by
Rohit Patel
Rohit Patel
Installing Tomcat 6.x on CentOS 5
UPDATE: This post was revised to work with java6u10 and now includes instructions for automated startup config.
FYI: if you used this post before 11/06, there have been some major changes to the start up script. This new version is the most basic and easiest.
This is a quick and dirty guide for installing Apache Tomcat 6.0.18 on CentOS5. It is based on detailed instructions for CentOS 4 and tomcat 6.0.13 here. If you get no luck, please check out this link for comprehensive explanation and adopt it to your platform.Install pre-requisite
1. Download java JDK 6 Update 10 and Java Runtime Environment (JRE) 6 Update 10 bin (NOT RPM)
2. Open terminal, su to root and move downloaded files to /root directory
2. Open terminal, su to root and move downloaded files to /root directory
$ su root
Password:
# mv [.....]
Password:
# mv [.....]
3. Create java environment
# mkdir /usr/java
# cd /usr/java
# cd /usr/java
4. Execute downloaded jdk and jre bins.
# sh /root/jre-6u10-linux-i586.bin
# sh /root/jdk-6u10-linux-i586.bin
# sh /root/jdk-6u10-linux-i586.bin
5. verify install
# ls
you should see that your /usr/java directory now contains jdk1.6.0_10 and jre1.6.0_10 directories
Install overview
1. Download and extract Apache Ant (apache-ant-1.7.1-bin.tar.gz) to /usr/share
# cd /usr/share
# tar -xzf apache-ant-1.7.1-bin.tar.gz
# tar -xzf apache-ant-1.7.1-bin.tar.gz
2. Download and extract Apache Tomcat (apache-tomcat-6.0.18.tar.gz) to /usr/share
# tar -xzf apache-tomcat-6.0.18.tar.gz
3. Enable ant link
# ln -s /usr/share/apache-ant-1.7.1/bin/ant /usr/bin
4. Set up JAVA_HOME $env in catalina.sh
# cd /usr/share/apache-tomcat-6.0.18/bin
# vi catalina.sh
# vi catalina.sh
5. After the first line, add following
JAVA_HOME=/usr/java/jdk1.6.0_10
6. Test config with Tomcat
# cd /usr/share/apache-tomcat-6.0.18/bin
# ./startup.sh
# ./startup.sh
7. Check logs for errors
# less /usr/share/apache-tomcat-6.0.18/logs/catalina.out
8. Fix errors if any. Go to http://localhost:8080 for Tomcat's web interface.
Automate start up
1. Create script in /etc/init.d for automated start up/shutdown # cd /etc/init.d
# vi tomcat
2. Place following in the file
#!/bin/bash
# chkconfig: 234 20 80
# description: Tomcat Server basic start/shutdown script
# processname: tomcat
JAVA_HOME=/usr/java/jdk1.6.0_10
export JAVA_HOME
TOMCAT_HOME=/usr/share/apache-tomcat-6.0.18/bin
START_TOMCAT=/usr/share/apache-tomcat-6.0.18/bin/startup.sh
STOP_TOMCAT=/usr/share/apache-tomcat-6.0.18/bin/shutdown.sh
start() {
echo -n "Starting tomcat: "
cd $TOMCAT_HOME
${START_TOMCAT}
echo "done."
}
stop() {
echo -n "Shutting down tomcat: "
cd $TOMCAT_HOME
${STOP_TOMCAT}
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
2. Change permissions
# chmod 755 tomcat
3. Add script to system services
# chkconfig --add tomcat
4. Verify modifications (this script uses levels 2-4)
# chkconfig --level 234 tomcat on
# chkconfig --list tomcat
# chkconfig --list tomcat
you should see that service using levels 2, 3 and 4:
tomcat 0:off 1:off 2:on 3:on 4:on 5:off 6:off
tomcat 0:off 1:off 2:on 3:on 4:on 5:off 6:off
5. Test script start up/shutdown
# service tomcat start
# service tomcat stop
So, at this point, tomcat service will start automatically upon reboot. G'luck
-------------------------------------------------------------------------------------------------------------
FEED
SUPPORT US
VISIT COUNTER !!
by
Rohit Patel
Rohit Patel
Installing Java and Apache Tomcat in your CentOS / Redhat Server
Steps :
Installing Java SDK
Step 1: SSH into the server using the following command
ssh –X root@ip-address-of-server
Then provide the root password. Please note that you need to use the root (admin) account itself, since you need super-user privileges to install applications in the server.

Step 2: Install jpackage-utils in the server using
yum install jpackage-utils
You can also get the packages (using wget) from http://www.jpackage.org/ and install them manually.

This will automatically pull the packages from the repository and install them

Step 3: Now we are going to install the Java SE Development Kit 6u22 for Linux. You may check this site to find whether this is latest version or not.
Since I’m going to use wget, I need a direct link to download the package.You can grab the package from here
http://techblog.googlecode.com/files/jdk-6u22-linux-i586-rpm.bin
Now use wget and pull this package to your server.

Step 4: Once it has been downloaded directly to the server, change the permissions accordingly as shown below:
chmod +x package-name.bin
Now issue the following command and verify that Java has been installed properly.
java –version

Installing Tomcat
Since Apache Tomcat is available in the repository, you can use the install command for installing it:
yum install tomcat*
This will install the server.

But in my case, it installed tomcat5 – which is an old version. The new version has a better memory management utility. So I had to remove the installation
remove yum

Installing Tomcat6 manually
As of today the latest version is 6.0.29. So we use the wget utility and download the package from the server:
wget http://apache.mirror.testserver.li/tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
Please note that it is better to download this file to the /opt directory. (You can do this either by ‘cd-ing’ to the directory before issuing the wget or moving the file to /opt once the file has been downloaded).

Now untar the tarball using
tar –xvfz tarball-name.tar.gz
This will extract the items in the tarball and now you need to go to the bin directory in the extracted directory and run the startup.sh script. That’s it!
Now go to localhost:8080 (you may use Lynx for this) and verify that tomcat is running:
lynx
press g
enter “localhost:8080”

NOTE: Now you can try it at ip-address-of-server:8080. Please note that sometimes the datacentre may not have opened the port 8080. In my case, since Nazdrovia is using Planet Inc as the datacentre for providing the frontend and Amazon EC2 as backend, I had to ask them to open the port. So if you are getting a ‘server not found’ error, it is due the firewall – you may ask the datacentre to open it.
Starting Apache Tomcat during bootup
It is hard to run the start-up script manually every time you restart the server. So you may add the location of the script to
nano tomcat-users.xml
Now you need to add the following lines to that xml file:
Please note that you have to change the default passwords of the existing users due to security reasons. Once you have done that you can login to the admin and manager pages :
ip-address-of-server:8080/admin
ip-address-of-server:8080/manager

Managing the service
You can start or stop the tomcat service using the following commands:
/etc/init.d/tomcat6 start
/etc/init.d/tomcat restart
/etc/init.d/tomcat stop
Have fun and enjoy!
FEED
SUPPORT US
VISIT COUNTER !!
Installing Java SDK
Step 1: SSH into the server using the following command
ssh –X root@ip-address-of-server
Then provide the root password. Please note that you need to use the root (admin) account itself, since you need super-user privileges to install applications in the server.
Step 2: Install jpackage-utils in the server using
yum install jpackage-utils
You can also get the packages (using wget) from http://www.jpackage.org/ and install them manually.
This will automatically pull the packages from the repository and install them
Step 3: Now we are going to install the Java SE Development Kit 6u22 for Linux. You may check this site to find whether this is latest version or not.
Since I’m going to use wget, I need a direct link to download the package.You can grab the package from here
http://techblog.googlecode.com/files/jdk-6u22-linux-i586-rpm.bin
Now use wget and pull this package to your server.
Step 4: Once it has been downloaded directly to the server, change the permissions accordingly as shown below:
chmod +x package-name.bin
Now issue the following command and verify that Java has been installed properly.
java –version
Installing Tomcat
Since Apache Tomcat is available in the repository, you can use the install command for installing it:
yum install tomcat*
This will install the server.
But in my case, it installed tomcat5 – which is an old version. The new version has a better memory management utility. So I had to remove the installation
remove yum
Installing Tomcat6 manually
As of today the latest version is 6.0.29. So we use the wget utility and download the package from the server:
wget http://apache.mirror.testserver.li/tomcat/tomcat-6/v6.0.29/bin/apache-tomcat-6.0.29.tar.gz
Please note that it is better to download this file to the /opt directory. (You can do this either by ‘cd-ing’ to the directory before issuing the wget or moving the file to /opt once the file has been downloaded).
Now untar the tarball using
tar –xvfz tarball-name.tar.gz
This will extract the items in the tarball and now you need to go to the bin directory in the extracted directory and run the startup.sh script. That’s it!
Now go to localhost:8080 (you may use Lynx for this) and verify that tomcat is running:
lynx
press g
enter “localhost:8080”
NOTE: Now you can try it at ip-address-of-server:8080. Please note that sometimes the datacentre may not have opened the port 8080. In my case, since Nazdrovia is using Planet Inc as the datacentre for providing the frontend and Amazon EC2 as backend, I had to ask them to open the port. So if you are getting a ‘server not found’ error, it is due the firewall – you may ask the datacentre to open it.
Starting Apache Tomcat during bootup
It is hard to run the start-up script manually every time you restart the server. So you may add the location of the script to
/etc/rc.d/rc.local And it will be executed automatically every time you boot the system.Please note that if you are using a Debian based distribution, then the location of the above mentioned file is at:
/etc/rc.local Admin and Manager roles You need to assign admin and manager roles to the tomcat users in order to manage web apps using a web based interface. (Please note that if you put anything in the web-apps directory of the server, it will be deployed automatically).You can do this by going to the new folder you created by extracting the tarball and editing the tomcat-users.xml file (/conf/tomcat-users.xml).nano tomcat-users.xml
Now you need to add the following lines to that xml file:
Please note that you have to change the default passwords of the existing users due to security reasons. Once you have done that you can login to the admin and manager pages :
ip-address-of-server:8080/admin
ip-address-of-server:8080/manager
Managing the service
You can start or stop the tomcat service using the following commands:
/etc/init.d/tomcat6 start
/etc/init.d/tomcat restart
/etc/init.d/tomcat stop
Have fun and enjoy!
FEED
SUPPORT US
VISIT COUNTER !!
by
Rohit Patel
Rohit Patel
Linux Boot Step
The following are the 6 high level stages of a typical Linux boot process:
1. BIOS
- BIOS stands for Basic Input/Output System
- Performs some system integrity checks
- Searches, loads, and executes the boot loader program.
- It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.
- Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it.
- So, in simple terms BIOS loads and executes the MBR boot loader.
2. MBR
- MBR stands for Master Boot Record.
- It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda
- MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes.
- It contains information about GRUB (or LILO in old systems).
- So, in simple terms MBR loads and executes the GRUB boot loader.
3. GRUB
- GRUB stands for Grand Unified Bootloader.
- If you have multiple kernel images installed on your system, you can choose which one to be executed.
- GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.
- GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).
- Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS. #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/boot/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-194.el5PAE) root (hd0,0) kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/ initrd /boot/initrd-2.6.18-194.el5PAE.img
- As you notice from the above info, it contains kernel and initrd image.
- So, in simple terms GRUB just loads and executes Kernel and initrd images.
4. Kernel
- Mounts the root file system as specified in the “root=” in grub.conf
- Kernel executes the /sbin/init program
- Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
- initrd stands for Initial RAM Disk.
- initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.
5. Init
- Looks at the /etc/inittab file to decide the Linux run level.
- Following are the available run levels
- 0 – halt
- 1 – Single user mode
- 2 – Multiuser, without NFS
- 3 – Full multiuser mode
- 4 – unused
- 5 – X11
- 6 – reboot
- Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program.
- Execute ‘grep initdefault /etc/inittab’ on your system to identify the default run level
- If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that.
- Typically you would set the default run level to either 3 or 5.
6. Runlevel programs
- When the Linux system is booting up, you might see various services getting started. For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your run level.
- Depending on your default init level setting, the system will execute the programs from one of the following directories.
- Run level 0 – /etc/rc.d/rc0.d/
- Run level 1 – /etc/rc.d/rc1.d/
- Run level 2 – /etc/rc.d/rc2.d/
- Run level 3 – /etc/rc.d/rc3.d/
- Run level 4 – /etc/rc.d/rc4.d/
- Run level 5 – /etc/rc.d/rc5.d/
- Run level 6 – /etc/rc.d/rc6.d/
- Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
- Under the /etc/rc.d/rc*.d/ direcotiries, you would see programs that start with S and K.
- Programs starts with S are used during startup. S for startup.
- Programs starts with K are used during shutdown. K for kill.
- There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed.
- For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.
![]() |
| Linux Boot Step |
![]() |
| RP TECH ENTHUSIAST |
FEED
SUPPORT US
VISIT COUNTER !!
by
Rohit Patel
Rohit Patel
Yum in Redhat Enterprise Linux 6.1
Time to look at a few features of yum in RHEL-6.1 now that it's released
Search is more userfriendly
- As we maintain yum we are always looking for the "minor" changes that can make a big difference to the user, and this is probably one of the biggest minor changes. As of late RHEL-5 and RHEL-6.0 "yum search" was great for finding obscure things that you knew something about but with 6.1 we've hopefully made it useful for finding the "everyday" packages you can't remember the exact name of. We did this by excluding a lot of the "extra" hits, when you get a large search result. For instance "yum search kvm manager" is pretty useless in RHEL-6.0, but in RHEL-6.1 you should find what you want very quickly.
Example commands:
yum search kvm manager yum search python url
The updateinfo command
- The "yum-security" or "yum-plugin-security" package has been around since early RHEL-5, but the RHEL-6.1 update has introduced the "updateinfo" command to make things a little easier to use, and you can now easily view installed security errata (to more easily make sure you are secure). We've also added a few new pieces of data to the RHEL updateinfo data. Probably the most significant is that as well as errata being marked "security" or not they are now tagged with their "severity". So you can automatically apply only "critical" security updates, for example.
Example commands:
yum updateinfo list security all yum update-minimal --sec-severity=critical
-
The versionlock command
- As with the previous point we've had "yum-plugin-version" for a long time, but now we've made it easier to use and put all it's functions under a single "versionlock" sub-command. You can now also "exclude" specific versions you don't want, instead of locking to known good specific ones you had tested.
Example commands:
# Lock to the version of yum currently installed. yum versionlock add yum # Opposite, disallow versions of yum currently available: yum versionlock exclude yum yum versionlock list yum versionlock delete yum\* yum versionlock clear # This will show how many "excluded" packages are in each repo. yum repolist -x .
-
Manage your own .repo variables
- This is actually available in RHEL-6.0, but given that almost nobody knows about it I thought I'd share it here. You can put files in "/etc/yum/vars" and then use the names of those files are variables in any yum configuration, just like $basearch or $releasever. There is also a special $uuid variable, so you can track individual machines if you want to.
-
yum has it's own DB
Again, this something that was there in RHEL-6.0 but has improved (and is likely to improve more over time). The most noticeable addition is that we now store the "installed_by" and "changed_by" attributes, this could be worked out from "yum history" before, but now it's easily available directly from the installed package.
Example commands:yumdb yumdb info yum yumdb set installonly keep kernel-2.6.32-71.7.1.el6 yumdb sync
Additional data in "yum history"
- Again, this something that was there in RHEL-6.0 but has improved (and is likely to improve more over time). The most noticeable additions are that we now store the command line and we store a "transaction file" that you can use on other machines. Example commands:
yum history yum history pkgs yum yum history summary yum history undo last yum history addon-info 1 config-main yum history addon-info last saved_tx
-
"yum install" is now fully kickstart compatible
- As of RHEL-6.0 there was one thing you could do in a kickstart package list that you couldn't do in "yum install" and that was to "remove" packages with "-package". As of the RHEL-6.1 yum you can do that, and we also added that functionality to upgrade/downgrade/remove. Apart from anything else, this should make it very easy to turn the kickstart package list into "yum shell" files (which can even be run in kickstart's %post). Example commands:
yum install 'config(postfix) >= 2.7.0' yum install MTA yum install '/usr/kerberos/sbin/*' yum -- install @books -javanotes
-
-
Easier to change yum configuration
We tended to get a lot of feature requests for a plugin to add a command line option so the user could change a single yum.conf variable, and we had to evaluate those requests for general distribution based on how much we thought all users would want/need them. With the RHEL-6.1 yum we created the --setopt so that any option can be changed easily, without having to create a specific bit of code. There were also some updates to the yum-config-manager command.
Example commands:yum --setopt=alwaysprompt=false upgrade yum yum-config-manager yum-config-manager --enable myrepo yum-config-manager --add-repo https://example.com/myrepo.repo
-
-
Working towards managing 10 machines easily
yum is the best way to manage a single machine, but it isn't quite as good at managing 10 identical machines. While the RHEL-6.1 yum still isn't great at this, we've made a few improvements that should help significantly. The biggest is probably the "load-ts" command, and the infrastructure around it, which allows you to easily create a transaction on one machine, test it, and then "deploy" it to a number of other machines. This is done with checking on the yum side that the machines started from the same place (via. rpmdb versions), so that you know you are doing the same operation.Also worth noting is that we have added a plugin hook to the "package verify" operation, allowing things like "puppet" to hook into the verification process. A prototype of what that should allow those kinds of tools to do was written by Seth Vidal here.
Example commands:# Find the current rpmdb version for this machine (available in RHEL-6.0) yum version nogroups # Completely re-image a machine, or dump it's "package image" yum-debug-dump yum-debug-restore --install-latest --ignore-arch --filter-types=install,remove,update,downgrade # This is the easiest way to get a transaction file without modifying the rpmdb echo | yum update blah ls ${TMPDIR:-/tmp}/yum_save_tx-* | sort | tail -1 # You can now load a transaction and/or see the previous transaction from the history yum load-ts /tmp/yum_save_tx-2011-01-17-01-00ToIFXK.yumtx yum -q history addon-info last saved_tx > my-yum-saved-tx.yumtx
-
Red Hat Delivers Red Hat Enterprise Linux 6.1 X86 | 2.86 GB
CLICK BELOW TO DOWNLOAD
Translate
Get In Touch
Visitor Status
Category List
AJAX
Android and iOS
Apache Web Server
ASP.NET AJAX
CCNA
CISCO - IPSEC
Cisco-CCIE
CISSP
Cryptography
DNS
Dual And Triple Boot OS
Ethical Hacking
Exim
Farewell Party Pics
FTP Server
Google Hacks
Google Page Rank
Google Plus vs. Facebook
Hacking Tools
Hacking Videos Training
Hardening PHP Configuration
Hiren’s CD
How to Secure Linux Servers
HTML Injections
JAVA
Linux
Linux Malware Detect ( LMD )
LVM - Logical Volume manager
MCSE
MCTS 2008
MS-Windows
Network
Oracle
Programings
Proxy Servers
SAP
Security
Sever
Shell Scripting
SQL Server
SSH Secure Shell
SSL sites on shared IP via SNI
Virtual Defacement
Vulnerabilities In CMS
Web Attacks
Web Hosting
WEBSITE HACKING
Windows - 7
Windows App
Windows-Server
XSS Cross Site Scripting Basics


