CentOS

Technical Notes

These notes are my personal online notebook of useful commands and "how-to's". You are welcome to make use of them if you find them helpful. They obviously don't come with any warranty! Click on one of the category tags above for the notes in any category.

Upgrading CentOS 5 from PHP 5.1 to 5.3

  • see what is installed (assuming php-mcrypt & php-mhash are installed
yum list installed | grep php | cut -d' ' -f1
typical result:
php.x86_64
php-cli.x86_64
php-common.x86_64
php-devel.x86_64
php-gd.x86_64
php-imap.x86_64
php-ldap.x86_64
php-mbstring.x86_64
php-mcrypt.x86_64
php-mhash.x86_64
php-mysql.x86_64
php-odbc.x86_64
php-pdo.x86_64
php-pear.noarch
php-xml.x86_64
php-xmlrpc.x86_64
  • removes the 16 packages above (make sure there is nothing above you want to keep)
    • Check that only the packages above are listed before you press yes
yum remove php php-*

Protecting websites using .htaccess

upgrading phpMyAdmin

Recent exploits that use phpMyAdmin highlight the need to keep this code up to date. For more info, see:
http://seclists.org/fulldisclosure/2011/Oct/690
http://www.dslreports.com/forum/r24640843-Botnet-Trend-phpMyAdmin-SSH-At...

#first set up the basic info.
#pma directory--could be: mydir=/usr/share
# using ln -sfn /usr/share/phpmyadmin/ /var/www/html/phpMyAdmin

mydir=/var/www/html  
phpMyAdmin=phpMyAdmin  #could be: phpMyAdmin=phpmyadmin
version="3.4.8"
#test with:
ls $mydir/$phpMyAdmin/config.inc.php

Installing NX Server

  • Install NX (info from this page: http://www.nomachine.com/download-package.php?Prod_Id=355 )

    CentOS 6.0 64bit

    yum install wget #must be logged on as root
    NXVER=3.5.0
    CVER=7
    NVER=4
    SVER=5
    ARCH=x86_64
    NXURL=http://64.34.161.181/download
    wget $NXURL/$NXVER/Linux/nxclient-$NXVER-$CVER.$ARCH.rpm
    wget $NXURL/$NXVER/Linux/nxnode-$NXVER-$NVER.$ARCH.rpm
    wget $NXURL/$NXVER/Linux/FE/nxserver-$NXVER-$SVER.$ARCH.rpm
    rpm -i nxclient-$NXVER-$CVER.$ARCH.rpm
    rpm -i nxnode-$NXVER-$NVER.$ARCH.rpm
    rpm -i nxserver-$NXVER-$SVER.$ARCH.rpm

yum

Documentation: http://www.centos.org/docs/5/html/yum/index.html

You can install repository priorities: http://wiki.centos.org/PackageManagement/Yum/Priorities
But a better solution might be to leave the extra repos disabled in the yum configuration and
install/update the packages you want from them with:
yum --enablerepo=reponame install packagename

Installing KVM on CentOS 5.5

Note that this now only works for the 64 bit version of CentOS

useful link: http://itscblog.tamu.edu/startup-guide-for-kvm-on-centos-6/

yum groupinstall "Virtualization*"
yum install dejavu-lgc-sans-fonts
echo "BRIDGE=br0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
#now check it looks ok:
vi /etc/sysconfig/network-scripts/ifcfg-eth0

Samba Server Setup

This is very "quick and dirty" using the CentOS gui tools as much as possible

-install server & open firewall to samba
-create office and supervisor groups and a /home/common folder
-create all users on server and make them part of office, (+supervisor)
-add all users to Samba with Windows names and passwords
-share all home drives and set user access on shares as appropriate
-set permissions in the directory at the root of each share, appropriate to users
-chmod g+w -R * #at the top level of each shared directory so groups can read and write

Installing a RAID system on CentOS 6

The process is very straightforward, with only one minor complication: the MBR and GRUB must be set up on both drives for alternate boot if one drive fails.
1. First setup a boot raid partition (100MB) on each drive
-Do this by creating a raid partition on each drive separately
-Then combine them into one RAID1 ext4 device mounted at /boot
2. Make two 4096GB raid partitions for the swap drive (adjust size as needed)
-Combine them into RAID1 of type swap (not mounted)
3. Next use the rest of the disks to make big raid partitions

Install Subversion on CentOS 5 with Apache


yum install subversion mod_dav_svn
mkdir -p /var/www/svn/test #place to keep repository
svnadmin create --fs-type fsfs /var/www/svn/test #make a test one
chown -R apache.apache /var/www/svn
vim /etc/httpd/conf/httpd.conf #make sure the following two lines are there
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
#
vim /etc/httpd/conf.d/subversion.conf #and add the following

<Location /svn>
   DAV svn
   SVNParentPath /var/www/svn
   # Limit write permission to list of valid users.
Syndicate content