How to Install Drush in CentOS and Red Hat Linux

Drush is included in the EPEL repository so you can use the yum command to install it. Do the following:

  1. Enable the EPEL repository if it isn’t already. Instructions for enabling it are available here.
  2. Install the Drush package with the command: sudo yum install drush
    • If you want to know what version of drush you are installing, do this command first: yum info drush
  3. Done. Drush is now available globally for all users of the system.

How to Mirror A Directory Locally Using Rsync

Most of the instructions for mirroring a directory with Rsync involve mirroring the data to a different server. You can also use Rsync to sync or mirror a directory on the same computer as the source directory.

Here is an example command on how to mirror two directories locally. In this example, /home/apache/public_html is the source directory and /home/apache/public_html_bak is the destination directory. Forward slashes at the end of the directory names in the rsync command are important so don’t forget them. The sync is one-way in that the destination will mirror the source:

rsync -avr --delete --links /home/apache/public_html/ /home/apache/public_html_bak/

If you need to preserve ACLs and Extended attributes then you need to add the -A and -X switches:

rsync -avrAX --delete --links /home/apache/public_html/ /home/apache/public_html_bak/

If you want to just do a dry run to see what will happen when you run Rsync, then add the -n switch:

rsync -avrAXn --delete --links /home/apache/public_html/ /home/apache/public_html_bak/

Terminal


How to Force SSL Connections with a Website

You can force visitors of your website to use SSL connections (HTTPS) if your web server uses Apache for its web services. Most web hosting providers use Apache for their Linux servers. To automatically redirect someone to the SSL (HTTPS) version of your website place the following at the top level of your website directory inside of a file named .htaccess:

RewriteEngine on
RewriteCond %{HTTPS} !^on$ [NC]
RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI} [L]

Alternatively, you can use this instead:

RewriteEngine On
RewriteCond %{SERVER_PORT} !443$
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R]

How to Change the SFTP Port In Dreamweaver CS3

When you set up a SFTP server connection for a website in Dreamweaver, the default port used is 22. If you want to use a different port then you need to add a “:portNumber” at the end of the “FTP Host” address field. For example, suppose your web server has an address of www.foo.com and SFTP has been configured on the server to listen on port 1234. In Dreamweaver you need to set the FTP host address to “www.foo.com:1234”.

This technique may work for other versions of Dreamweaver but I am not sure. I have only tested this with Dreamweaver CS3.