CentOS Repositories

CentOS is a very stable distro and because of that, it lacks really up to date packages. Here are some repos that will provide more recently up to date and extra packages:

Utter Ramblings – Up to date LAMP

EPEL – Fedora Packages ported to RHL

DAG – Extra Packages

Debian GPG error

When trying to do an aptitude update in Debian on a fresh install of lenny, I got this error:
W: GPG error: http://ftp.de.debian.org lenny/updates Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY xxx
W: You may want to run apt-get update to correct these problems
It can easily be fixed by running the following commands:
gpg --keyserver keys.gnupg.net --recv-key xxx
gpg -a --export xxx | sudo apt-key add -

Of course, replace xxx with your own key.

E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable)

So sometimes when you’re using apt-get or aptitude (I use aptitude) and you’re updating a large amount of packages or just large packages, you’ll just sit there and forget about it and somehow loose connection to your server. When you go back in to complete the upgrade process, you get this error: E: Could not get lock /var/lib/dpkg/lock – open (11: Resource temporarily unavailable). To solve this, run the following:

killall aptitude (or apt-get)

dpkg –configure -a

Then run aptitude upgrade to finish up!

rvm and capistrano

RVM is a really cool tool that allows users to have multiple Ruby installs. I suggest using it as its very useful, just like having a package manager for Ruby versions. When I switched to rvm, I was having errors on my production server that some Rails commands like bundle couldn’t be found. Long story short, here’s a link to the solution:

SOLUTION!

In case the link is down, here’s a brief overview:

After installing RVM System Wide (you can find this easily in Google), add this to your default bash profiles:

[[ -s '/usr/local/bin/rvm' ]] && source '/usr/local/bin/rvm'

Then in Capistrano, you must add this in your deploy.rb:

require ‘rvm/capistrano’
set :rvm_ruby_string, ‘some-ruby’ # Defaults to ‘default’

Also, you MUST HAVE RVM ON YOUR LOCAL MACHINE!

EDIT: Just in case, you can also install the rvm gem using gem install rvm.

changing virtualmin user defaults

If you guys haven’t used Virtualmin before I suggest you take a look. It’s really awesome. If you know about cPanel and DirectAdmin, it’s kinda like that (a domain control panel) and while it doesn’t look as nice, IT IS VERY FLEXIBLE! Unlike the other popular panels out there, Virtualmin isn’t tied to your server software. Go ahead and mix and match your Apache, MySQL, PHP, whatever. If you want mono, rails, or something else, go ahead and install it as Apache modules and it’ll just work!

Anyways, I digress. I was having problems with the defaults that virtualmin created users with, specifically the shell to use and a group to add all the users to. After searching a while I found out that these settings are in System Settings -> Server Templates. You can either edit the default one or create a new one.

404 with packaged phpmyadmin

I installed phpmyadmin via aptitude on Debian 5 since I’m too lazy to manage it myself. The install went ok but when I tried to go to http://ip/phpmyadmin, it gave me a 404 error. I was really bugged by this since I thought this package installed phpmyadmin with its own web server (I chose apache2), but it actually doesn’t. It’ll just generate config files for either apache2 or lighttpd, depending on which you choose or both. For apache2, add this at the bottom of your apache2 config file:

Include /etc/phpmyadmin/apache.conf

ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken … failed!

So I got this error when trying to start exim4 on a new Debian 5 install. Looking on the web gave me a simple fix:

rm /var/log/exim4/paniclog

installing memcache for php

I found this awesome blog post about memcache in dotdeb.org:

http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/

Here are the steps I used to install memcache for my php5:

1. Run aptitude install memcached php5-memcache

2. Find php.ini (mine was located in /etc/php5/cgi/php.ini for debian lenny) and change

session.save_handler = files

to

session.save_handler = memcache

session.save_path=”tcp://127.0.0.1:11211?persistent=1&weight=1&timeout=1&retry_interval=15″

If you”re planning on using a separate server for memcache, just change the IP and port to reflect that.

3. Run /etc/init.d/apache2 restart

500 error on clean install of recess framework

In case you don”t know, Recess is a nice little RESTful framework written in PHP(5). I”ve only played around with it a little but at the moment it looks very promising. All it needs is a little more exposure and I think it”d be a success. Go to http://recessframework.org for more info.

Anyways, after a clean install of recess I was getting a 500 error. This was odd. My setup is MAMP. Long story short, it was because of eAccelerator. eAccelerator gets rid of the doc comments it seems, so annotations used by Recess were not getting read, leading to the 500 error. All you have to do is disable eAccelerator. This is only needed in development node since in production, those annotations are cached.

installing apache2 worker and php5 cgi with aptitude/apt-get

I”ve heard so much about how worker is more resource efficient than prefork, but mod_php only works with prefork. So to get php to work with worker, you have to run it as a (fast) cgi. I found the perfect guide but just in case the link goes bad I”ll post the most important parts:

http://www.beardy.se/2009/04/03/exchanging-apache2-mpm-prefork-for-apache2-mpm-worker-and-using-php5-cgi-on-debian-to-improve-performance

1. Run aptitude install apache2 php5-cgi

In my debian install (5.0, lenny) apache2 came with worker by default. Look for apache2-mpm-worker in the list of installed packages. If instead you see prefork, add apache2-mpm-worker to your aptitude install.

2. Run a2enmod cgid (mine said it was already running) and a2enmod actions

3. Go to /etc/apache2/conf.d and make a file (you can name it anything, but the guide I posted named it php5-cgi so I did as well) and put this in the file:

<IfModule mod_actions.c>

Action application/x-httpd-php /cgi-bin/php5

</IfModule>

4. Run /etc/init.d/apache2 start or /etc/init.d/apache2 restart depending if apache2 was already running.