Wednesday, November 28, 2018

Ubuntu 12.04 post upgrade process with Zend Server and Zend Framework 1

After upgrading Ubuntu Server to version 12.04, your web application based on ZendServer will stop working. The reason is that newly upgraded Apache 2 web server is incompatible with your Zend Server. So if you don't want to go through a painful process of compiling the right version of Apache 2 to work with your Zend Server, you can instead remove the Zend Server and just use the Zend Framework. You will lose the goodies of Zend Server - but if sole Zend Framework is enough to run your site, these steps will get you there. Note that these instructions apply to Zend Framework 1.

Remove Zend Server

sudo apt-get remove zend-server-ce-php-5.3

Backup apache configuration

cd /etc/apache2/
mkdir ~/apache2-backup
cp -R * ~/apache2-backup/

Get rid of any remnants of previous installation of php5 and Zend Server

sudo apt-get remove php5
sudo apt-get autoremove

Install php5 (plus optional extensions)

sudo apt-get install php5 php5-mysql php5-gd

Download and unzip Zend Framework 1 to shared location

sudo cp ZendFramework.zip /usr/local/zend/share/
cd /usr/local/zend/share/
sudo unzip ZendFramework.zip
sudo rm ZendFramework.zip

Include path to the Zend Framework in /etc/php5/apache2/php.ini

include_path = ".:/usr/share/php:/usr/local/zend/share/ZendFramework/library"

In my case I also updated these variables in /etc/php5/apache2/php.ini

post_max_size = 32M
upload_max_filesize = 32M

As a side note to the Ubuntu Server 12.04 upgrade, I also had to modify my Apache 2 configuration in ssl-default file to change ServerName from .local to fully qualified domain name like mysite.com. I also added ServerAlias www.mysite.com.

Friday, August 3, 2018

DNS Installation and Configuration on Ubuntu Linux

  • Prerequisites for our configuration:

    • 2 servers, one for primary DNS, the other for secondary DNS
    • server 1 - primary DNS
      • static IP 192.168.1.8
      • gateway 192.168.1.1
      • DNS 192.168.1.8, 192.168.1.3
      • hostname ns in file /etc/hostname
      • entry 127.0.1.1 ns in /etc/hosts
    • server 2 - secondary DNS
      • static IP 192.168.1.3
      • gateway 192.168.1.1
      • DNS 192.168.1.8, 192.168.1.3
      • hostname ns2 in file /etc/hostname
      • entry 127.0.1.1 ns2 in /etc/hosts
  • Install bind9 DNS server software:

    sudo apt-get install bind9 bind9utils bind9-doc
  • Verify content of named.conf. This is the primary configuration file for the bind DNS Server. It usually contains only includes of other configuration files.

    cat /etc/bind/named.conf

    Default content:

    include "/etc/bind/named.conf.options";
    include "/etc/bind/named.conf.local";
    include "/etc/bind/named.conf.default-zones";
  • Edit named.conf.options:

    sudo nano /etc/bind/named.conf.options

    The example of the file. The acl clause allows fine-grained control over what hosts or users may perform what operations on the name server. Within the goodclients block, list the IP addresses or networks that should be allowed to use this DNS server. Block forwarders contains the IP addresses of the recursive name servers that we want to forward requests to. We will use Google's public DNS servers (8.8.8.8 and 8.8.4.4).

    acl goodclients {
            192.168.1.0/24;
            localhost;
            localnets;
    };
     
    options {
            directory "/var/cache/bind";
     
            recursion yes;
            allow-query { goodclients; };
     
            forwarders {
                    0.0.0.0;
                    8.8.8.8;
                    8.8.4.4;
            };
            forward only;
     
            dnssec-enable yes;
            dnssec-validation yes;
     
            auth-nxdomain no;    # conform to RFC1035
            listen-on-v6 { any; };
    }
  • Make a copy of local zone configuration template. The new file main.mydomain.com will hold our zone configuration.

    sudo cp /etc/bind/db.local /etc/bind/main.mydomain.com
  • Define mydomain.com zone in named.conf.local file and point to your newly created zone file main.mydomain.com:

    sudo nano /etc/bind/named.conf.local

    The zone definition should look like this:

    zone "mydomain.com" {
      type master;
      file "/etc/bind/main.mydomain.com";
    };
  • Configure your zone definition file main.mydomain.com.

    sudo nano /etc/bind/main.mydomain.com

    The following is mydomain.com zone configuration example. NS entry type identifies the nameservers. The ns, ns2, archive, and mirror entries map the subdomain names to the IP addresses. $TTL entry dictates timeout for the DNS cache (in seconds). After the timeout, the DNS entries are reloaded again.

    ;
    ; BIND data file for local loopback interface
    ;
    $TTL    604800
    @       IN      SOA     mydomain.com. root.mydomain.com. (
                                2         ; Serial
                           604800         ; Refresh
                            86400         ; Retry
                          2419200         ; Expire
                           604800 )       ; Negative Cache TTL
            IN      A       192.168.1.2
    www     IN      A       192.168.1.2
    ;
    @       IN      NS      ns.mydomain.com.
    @       IN      NS      ns2.mydomain.com.
    @       IN      A       192.168.1.2
    @       IN      AAAA    ::1
    ns      IN      A       192.168.1.8
    ns2     IN      A       192.168.1.3
  • To apply the new configuration, restart the DNS server:

    sudo service bind9 restart

NOTES

File /etc/nsswitch.conf contains order of preference in using hosts file and DNS. In our scenario, we use DNS first, then the hosts file:

  hosts:          dns files

Sunday, January 3, 2016

Breaking apart A/C controller unit

Microcontroller ATMEGA329PA (32KB rewritable flash, 2KB RAM) 

This is new to me: the backlight reflection panel (white)