Google Ads
2008.12.12 [Fri] | 07:05 PM

I just installed WordPress 2.7 today. Boy, is it exciting! The entire interface is different, and things can be accomplished much more quickly.

One of the neat features is the ability to add and remove plugins from the web interface. Unfortunately, WordPress only works with FTP and FTPS (FTP over SSL) by default. I don’t have an FTP server installed on my Linode, so I decided to see if I could use SSH instead.

Turns out it’s possible, but it sure was a beast to get up and running. I’ll go through what I did, in case anyone else had as much trouble with this as I did.

First off, you need to install PEAR. This is a nifty little utility that can automatically compile PHP extensions.

Keep in mind that I’m working in Ubuntu 8.04.1 here, and my Linode installation is very stripped down.

First, you need to install the command-line interface for PHP, which allows you to run PHP scripts from a terminal.

apt-get install php5-cli

Seeing as my installation of Ubuntu is devoid of pretty much any extras, I needed to install wget too.

apt-get install wget

Once that’s done, we can install PEAR.

cd /
wget http://pear.php.net/go-pear -O go-pear.php
php go-pear.php

Once the PEAR installation script is running, you need to configure the locations of each of the components. I chose to stick everything in /pear, but you may want to put it somewhere else. I’d recommend keeping option 3 to my setting, though.

1    /
2    /pear/temp
3    /bin
4    /pear
5    /pear/docs
6    /pear/data
7    /pear/tests

Now that PEAR is installed, we can get into installing OpenSSL and the necessary packages to make it work with PHP.

apt-get install openssl
apt-get install lsh-client
apt-get install libssh2-1
apt-get install libssh2-1-dev

With our libraries and packages installed, we can compile our ssh2 extension for PHP.

pecl install -f ssh2-beta

Finally, we need to add the extension to php.ini.

nano /etc/php5/apache/php.ini

Find the section titled “Extensions” and add this line:

extension=ssh2.so

And restart Apache:

apache2ctl -k graceful

In your WordPress admin interface, you should now see an “SSH” option when you go to add, remove, or update files on your server. WordPress provides text boxes to use your private and public SSH keys, but I found I only needed to use one of my user account’s credentials to authenticate to the server.

2008.08.26 [Tue] | 12:51 PM

I would not have figured out all this if it hadn’t been for someone on the #linode channel with the patience to walk me through the steps.

At any rate, when I moved abettergeek from Dreamhost to Linode, mail quit working in the forums. PHP has a built in mail() function, but it requires some server config to work - apparently, Dreamhost took care of that, while Linode’s default Linux install doesn’t have sendmail installed by default.

This makes sense - Linode basically allows you to select from a number of Linux distros, and they drop a very barebones image onto your VPS. It’s up to you to install the things you need. This is better than, say, installing everything by default and leaving a bunch of ports and vulnerabilities open from the start.

sendmail, however, is a bit pickier than Apache when it comes to making it work properly. These steps are using Ubuntu 8.04 LTS, but they’ll be similar for any Linux distro.

First, you’ll want to actually install sendmail:

apt-get install sendmail

That part was easy…however, the default Ubuntu config did not have my hostname information configured properly. You’l need to update your hosts file and your hostname file:

sudo nano /etc/hosts

if you have a line that looks like 127.0.0.1 ubuntu, remove it. The top two lines of the file should look like this:

127.0.0.1      localhost
72.14.177.31   abettergeek.com

Then, you need to update your hostname file:

sudo nano /etc/hostname

This needs just one line for your domain

abettergeek.com

Restart your server for the changes to take effect, and you should be able to now send mail using the mail() function in PHP.

Google Ads