Sunday Feb 5

Archive for the ‘Servers’ Category

Jan
03/12
Python 2.7 on CentOS 5.6
Last Updated on Tuesday, 10 January 2012 01:52
Written by Cody Snider
Tuesday, January 3rd, 2012

Here you have it, folks. A shell script that will handle all the ugliness associated with installing Python 2.7 on CentOS 5.6 (and probably CentOS 5.7, too).

Use the following command in your shell (the easy way):

wget -q -O http://codingwithcody.com/downloads/python_27_on_centos_56/install.sh | sh

Alternately, you can download and run it manually: Download install.sh

Here are the tarballs used just in case the servers hosting them go down and you’re eager to get Python 2.7 working:

And, just FYI, here’s the contents of install.sh:

yum -y install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-devel sqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel make
 
cd /var/tmp
wget http://sqlite.org/sqlite-amalgamation-3.7.3.tar.gz
tar xfz sqlite-amalgamation-3.7.3.tar.gz
cd sqlite-3.7.3/
./configure
make
make install
 
cd /var/tmp
wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz
tar xvfz Python-2.7.1.tgz
cd Python-2.7.1
./configure --prefix=/opt/python2.7.1 --with-threads --enable-shared
make
make install
 
touch /etc/ld.so.conf.d/opt-python2.7.1.conf
echo "/opt/python2.7.1/lib/" >> /etc/ld.so.conf.d/opt-python2.7.1.conf
ldconfig
 
ln -sf /opt/python2.7.1/bin/python /usr/bin/python2.7
 
cd /var/tmp
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7.1
 
/opt/python2.7.1/bin/easy_install pip
ln -sf /opt/python2.7.1/bin/pip /usr/bin/pip
 
pip install virtualenv
ln -sf /opt/python2.7.1/bin/virtualenv /usr/bin/virtualenv
 
mv /usr/bin/python /usr/bin/python-backup
ln -s /usr/bin/python2.7 /usr/bin/python

Any improvements are more than welcome. Enjoy and happy coding!

Posted under Python, Servers  |  Comments  3 Comments
Jul
21/10
Stopping Non-Essential Services on CentOS
Last Updated on Wednesday, 21 July 2010 08:55
Written by Cody Snider
Wednesday, July 21st, 2010

Under an out-of-the-box installation of CentOS, many services are running that are non-essential for a LAMP stack to run effectively. Running the following (either individually or as a script) will remove these services from the boot.

Original post from VPS.net

#Shut down non essential services:
 
# 1. sendmail
# Purpose: sending mail, most use another
/etc/init.d/sendmail stop
chkconfig sendmail off
 
# 2. nfs
# Purpose: mount a disk from another machine
/etc/init.d/portmap stop
/etc/init.d/nfs stop
chkconfig portmap off
chkconfig nfs off
 
# 3. chargen
# Purpose: testing char generation
/etc/init.d/chargen stop
chkconfig chargen off
 
# 4. ypbind
# Purpose: stores info on NIS domains
/etc/init.d/ypbind stop
chkconfig ypbind off
 
# 5. anacron
# Purpose: cron for systems that shut down a lot
/etc/init.d/anacron stop
chkconfig anacron off
 
# 6. atd
# Purpose: at cmd daemon
/etc/init.d/atd stop
chkconfig atd off
 
# 7. routed
# Purpose: Route packets, log tables
/etc/init.d/routed stop
chkconfig routed off
 
# 8. snmpd
# Purpose: network monitoring
/etc/init.d/snmpd stop
chkconfig snmpd off
 
# 9. gpm
# Purpose: mouse
/etc/init.d/gpm stop
chkconfig gpm off
 
# 10. smartd
# Purpose: disk health monitor
/etc/init.d/smartd stop
chkconfig smartd stop
 
# 11. hidd
# Purpose: bluetooth
/etc/init.d/hidd stop
chkconfig hidd off
 
# 12. pcscf
# Purpose: smart card reader
/etc/init.d/pcscd stop
chkconfig pcscf off
 
# 13. isdn
# Purpose: digital network
/etc/init.d/isdn stop
chkconfig isdn off
 
# 14. kudzu
# Purpose: watches for new hardware
/etc/init.d/kudzu stop
chkconfig kudzu off
 
# 15. cups
# Purpose: printing
/etc/init.d/cups stop
chkconfig cups off
 
# 16. xfs
# Purpose: serves x# 1# 1 fonts
/etc/init.d/xfs stop
chkconfig xfs off
 
# 17. nfslock
# Purpose: file sys lock
/etc/init.d/nfslock stop
chkconfig nfslock off
 
# 18. canna
# Purpose: Chinese chars
/etc/init.d/canna stop
chkconfig canna off
 
# 19. freeWnn
# Purpose: Japanese chars
/etc/init.d/FreeWnn stop
chkconfig FreeWnn off
 
# 20. cups-config-daemon
# Purpose: print config
/etc/init.d/cups-config-daemon stop
chkconfig cups-config-daemon off
 
# 21. iiim
# Purpose: internet language input
/etc/init.d/iiim stop
chkconfig iiim off
 
# 22. mDNSResponder
# Purpose: dns service discovery
/etc/init.d/mDNSResponder stop
chkconfig mDNSResponder off
 
# 23. nifd
# Purpose: monitors net interfaces
/etc/init.d/nifd stop
chkconfig nifd off
 
# 24. rpcimpad
# Purpose: used for nfs server
/etc/init.d/rpcimpad stop
chkconfig rpcimpad off
 
# 25. bluetooth
# Purpose: bluetooth devices
/etc/init.d/bluetooth stop
chkconfig bluetooth off
 
# 26. saslauthd
# Purpose: handles plaintext authentication requests
/etc/init.d/saslauthd stop
chkconfig saslauthd off
Notes: some systems use this for email auth!
 
# 27. avahi-daemon
# Purpose: instant network recognition
/etc/init.d/avahi-daemon stop
chkconfig avahi-daemon off
 
# 28. avahi-dnsconfd
# Purpose: instant network recognition
/etc/init.d/avahi-dnsconfd stop
chkconfig avahi-dnsconfd off
 
# 29. sbadm
# Purpose: rapid reboot
/etc/init.d/sbadm stop
chkconfig sbadm off
 
# 30. haldaemon
# Purpose: monitors for hardware changes
/etc/init.d/haldaemon stop
chkconfig haldaemon off
 
# 31. acpi
# Purpose: sleep/hibernate control
/etc/init.d/acpi stop
chkconfig acpi off
 
# 99. gamin
# Purpose: monitors file/dir changes
/etc/init.d/gamin stop
yum -y remove gamin
Posted under Servers  |  Comments  1 Comment