Server Admin

Fix Slow SSH login time

Interesting that since moving to a new ISP my login times to a particular Linux server is 20-30 seconds. I figured it had to do with reverse DNS somehow. Sure enough....

/etc/ssh/sshd_config

UseDNS no

That made the logins quick again and that makes me HAPPY!

Credit:
http://www.netadmintools.com/art605.html

Magento and setroubleshoot causing certain pages to die.

Some pages in Magento were giving just a white page, with no indication of errors in Zend Server console or log files. This was apparently a memory issue, so I restarted the web server and all was fine.

One issue I noticed was the server "setroubleshoot" was taking 12% of the systems memory. This program just logs issues with SELinux and it seems SELinux doesn't like my Magento install. I have SELinux just set to 'warn', but I may want to disable it all together. I stopped the 'setroubleshoot' program and turned it off with chkconfig.

Weird characters after mysqldump export and import on new server

The other day I had to migrate a Wordpress database from one server to the other. I used mysqldump to export the SQL and data from the old server.

Then I used this to import

mysql -uusername -ppassword database < backup.sql

This went fine, but I found I was seeing weird characters in the front end and through phpmysqladmin. The "Collation" on both tables seemed the same.

Then I stumbled on a website that offered this change when importing

mysql -uusername -ppassword --default-character-set=utf8 database < backup.sql

Updating Namecheap DDNS using BASH, CURL, and good 'ol know how.

I have a server at home that I use to do snapshot style backups using rsync. As such, I'd like to be able to connect to it from time to time when not at home. This is a simple way to update your Dynamic DNS with NameCheap.

Offsite Snapshot Backups using rsync

Creating simple backup snapshots using rsync and mv

Summary

Create the illusion of mutliple backed up copies, but in reality only the changes are different thereby saving space on the HDD. Create a cron job to run the following script once a day. The script will keep 4 days of backups, edit the numbers to your liking. Utilizing some built in rsync features it will only store 1 copy of the file on disk unless it has changed.

Installing Zend Server on Centos to run Magento

Installed Zend Server CE on one of my servers today.

Installing Zend Server CE via yum on Centos

To install via YUM, you can add the Zend repo as /etc/yum.repos.d/zend.repo

  [Zend]
  name=Zend CE $releasever - $basearch - Released Updates
  baseurl=http://repos.zend.com/rpm/ce/$basearch/
  enabled=1
  gpgcheck=0
  [Zendce-noarch]
  name=Zend CE - noarch
  baseurl=http://repos.zend.com/rpm/ce/noarch
  enabled=1
  gpgcheck=0

Then run yum install zend-ce

Removing Encryption from SSL Key

While having an encrypted key is a good thing for an SSL web server, it just doens't work out so well. When your web server restarts, it hangs during startup asking for a passphrase for all the SSL certs.

To remove the requirement to enter a password you can follow these steps.

First backup you key

# cp <a href="http://www.domain.key" title="www.domain.key">www.domain.key</a> www.domain.key.encrypted

Then create a plain text version

# openssl rsa -in <a href="http://www.domain.key" title="www.domain.key">www.domain.key</a> -out www.domain.key.plain

Then replace your current key with the new plain text one

# cp <a href="http://www.domain.key.plaintext" title="www.domain.key.plaintext">www.domain.key.plaintext</a> www.domain.key

yum update dies in error 'TypeError: unsubscriptable object'... yum clean all

While updating one of my servers today I entered this command yum update file and received the following error message.

Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in ?
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 229, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 145, in main
    (result, resultmsgs) = base.buildTransaction() 
  File "/usr/lib/python2.4/site-packages/yum/<strong>init</strong>.py", line 647, in buildTransaction

Find JPG Files in Directory and CP (copy) to another directory

Today I was faced with the challenge of finding all the JPG files in a a directory (and subdirecties of that) and copying them to another directory (striping out the subdirectory folder name).

find /path/to/directory/ -iname "*.jpg" -exec cp '{}' /path/to/dest/dir/ \;

That did it perfectly.

Keywords
Find Folder Strip Path Copy cp directory

Reference:
http://www.linuxquestions.org/questions/linux-newbie-8/shell-script-to-s...

dstat to rule them all (iostat, vmstat, blah, blah)

I could never remember what stat to use when trying to figure out disk usage and network usage, but now there is a dstat that handles all that. Great!

dstat

Syndicate content