Introduction
Let me start off by explaining why I wrote this tutorial. I have been hosting with SliceHost for quite some time now, and decided to mess around with WordPress a bit instead of building something from scratch. After downloading and installing WordPress I noticed it wanted FTP login details to install plugins etc from the Admin interface. That was a problem as I only have SSH / SFTP acces. (I never setup an FTP server because it would just take up more memory, I have a 256MB slice/vps.) Anyways, I was in a bit of a pickle, I didn’t want to have to upload each plugin by hand and then manually install through the admin section. Then I found some tutorials on how to set up SSH support in WordPress, but they were a bit unclear. Hence my reason for writing this.
Prerequisits
- Apache 2
- PHP5
- MySQL5
- Ubuntu (probably works on Debian too, or any deritive there of)
- A document root ready to be used
If you haven’t installed Apache, MySQL and PHP5 yet make sure you do that first.
You can find many nice articles how to do so on SliceHost Articles.
Let’s get started
First we need to download and extract wordpress to where we want it installed.
If you are not going to be doing this from command-line (using ssh, on a linux machine) skip this step or read up how to install using another method WordPress Famous 5 Minute Install
cd ~
# Download the latest wordpress version
wget http://wordpress.org/latest.tar.gz
# Unpack the file, this should create the wordpress dir
tar xzf latest.tar.gz
# Go into the wordpress dir
cd wordpress
# Copy all the files to where you want to install wordpress (document root is easiest)
# BE SURE TO CHANGE THIS LINE
cp -R * /var/www/vhosts/username/domain.com/public
If this step doesn’t work due to permissions you might have to start the line above with sudo. Afterwards you will also probably need to set the right owner for the files, probably www-data:www-data (sudo chmod -R www-data:www-data /var/www/etc/etc/etc)
Now you run the installation.
Follow the guide from Step 5: Running the Install Script.
Now I will explain how to install libSSH2 which we will need to enable WordPress to install Plugins / Themes from the admin section without using normal FTP.
sudo aptitude update
sudo aptitude install libgcrypt-dev build-essential autoconf
# Go to your home dir
cd ~
# Download the source to libssh2 v1.1
wget http://kent.dl.sourceforge.net/sourceforge/libssh2/libssh2-1.1.tar.gz
# Unpack the file
tar xzf libssh2-1.1.tar.gz
# Go to the unpacked directory
cd libssh2-1.1/
# Configure it for your system
./configure
# Compile
make
# Install
sudo make install
Now we will link Apache to libSSH2 by using PECL. This is the easiest way to do this, if you do not have PECL support you will want to look into that first. I’m not going to go into detail on how to install PECL, in Ubuntu it should be almost as easy as doing a: sudo aptitude install php-pear.
In my case I had to run it the following way because I run Zend Server CE and PECL is only callable directly:
Now you have to edit your php.ini to load the new extension. Open the php.ini file and search till you find Dynamic Extensions and add the following line:
Now it’s time to restart Apache and everything should be working!
When you now go to the admin page of your WordPress installation you will see that you now have the option to use SSH for Plugin installs. Of course you will need your username & password for SSH to login. At times it’s a bit slow I’ve noticed, but don’t give up right away. If you don’t get an error message things should be OK
I have tested this on Ubuntu Hardy and Jaunty without problems.
Pretty nice post. I just came across your site and wanted to say
that I have really enjoyed browsing your blog posts. Anyway
I’ll be subscribing to your feed and I hope you write again soon!
This would have worked beautifully, but php-pear is not installing on to my slice because it can’t find the files with aptitude. Bummer.
Without PECL/PEAR it’s going to be a bit different. From what I gathered from PHP.net it would go something like this:
Download the PECL ssh2 package from here: http://pecl.php.net/get/ssh2
Then run: phpize && ./configure –with-ssh2 && make
This generates the ssh2.so.
Copy ssh2.so from the directory indicated by the build process to the location specified in your php.ini file under extension_dir.
Add extension=ssh2.so to your php.ini
Restart your web server to reload your php.ini settings.
Turns out I just needed to run apt-get update
! Thanks for the tutorial.
Hi, thanks for the guide. Like you said, it was a little slow and hit a number of errors.. I eventually switched from following your guide to doing this: http://forum.slicehost.com/comments.php?DiscussionID=3096 and things run much faster now.
Thanks for the guide. I found that Apache is a memory hog and I don’t get much mileage out of it on my 256MB RAM slice. Here’s a quick overview of using nginx instead: http://www.borismus.com/lightweight-wordpress-on-slicehost/
Hi! Your post rocks and is a good read !