Capistrano SSH authentication failure

capistrano

After moving a Capistrano build server from one machine to another, I noticed some failures during the first build. This might’ve been an environmental issue, but instead of going for the easy option I preferred to modify this directly in the Capfile.

My error message received was:
connection failed for: some-linux-server01 (Net::SSH::AuthenticationFailed: www-data)

I tried a host of options, adjusting the SSH config, /etc/hosts, and specifying ssh_options[:forward_agent] = true in the Capfile. Nothing worked.

First thing I wanted to do, was setup some more verbose Capistrano logging:
ssh_options[:verbose] = :debug

Then try and running a cap deploy again. That information may shed some light on any issue you have. In my case, it appeared to be a recurring issue with my SSH config – as we’d upgraded both Ruby, Capistrano and the OS – I preferred for the job to be done in the Capfile instead.

Subsequently, I planned to setup the Capfile to locate my SSH keys directly, whilst ignoring config.

The solution:
ssh_options[:keys] = [File.join(ENV[“HOME”], “.ssh”, “id_rsa”)]
ssh_options[:config] = false

…added to the Capfile, commit and then attempt another deploy.

Setup LAMP and phpMyAdmin from scratch on Ubuntu 10+

apache, lamp, linux, mysql, php, phpmyadmin

It’s really easy to get a LAMP webserver up and running, so I thought I’d post some nice easy instructions for installing on a Ubuntu box.

1) sudo apt-get install mysql-server mysql-client
-> you will need to choose a MySQL Root user password

2) sudo apt-get install apache2
-> confirm in your browser that you are able to view a page for your IP address. This could be localhost, or your local IP address.

3) sudo apt-get install php5 libapache2-mod-php5
-> you’re going to need to install PHP next as above.

4) /etc/init.d/apache2 restart
-> …and of course an Apache restart so that PHP is activated

5) sudo apt-get install phpmyadmin
-> you’re going to be asked which webserver to configure. go for apache2. it’ll then probably request your password you selected for MySQL.

6) vim /etc/apache2/apache2.conf
-> use your favorite editor to open up the apache config file

7) Include /etc/phpmyadmin/apache.conf
-> add the following somewhere in the file.

8) /etc/init.d/apache2 restart

9) http://yourhomepage.com/phpmyadmin
-> test 🙂