Archive for the ‘CentOS’ Category

Upgrade to PHP 5.2 in CentOS 5.3

Thursday, July 23rd, 2009
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

Force mount Linux RAID md3

Wednesday, April 1st, 2009

mdadm -A /dev/md3 –force   # force to assembly the RAID
mdadm –detail /dev/md3 # show the details on the RAID configuration
mdadm /dev/md3 -a /dev/sdd1  #add in the additional partition into the RAID

How to see grub boot menu. XEN Guest OS

Tuesday, March 31st, 2009

xm create -c xen_1521

How to increase RAID rebuilt speed

Sunday, March 2nd, 2008

echo -n 500000 > /proc/sys/dev/raid/speed_limit_max

extract a file from DAR

Friday, November 9th, 2007

Gosh, you have remove a important file by error. Thus, you just need to restore it, not the rest of the full and differential backups.

a) First method:

We could as previously, try all archive starting from the full backup up to the most recent differential backup, and restore just the file if it is present in the archive:

dar -R / -x /zip/linux_full -g home/denis/my_precious_file

This would restore only the file /home/denis/my_precious_file from the full backup.

OK, now we would also have to restore from all differential backup the same way we did. Of course, this file may have changed since the full backup.

dar -R / -x /zip/linux_diff1 -g home/denis/my_precious_file

and so on, up to the last differential archive.

dar -R / -x /zip/linux_diff29 -g home/denis/my_precious_file

b) Second method (more efficient):

We will restore our lost file, starting from the most recent differential backup and *maybe* up to the full backup. Our file may or may not be present in the each differential archive as it may have changed or not since the previous version, thus we have to check if our file is restored, using the -v option (verbose):

dar -R / -x /zip/linux_diff29 -v -g home/denis/my_precious_file

If we can see a line like

restoring file: /home/denis/my_precious_file

The it stops here, because we got the most recent backup version of our lost file. We have to otherwise have to continue with the previous differential backup, up to the full backup if it is necessary. This method has an advantage over first one, which is not to have *in all case* the need to use all the backup done since the full backup.

If you are lazy on the other hand, have a look at dar_manager (at the end of the tutorial)

OK, now you have two files to restore. No problem, just do the second method but add -r option not to override any more recent file already restored in a previous step:

dar -x /zip/linux_diff29 -R / -r -v -g home/denis/my_precious_file -g etc/fstab

Check the output to see if one or both of your files got restored. If not, continue with the previous backup, up to the time you have seen for each file a line indicating it been restored. Note that the most recent version of each files may not be located in the same archive, thus you might get /etc/fstab restored from linux_diff28, and /home/denis/my_precious_file restored at linux_diff27. In the case /etc/fstab is also present in linux_diff27 it would not have been overwritten by an older version, thanks to the -r option.

This option is very important where restoring more than one file using the second method. Instead, in the first method (restoring first from the full backup, then from all the following differential backups), -r option is not so important as if overwriting occurs when you restore lost files, you would only overwrite an older version by a newer.

Same thing here, even if you are not lazy, dar_manager can help you lots here to automate the restoration of a set of file.

How much can you restore with dar_manager?  As much as you can give to dar_manager as argument on command line or through  included files (-B option).

Install Tomcat under CentOS

Wednesday, August 15th, 2007

These instructions help you install Sun’s Java 1.5.0.11-1 JDK on Centos 4.4, so that you can run tomcat 5.

First, you’ll need some base packages that you may not have already installed.

   yum install rpm-build gcc-java

Visit the jpackage.org site and navigate to their yum page (https://jpackage.org/yum.php)

Copy this file ( https://jpackage.org/jpackage.repo ) into /etc/yum.repos.d/

The repo file does not have the jpackage repositories enabled by default. You’ll need to set enabled=1 for each repo that you need.

   yum update

Get some SRPMs for building the non-free packages. I like installing these to /usr/local/src on Linux systems. If you prefer another directory (/tmp works well) use it instead.

   cd /usr/local/src
   wget ftp://jpackage.hmdc.harvard.edu/mirrors/JPackage/1.7/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.11-1jpp.nosrc.rpm
   wget ftp://jpackage.hmdc.harvard.edu/mirrors/JPackage/1.6/generic/non-free/SRPMS/jta-1.0.1-0.b.4jpp.nosrc.rpm

Download some required files to /usr/src/redhat/SOURCES:

   cd /usr/src/redhat/SOURCES

Download jta-1_0_1B-classes.zip here after agreeing to the license. Look for the link to “Class Files 1.0.1B”

Download jdk-1_5_0_11-linux-i586.bin, again after agreeing to a license. The Sun page is somewhat confusing to navigate. You can start here and navigate through the series of clicks until you get to the following screen.

Image of downloadable J2 SDKThis page was last updated on 2006-03-07. You might have to poke around on the to find the right files if Sun has changed those pages too much.

Build and install the non-free packages.

   rpmbuild --rebuild /usr/local/src/java-1.5.0-sun-1.5.0.11-1jpp.nosrc.rpm
   rpm -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-1.5.0-11-1jpp.i586.rpm
   rpm -ivh /usr/src/redhat/RPMS/i586/java-1.5.0-sun-devel-1.5.0.11-1jpp.i586.rpm
   rpmbuild --rebuild --without javadoc /usr/local/src/jta-1.0.1-0.b.4jpp.nosrc.rpm
   rpm -ivh /usr/src/redhat/RPMS/noarch/jta-1.0.1-0.b.4jpp.noarch.rpm

And finally, install the free packages (do not panic - this will cause lots of packages to be installed):

   yum install tomcat5 tomcat5-webapps tomcat5-admin-webapps

Troubleshooting

  • If the rpmbuild –rebuild step complains about missing sources, it’s because you didn’t copy the jta and jdk binary files into the /usr/src/redhat/SOURCES directory.
  • If the system can’t find rpmbuild, it’s because you didn’t install rpm-build.
  • Watch the console when you start up tomcat with “/sbin/service tomcat5 start” . If it complains about missing jar files, you may need to fetch those with a “yum install <name-of-missing-package>” before your tomcat will run correctly.
  • I do not know if there is some subtle incompatibility created by installing the JDK from the 1.7 JPackage repo, while the jta is pulled from the 1.6 JPackage repo. So far, this seems to work. There is no jta in the 1.7 repo.
  • If you previously tried other methods to install the jdk, tomcat, etc., you should make sure that you’ve uninstalled those RPMs or files before following these instructions. Otherwise, rpm will complain.
  • If you’re running something like Bastille on your Centos box, make sure that your configuration allows connections to port 8080.

Install PHP5 in Centos 4.4

Monday, April 30th, 2007

yum install httpd –enablerepo=centosplus
yum install php –enablerepo=centosplus