Some CentOS LAMP tips
/srv is really where it belong.
mkdir /srv/mysql
chown mysql:mysql /srv/mysql
Then modify /etc/my.cnf to look like this:
[mysqld]
datadir=/srv/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysql.server]
user=mysql
basedir=/srv
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
Of course if you are already running MySQL in /var/lib you need to stop the server and move the database to the new location, and if you are using SELinux (possible in xen ??) you'll need to make some context changes.
You don't need to change the location of mysql.sock - and it's actually seems to be hard coded into MySQL - if you do change it, MySQL won't start unless /var/lib/mysql/mysql.sock is a symlink to the new location, so just leave that in the old location.
There's no performance reason why MySQL should have it's database in /srv - but /srv is the correct FHS location (server data that needs to survive a re-install)
Tip 2: migrating via name based virtual hosts
I use name based virtual hosts for everything. I don't know of any web browsers that still work on any modern OS that don't fully support them.
However - if like me, you are waiting for control of the DNS to switch from another host, name based virtual hosting can be a pain to test your site.
I don't know how to do it in Windows, but if you use Linux - just edit /etc/hosts on your desktop.
Here is an example apache configuration (change someurl.com to your actual domain name) - in CentOS it lives in /etc/httpd/conf.d - I name it someurl.conf:
<virtualhost *:80="">ServerName migrate.someurl.com
DocumentRoot "/srv/www/someurl"
<directory "="" srv="" www="" someurl"="">Options FollowSymLinks
AllowOverride None</directory></virtualhost>
In your /etc/hosts file - add
your_ip migrate.someurl.com
Now when you point your browser to migrate.someurl.com it will go to your IP and the name based virtualhost will allow you to work on your content.
Once the domain has properly transfered so you can update the DNS records - change migrate to www in the conf file - and under the DocumentRoot directive - optionally add
ServerAlias someurl.com
Anyway - by doing it this way, it allows you to have
in one tab - and
migrate.someurl.com
in the another browser tab, so you can make sure you have all the code properly set up for smooth migration once the DNS servers are pointing to the right place.
Tip 3 - gallery2
Rather than using the somewhat less secure Gallery2 instructions from the gallery website - grab the Fedora 9 src.rpm for gallery2 (and for the php-Smarty dependency). Rebuild them on a CentOS 5 machine and install them on your linode host. Actually, since they are noarch, you may not even need to rebuild them. I did. Anyway -
The Gallery2 code will be put into /usr/share/gallery2 and an apache alias will be put into /etc/httpd/conf.d so that /gallery2 in a browser (you can modify it if you want) will load the gallery2 web app.
The gallery2 data files will be in /srv/gallery2 owned by apache user group root - much safer than the chmod 777 instructions on the gallery website.
There's no need for any user other that root to have write access to the php files that run the app, and there's no need to any user other than apache to have write access to the gallery data files. The gallery install instructions are really intended for shared hosts where you do not have sufficient privilege to set it up properly. But in linode, you do, and the RPMs from Fedora 9 do just that. Installing by RPM also allows you to make sure all the dependencies are met.
You may need to use the EPEL repositories for some of the gallery2 dependencies, depending upon which plugins you wish to install.