AWS EC2 + LAMP + Ubuntu + Drupal install

Tutorial from AWS EC2 Docs

Ubuntu install Apache + PHP

Check this tut but we have RDS so not need to install MySQL like this:


Install php mysql:

Restart apache:

Error log:  /var/log/apache2/error.log



Using Git from BitBucket repository

Install git first. Then when I try to clone the Bitbucket repository, it failed and gives error:

To solve this, you need using SSH keys:

To create SSH keys:


Create a cron job in Linux

Add cronjob to crontab

Follow this one:

Here is a good Cron Job tutorial: How to Create a Cron Job (Scheduled Task) for Your Website or Blog

Use below command to create/edit crontab:

Use below command to list crontab:

Check if cronjob is running

After add a crontab, if it is not working. You can check the log, in my server, it is like this:

Ubuntu may has different log location:

You can see just cron jobs in that logfile by running

Different server may have different path. Check this answer to find more:

Check output

If there is no MTA installed, cron just throws the job output away. The above log will only record the cron running history.

Also, check log you may will see this error:

Linux uses mail for sending notifications to the user. Most Linux distributions have an mail service (including an MTA) installed. Ubuntu doesn’t though. You can install a mail service, postfix for example, to solve this problem.

Check more:

Or you can not send mail by add  2>&1  to not send mail like below. Log them into log file.

Below cron job will redirect all standard output and errors that may be produced by the script that is run to the log file specified:

Drush and cronjob

If you are using Drupal, you may need Drush. Using drush in the cronjob is same as other script. But you may will get “Can’t run drush from cron” error.

My simple solution is like this:

Replace “/var/www/html” to your Drupal site root path.
Replace “/home/ubuntu/.composer/vendor/bin” to your Drush install location.
Create any log file to replace “/var/log/mycron.log”.
For the reason and other solutions, check following links:

Find files modified on specific date or date period

Following works on Godaddy linux shared hosting:

For other command, check this post:


How to find my apache user

go through config file httpd.conf and find out user and group name:

In linux, with following command:

Then you will get the result as below:


Useful Linux shell command

Remove all files & folders

Above will pop prompt to ask for confirm on each file. So ignore that by use following:



Move all files/folders including hidden files to another folder

You could turn on dotglob:

In order to turn off dotglob, you’d need to say:

 Copy all the files and directories including hidden files and directories

 Set up umask

What is Umask and How To Setup Default umask Under Linux?

Restart bashrc


Command short cut

  • ctrl+u Delete all line
  • Ctrl+w delete word by word
  • ctrl a/e go to start/end of line