Archive for the ‘Tricks’ Category

Quick Drupal install on Ubuntu 10.04 server

Here’s some instructions for doing a really quick Drupal install on Ubuntu server 10.04.

This assumes that you are well versed with Drupal and have already created your database and database user and given the rights to the DB user to access the DB.

Step 1 download, extract, and copy the files into the /var/www root

$ cd /
$ sudo wget http://ftp.drupal.org/files/projects/drupal-6.20.tar.gz
$ sudo tar xvzf drupal-6.20.tar.gz
$ sudo mv drupal-6.20/* drupal-6.20/.htaccess /var/www
$ sudo rm -rf drupal-6.20.tar.gz
$ sudo rm -rf drupal-6.20

Create the files directory and give it the proper ownership

$ sudo mkdir /var/www/sites/default/files
$ sudo chown www-data:www-data /var/www/sites/default/files

Copy default settings.php file to settings.php so that you can enter your own server and database details

$ sudo cp /var/www/sites/default/default.settings.php /var/www/sites/default/settings.php
$ sudo chown www-data:www-data /var/www/sites/default/settings.php

From here you would need to edit /var/www/sites/default/settings.php and enter in our server, database, and database user details.

I would also like to note that you can also install Drupal with aptitude on Ubuntu, but I would much prefer to install Drupal manually and use Drush to update drupal whenever I want to have it updated.

I only want Drupal updated when I say so and with what versions that I decide on.

$ sudo apt-get install drupal6

Installing Drush (at the time of this writing 4.2 is the latest version)

$ sudo apt-get install php5-cli
$ cd /usr/local/
$ sudo wget http://ftp.drupal.org/files/projects/drush-All-versions-4.2.tar.gz
$ sudo tar zxvf drush-All-versions-4.2.tar.gz
$ sudo rm -rf drush-All-versions-4.2.tar.gz (remove downloaded and extracted tar file)
$ cd drush (to make sure the files are there)
$ sudo chmod 555 drush

Create symbolik link
$ cd /usr/local/bin
$ sudo ln -s /usr/local/drush/drush drush

Prevent your SSH connection from locking up

Have you ever been working on a Terminal shell SSH session, get busy and then went back to the shell to issue some more commands or look at something only to find that the shell window has locked up.

This requires you to close the Terminal window, open a new one and then login to your remote session again.

In a previous post here, I showed you how to create a ~/.ssh/config file.

Simply add these two lines to your ~/.ssh/config file and any SSH connection that you have to a remove server should not lock up.

ServerAliveCountMax 3
ServerAliveInterval 10

Simplifying SSH command to access Amazon EC2 server

If you are like me and you have to push the up arrow in your terminal window each time you need to remember exactly what the command is to access your Amazon EC2 server, here is a time saving SSH configuration trick for you.

example:

$ cd ~/.ec2
$ ssh -i davidskey.pem ubuntu@ec2-69-37-131-80.eu-west-1.compute.amazonaws.com

You can create a config file in your ~/.ssh directory to include your identity file for individual host names.
If your Amazon server has a public DNS entry which points to the long Amazon public DNS name, you can make this even easier.

$ cd ~/.ssh
$ ls -al (if you don't find a file called "config" you can create one using the following line)
$ touch config
$ nano config

Add these lines: (assuming that dev.davidsdomain.com is a CNAME DNS entry which points to ec2-69-37-131-80.eu-west-1.compute.amazonaws.com.

Host dev.davidsdomain.com
IdentityFile ~/.ec2/davidskey.pem

Host ec2-69-37-131-80.eu-west-1.compute.amazonaws.com IdentityFile ~/.ec2/davidskey.pem

Now you can SSH to both domain names using only the following. Also note that you do not have to change to the ~/.ec2/ directory to issue the SSH command anymore.

$ ssh ubuntu@dev.davidsdomain.com
$ ssh ubuntu@ec2-69-37-131-80.eu-west-1.compute.amazonaws.com

One final note, is that this would work on any host that you use a keyfile to access via SSH. This is of course, not limited to Amazon EC2 server access.

How to recursively set the file permissions for all .php files on a *nix box

I had a need today to change the security of all .php files in a sub-directory, which contained dozens of sub-directories.

I figured out how to do it recursively with the find command. In the example below, I set all *.php files to chmod 755.
All other files with a file extension other than .php and directories were unaffected.

$ cd /mydirectory
$ find . -type f -name '*.php' -exec chmod 755 {} \;

Excellent productivity tip (part 2)

A few days ago, I wrote a post about adding Google Tasks to the Firefox sidebar. I’ve been using this for a few weeks now and feel more productive.

I have a gmail account and use it to synch my non-work/personal CalDAV calendar between my iPhone, different macs at home, and can access my personal calendar on my PC at work with Lotus Notes.

I’m also now able to synch my personal to-do lists (or tasks you may not want in your corporate Domino mailbox for whatever reason) between my iPhone, PC at work, and Macs at home (both via Firefox sidebar bookmarks).

I tried setting this up on a new computer today and wasn’t able to drag the google tasks to my firefox bookmarks tool bar.

I kept getting the error message “Close this window to resume using Tasks in Gmail.”

I found this second post which shows the exact URL that you need to bookmark, and also highlights how to either set this up in Google Chrome, or set up your tasks in a desktop application.

Consulting

I'm currently available
for Lotus Notes / Domino consulting engagements.

LinkedIn

Connect with me:

LinkedIn

Advertisement
Advertisement
Categories