Friday, November 25, 2011

install oracle instance client on ubuntu 11.10 x64


  • download *.rpm from oracle
  • sudo alien to install rpms
  • vi /etc/ld.so.conf.d/oracle-instantclient11.2-basic.conf 
    • /lib
    • /usr/lib/oracle/11.2/client64/lib
  • sudo ldconfig

Monday, November 21, 2011

mysql testdb


mysql> create database testdb;
Query OK, 1 row affected (0.03 sec)

mysql> create user 'testuser'@'localhost' identified by 'password';
Query OK, 0 rows affected (0.06 sec)

mysql> use testdb;
Database changed
mysql> grant all on testdb.* to 'testdb'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql>flush privileges

mysql>select user, host from mysql.user;

Tuesday, November 8, 2011

DNS wildcard and DHCP with BIND vs dnsmasq


set up DNS wildcard for blah.dev

BIND configuration

/etc/bind/named.conf.local 
zone "dev" {
   type master;
   file "/etc/bind/db.dev";
};
run"named-checkconf named.conf.local"
/etc/bind/db.dev:  use the loopback address so the IP address is not affected by DHCP.
dev. 86400 IN SOA dev. hostmaster.dev. (
               20111101; serial yyyy-mm-dd
               10800; refresh every 15 min
                3600; retry every hour
                 3600000; expire after 1 month +
                86400 ); min ttl of 1 day
  IN NS dev.
  IN MX 10 dev.
  IN A 127.0.0.1
*.dev. IN A 127.0.0.1
named-checkzone dev db.dev

DHCP client configuration

  • uncomment the line in /etc/dhcp/dhclient.conf: prepend domain-name-servers 127.0.0.1;
  • sudo dhclient
  • sudo /etc/init.d/bind9 restart


Testing

ping blah.dev will return 127.0.0.1


Set up dnsmasq for local DNS cache and DHCP


disable dnsmasq from networkmanager

sudo vim /etc/NetworkManager.conf.  comment out dnsmasq
sudo service network-manager restart



Install and configure dnsmasq


  • sudo apt-get install dnsmasq
  • sudo vim /etc/dnsmasq.conf
  •     listen-address=127.0.0.1
  •     address=/dev/127.0.0.1
  •     address=/prod/127.0.0.1
  • sudo service dnsmasq restart


Set up Apache for vhost_alias
 

mod_vhost_alias
  • sudo a2enmod vhost_alias (this will enable module vhost_alias for loading). 
  • sudo vi /etc/apache2/mods-available/vhost_alias.conf    (create one if not existing)
<VirtualHost *:80>
# get the server name from the Host: header and put in %0

 # this is for dev
RewriteCond %{HTTP_HOST} ^mongo.dev$
RewriteRule (.*) http://localhost:28017/_replSet


RewriteCond %{HTTP_HOST} ^mongo.snap$
RewriteRule (.*) http://192.168.1.100:28000/_replSet



UseCanonicalName Off

# include the server name in the filenames used to satisfy requests
VirtualDocumentRoot /var/www/vhosts/%0

<Directory />
# Global settings
Options FollowSymLinks
AllowOverride All
</Directory>

</VirtualHost>