All posts in Linux / Unix

Trouble Symlinking DocumentRoot on Shared Hosting

by Ian Dunn

TL;DR: If you get Symbolic link not allowed or link target not accessible errors, use relative symlinks to avoid permissions issues with absolute symlinks, and generate nested symlinks relative to their actual directories. I ran into some trouble setting up Deployer  on Media Temple’s Grid service, and it took me awhile to find out the answer, so I figured… [more]

Grepping for Terms on Separate Lines but Near Each Other

by Ian Dunn

I wanted a way to search through the ~200 themes we have on WordPress.com to find out which ones registered sidebar areas for the home page, and this is what I came up with: That’d have to be customized to fit other circumstances (like using -B if you want to search lines before the initial… [more]

Connecting to a PPTP VPN from an OpenVZ CentOS VPS

by Ian Dunn

When setting up the PPTP and PPP packages on an OpenVZ VPS in order to connect to a VPN, there are a few extra steps you need to take that you don’t have to do with a non-virtualized box. First, you have to load the following kernel modules on the hardware node and/or set them to automatically start during the boot up process : After doing that you should… [more]

Cronie Depends on Sendmail in CentOS 6

by Ian Dunn

I ran into a problem the other day when building a new CentOS 6 VPS template. After doing some of the initial work I ran yum update, and it worked fine. Later on, after installing the AtomiCorp repo , I tried to run it again and it failed with errors about Qmail obsoleting Sendmail, not being able… [more]

FastCGI errors after PHP upgrade

by Ian Dunn

I ran into a small problem upgrading PHP from 5.3.5 to 5.3.10 on a MediaTemple CentOS VPS today. The upgrade completed without any errors, but when I reloaded the site I got a “500 Internal Server Error” message. It was the stock installation, so I’m not sure which module it was using or what repository… [more]

Updating Packages in an OpenVZ VPS

by Ian Dunn

Sam Mingolelli has posted some useful solutions to common problems when running yum update inside an OpenVZ VE.

Directory Permissions for WordPress under Plesk/Linux

by Ian Dunn

Jason Diehl describes the right way to setup directory permissions on a Linux box running Plesk so that WordPress can automatically create the directories it uses to store uploads. Basically, you need to make sure that PHP’s safe mode is turned off and that wp-content is owned by apache, in the apache group, and chmod’d to 777.

Installing Additional Software on Endian Firewall

by Ian Dunn

Endian doesn’t ship with gcc, apt or yum, so it can be kind of confusing at first if you’re trying to figure out how to install some extra packages. It comes with Smart Package Manager , which you can use to install CentOS binary RPMs from  http://mirror.centos.org/centos/4/os/i386/CentOS/RPMS/ (CentOS 4) or  http://mirror.centos.org/centos/5/os/i386/CentOS / (CentOS 5). Try the version 4 first. You… [more]

Backing Up Files and MySQL Databases on Linux Servers

by Ian Dunn

You’d think I’d have this memorized by now, but I always mess up the syntax and have to spend a few minutes digging through man pages or wading through search results to find it. tar -czf [output-file.tar.gz] [input-directory]/ mysqldump -u [username] -p [database name] > [filename]

Updating OpenDNS With a Dynamic IP From an Endian Firewall

by Ian Dunn

The Endian router/firewall appliance comes with a Dynamic DNS client that supports the major DDNS providers, but it doesn’t support updating OpenDNS, which is necessary for any custom settings on your OpenDNS account to be applied to the traffic you pass through their servers. It’s possible to configure this yourself, though. There’s a helpful post… [more]

PHP Error Logs with Virtuozzo

by Ian Dunn

Virtuozzo sets domains up to have PHP’s display_errors flag turned off by default, so that you’ll only see a blank page when there are critical errors. This is a good thing in production environments because it avoids potential security issues, but it can also be annoying when you’re trying to debug something. Instead of displaying… [more]

Firewalling an OpenVZ node and containers

by Ian Dunn

The OpenVZ wiki has a nice script for firewalling an OpenVZ node and it’s containers . It creates a service and configures iptables to block all traffic to the node (except the ports you specify), but allow all traffic through to the containers, so that they can manage their own firewall. It also allows the container’s firewalls to be managed on the… [more]

Relaying Qmail Through a Spam Filter

by Ian Dunn

If you’re running a mail service on a web server so it can send out e-mail from contact forms, etc then you’ll want to make sure it’s relaying outbound mail through a spam filter , or it could be used to send spam if the forms get hijacked. For qmail, you just need to create /var/qmail/control/smtproutes and enter “:yourmailserver.com”, then restart. Make… [more]

Skipping Disk Check When Rebooting Linux Server

by Ian Dunn

If you don’t run a disk check on a Linux server in awhile and you reboot, it may force a disk check, which can take 30+ minutes, and it’ll be offline the entire time. You can reboot and skip the check with shutdown -fr now or force a check with shutdown -Fr now. (via go2linux.org )  

Convert Filenames to Lowercase on Linux

by Ian Dunn

If you transfer files from a Windows server to a Linux one, you may get some broken links because Linux is case-sensative while Windows isn’t. You can rename all the files on the Linux server to their lowercase equivalents with this shell script from Linux Journal.

NTP Service Doesn’t Start Serving Until It Stablizes

by Ian Dunn

I just spent an hour trying to figure out why the NTP service I installed wasn’t working, and then I came across this slightly important little fact: Your internal workstation computers will not be able to use the server as a synchronisation source until the LOCAL(0) clock has stable time. This may take up to 15… [more]

Find largest directories on a Linux box

by Ian Dunn

These commands will return the largest 10 directories on a Linux box. via peterbe.com

Find recently modified files in Linux

by Ian Dunn

This will list all the files on a Linux system that were modified in the past 5 days

Finding a string inside multiple files on Linux

by Ian Dunn

Snipplr has a good article on how to find all of the files on a Linux system that contain a specific string . The search will include subfolders.

Installing the Oracle Library for PHP

by Ian Dunn

Chris Sibert wrote a good tutorial on installing the Oracle library for PHP . If you’re running SELinux, I’d recommend temporarily turning it off to get the module setup so you don’t have to worry about problems during the install, and then turn SELinux back on after you verify the module is working. Then you can update SELinux’s policy to allow Apache and PHP… [more]