Bash – set variable with or without export are different

I am working on an AWS ec2 instance provisioning script today. I am using Packer to provision the instance and build an AMI. The instance is running Ubuntu. There is a very annoying error when I am using ‘apt-get -y upgrade’ or ‘apt-get -y install’:

debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin:

Google it and not hard to find the fix is to add “DEBIAN_FRONTEND=noninteractive” in your script
(credit to link to stackoverflow)

However, it still doesn’t work for me until I realize I need to put in ‘export’:

export DEBIAN_FRONTEND=noninteractive

Apparently ‘export’ will make the variable is available to any process you run from your current shell process (not parent process though). Without ‘export’, the variable scope is restricted to the shell, and is not available to any other process.
(credit to link to stackoverflow)

Set up an Amazon Ubuntu server to run Zend Framework PHP Web Application

First of all, I am new to Ubuntu.

I am a Centos fan for last couple of years, but have heard of Ubuntu is a great system too, especially user friendly.

Today, one client asked me to rebuild a Amazon server for his Zend Framework PHP Web Application dut to its current stability issue. (Amazon Linux seems to have issue with MySQL which causes MySQL memory issue randomly). I figured it is a good time for me to try Ubuntu.

First, start up a new Amazon micro instance with Ubuntu LTS (LTS seems to be more stable and long term support).

Install Zend Server 6.0 Community Edition

Zend Server CE has made the installation so easy for us.

  1. SSH to server
  2. download Zend Server (DEB/RPM Installer Script)
  3. Unzip it and run the install script as root:
    ./ 5.3     or    ./ 5.4  if you need 5.4 version PHP
  4. Simply ‘y’ when prompt
  5. Done – navigate to http://<server ip> you will see “It works”
Install MySQL
  1. apt-get install mysql-server
  2. Please be noted the default MySQL sock is in here: /var/run/mysqld/mysqld.sock

Install phpMyAdmin

  1. Navigate to http://<server ip>:10081 and set up the Zend Server
  2. Deploy Application
  3. Follow this link to download phpMyAdmin package and install it via Zend Server
  4. Well, you may want to disable the auto login for security reason, change auth_type to http in this file:

Set up FTP

  1. Follow this link