Gün: 15 Ekim 2009

  • postgresql kurulumu

    PostgreSQL is my preferred database on a Linux environment.This is the sequence I used to install it on my development machine. It is running Ubuntu 8.10 (Intrepid Ibex) beta on a VMware Workstation virtual machine.

    I referred to https://help.ubuntu.com/community/PostgreSQL, http://bioinformaticsonline.co.uk/2007/02/26/postgresql_on_ubuntu_linux_how_to and http://hocuspokus.net/2007/11/05/install-postgresql-on-ubuntu-710/ and adapted the instructions a little bit.

    Installing the server and basic tools

    sudo apt-get install postgresql postgresql-client postgresql-contrib

    That got me PostgreSQL 8.3.

    Basic Server Setup

    First, changing the password of the postgres user:

    sudo -u postgres psql postgres
    ALTER USER postgres WITH ENCRYPTED PASSWORD ‘<***password***>‘;
    \q

    Creating the initial databases

    sudo -u postgres createdb dev
    sudo -u postgres createdb test

    That creates a database named “dev”, for development, and another named “test”, for testing.

    I use schemas to have multiple applications using a single database.

    Setting Up the Admin Pack

    The admin pack is said enable better logging and monitoring within pgAdmin.

    sudo -u postgres psql < /usr/share/postgresql/8.3/contrib/adminpack.sql Installing pgAdmin III pgAdmin III is a database design and management application for use with PostgreSQL. sudo aptitude install pgadmin3 Using pgAdmin pgadmin3 I clicked on the “Add a connection to a server” button (top left). I filled in the host (localhost) and password of the postgres user (from the previous ALTER USER command). Then I clicked OK and was connected to the local PostgreSQL server. Incidentally, I noticed that the databases I created were set to UTF-8 encoding. Great, exactly what I wanted. Restarting the server If there is any need, the server can be restarted this way: sudo /etc/init.d/postgresql-8.3 restart Other tasks Some times I might want to open up the server for network access and/or install phpPgAdmin to control it with a Web interface. The articles mentioned in the introduction can help with that. I don’t think I’ll have to do either thing on this development environment, though. Conclusion That’s it. Quick, easy and powerful. I really like Ubuntu.

  • virtualbox ose de host interface ayarı

    We have already discussed how to install virtualbox and create virtual machines in ubuntu.This tutorial will explain How to set up host interface networking for VirtualBox on Ubuntu.

    To start, NAT is by far the easiest way to get your guests connected to the interweb, but you may want to use the guests as servers. For this you need Host Networking.

    To configure Host Networking you need to configure network bridging, you basically go through four steps on the host machine

    * Install necessary packages

    * Declare bridge and real network interface you add to it

    * Declare virtual interfaces

    * Set permissions on /dev/net/tun

    Preparing Your system

    You need to install the following packages

    sudo apt-get install uml-utilities bridge-utils

    Now you need to take the backup of your networking file using the following command

    sudo cp /etc/network/interfaces /etc/network/interfaces.backup

    You have to edit /etc/network/interfaces on the host machine to declare the bridge, this procedure is slightly different if your host use static or dynamic IP.

    sudo gedit /etc/network/interfaces

    If you have Dynamic IP, on the host machine:

    auto eth0
    iface eth0 inet manual

    auto br0
    iface br0 inet dhcp
    bridge_ports eth0 vbox0

    # The loopback network interface
    auto lo
    iface lo inet loopback

    “eth0″ is the name of your interface, it can be different depending on your machine.

    “br0″ is an arbitrary name for the bridge.

    “vbox0″ is an arbitrary name for the device VirtualBox will use, if you want more devices, you just add then like:

    bridge_ports eth0 vbox0 vbox1 vbox2 vbox3 vbox4 and so on.

    If you are using Static IP addresses modify the interfaces like this:

    auto eth0
    iface eth0 inet manual

    auto br0
    iface br0 inet static
    address 192.168.0.100
    netmask 255.255.255.0
    gateway 192.168.0.1
    bridge_ports eth0 vbox0 vbox1

    # The loopback network interface
    auto lo
    iface lo inet loopback

    Replace 192.168.0.100 with your IP, 255.255.255.0 with your netmask and 192.168.0.1 with your gateway. If you are using static IP addresses for eth0, eth1, etc; you will need to configure the br0 interface using the same settings! Otherwise your system will request an IP address via DHCP. You may add as many vbox# interfaces as you wish as long as they are also declared in /etc/vbox/interfaces; keep reading for details.

    Save and exit the file.

    You need to restart networking for the changes to take effect using the following command

    sudo /etc/init.d/networking restart

    Declare virtual interfaces in VirtualBox network file

    To declare the virtual interfaces used by VirtualBox you need to edit /etc/vbox/interfaces on the host machine

    sudo gedit /etc/vbox/interfaces

    # Each line should be of the format :
    #interface name user name [bridge]
    vbox0 your user name br0
    vbox1 your user name br0

    Where “vbox#” is an arbitrary name. You may declare here as many virtual interfaces as you wish, as long as they have been properly declared in /etc/network/interfaces. In this specific article, we declared two vbox interfaces in /etc/network/interfaces, then finished setting them up in /etc/vbox/interfaces.

    To take the modifications into account, restart the VirtualBox host networking script. If you installed VirtualBox OSE

    sudo /etc/init.d/virtualbox-ose restart

    If you installed the pre-compiled proprietary version

    sudo /etc/init.d/vboxnet restart

    The virtual interfaces are now created and added to the bridge.

    That’s it! Now the different scripts will take care of cleanly create/configure/remove bridges and virtual interfaces when you boot and shut your system down.

    Set permissions on /dev/net/tun

    You need to have read/write permissions on the file /dev/net/tun to be able to use the bridge, to set permissions

    sudo chown root:vboxusers /dev/net/tun

    sudo chmod g+rw /dev/net/tun

    This file is created with the default permissions every time the system restarts, to make the new permissions permanent you have to edit the file /etc/udev/rules.d/20-names.rules and change

    KERNEL==”tun”, NAME=”net/%k”

    to

    KERNEL==”tun”, NAME=”net/%k”, GROUP=”vboxusers”, MODE=”0660″

    Configure networking in VirtualBox

    Once you have everything ready, you can start the VirtualBox management interface on the host machine, configure the network of your virtual machine, and by selecting “host networking”, enter the name of one of the virtual adapter you have configured. Start your virtual machine, it gets a network card presented, that you can set up as you wish (static IP address, DHCP) using the network configuration tools inside the virtual machine.