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 6 to PHP 5.4 (or 5.5)

  • SCL is the way to go since it has RedHat’s blessing

Note that it is the .conf file that controls which version of php is used. For some reason this does not seem to be available for php55.

Moving from CentOS 6 to 7

KVM: setting up bridged mode

systemctl disable NetworkManager
systemctl enable network
systemctl stop NetworkManager
systemctl start network
  • The only problem with the above is that network does not seem to start on boot.
chkconfig --list network    # shows that it should be running
systemctl start network     # the

Setting up NFS4 on CentOS

First: install server software and start it

yum install nfs-utils nfs-utils-lib system-config-nfs
yum install nfs-utils nfs4-acl-tools portmap
chkconfig nfs on
chkconfig portmap on
service nfs start
echo 'portmap:ALL' >> /etc/hosts.deny
echo 'portmap:192.168.1.0/24' >> /etc/hosts.allow
service portmap start

run the firewall gui and turn on NFS4 (2049)

NNTP time updates on CentOS

yum install ntp ntpdate ntp-doc
chkconfig ntpd on
ntpdate pool.ntp.org
/etc/init.d/ntpd start
date

from: www.cyberciti.biz/…erver-clock

Install/Upgrade owncloud on CentOS

Installation

yum install -y php5 php5-common php-xml php-mbstring php-gd
yum install -y curl php-pdo
#not sure if already in common: yum install -y libcurl3 libcurl3-dev
  • Now download and install owncloud
VER=5.0.12
ROOT=/var/www/owncloud #change to match your own setup

wget http://download.owncloud.org/community/owncloud-$VER.tar.bz2
tar -xjf owncloud-$VER.tar.bz2
mv owncloud $ROOT
rm -Rf owncloud-*
chown -R apache:apache $ROOT
  • Set up a virtual host in apache to point to $ROOT
  • visi

Installing rdiff-backup on CentOS 6 or 7

wget http://pkgs.repoforge.org/rdiff-backup/rdiff-backup-1.2.8-4.el6.rf.x86_64.rpm
rpm -ivh rdiff-backup*.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm #for 7
yum-config-manager --disable epel     #disable since we on

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.
#find latest version here: http://sourceforge.net/projects/phpmyadmin/files/
#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.5.1"
#test with:
Syndicate content