Archive

Posts Tagged ‘howto’

setting up MPD

13 November 2008 amychr Leave a comment

Setting up the Music Player Daemon (MPD) can be easy and fast with a little help. Here’s what to do to get it going after installing it (with apt, emerge, pacman etc):

rm /etc/mpd.conf
(just in case)
vim /etc/mpd.conf
(put in it and change to suit)
music_directory        “~/music”
playlist_directory    “~/music/playlists”
db_file                “~/.mpd/db”
log_file            “~/.mpd/log”
error_file            “~/.mpd/error”
pid_file            “~/.mpd/mpd.pid”
state_file            “~/.mpd/mpdstate”
user                “youruser”
bind_to_address        “127.0.0.1″
port                “6600″
(save it and close)
mkdir ~/music
mkdir ~/music/playlists
(if you need to)
touch ~/.mpd/mpd.pid
mpd –create-db
(if this doesn’t work, check the user in mpd.conf)
mpd

To get it to run on bootup: (for Arch linux)

add mpd to /etc/rc.conf to have it on boot up.
(in the DAEMONS line)

Categories: root Tags: ,

Quick DNS setup guide for Leopard

15 May 2008 amychr 6 comments

Ready for a quick setup of DNS server bind on OS X? Here we go! You need admin access rights to do this, so to make it easy, I suggest you do all the file editing in the terminal with vi or pico. This guide is best for a one domain, one IP setup, although it is true for any configuration with some changes. Use this guide if you know nothing about DNS and want to set things up quick or if you know what you’re doing and need to know which files OS X is using.     ….not valid for Leopard Server!

  1. Open /etc/named.conf in your favorite editor (or sudo vi /etc/named.conf)
  2. First change to named.confAdd a foward zone for each do main, like this. The zone is the name of the domain you want to host and the file is what file will have to domain’s configuration in it. You need one for each domain you’re hosting. 
  3. Second change to named.confAdd a reverse zone for each IP subnet which will be used for the domains.Set the zone to the first three digit groups of the subnet, backwards. So, 192.168.0.x will be written 0.168.192. I know, it’s a little weird. In both the foward and reverse files, what file name you choose is really arbitrary. You just have to be consistent. The files themselves will be in /var/named.
  4. Save the changes to named.conf and close the file. The file should look something like this: (if you can’t see the whole thing, copy and paste it into an editor)
  5.  

     

    //
    // Include keys file
    //
    include "/etc/rndc.key";
    
    // Declares control channels to be used by the rndc utility.
    //
    // It is recommended that 127.0.0.1 be the only address used.
    // This also allows non-privileged users on the local host to manage
    // your name server.
    
    //
    // Default controls
    //
    controls {
    	inet 127.0.0.1 port 54 allow {any;}
    	keys { "rndc-key"; };
    };
    
    options {
    	directory "/var/named";
    	/*
    	 * If there is a firewall between you and nameservers you want
    	 * to talk to, you might need to uncomment the query-source
    	 * directive below.  Previous versions of BIND always asked
    	 * questions using port 53, but BIND 8.1 uses an unprivileged
    	 * port by default.
    	 */
    	// query-source address * port 53;
    };
    //
    // a caching only nameserver config
    //
    zone "." IN {
    	type hint;
    	file "named.ca";
    };
    
    zone "localhost" IN {
    	type master;
    	file "localhost.zone";
    	allow-update { none; };
    };
    
    zone "0.0.127.in-addr.arpa" IN {
    	type master;
    	file "named.local";
    	allow-update { none; };
    };
    
    zone "kiwimod.com" IN {
    	type master;
    	file "named.kiwimod.com";
    };
    
    zone "129.234.60.in-addr.arpa" IN {
    	type master;
    	file "named.129.234.60";
    	allow-update { none; };
    };
    
    logging {
            category default {
                    _default_log;
            };
    
            channel _default_log  {
                    file "/Library/Logs/named.log";
                    severity info;
                    print-time yes;
            };
    };

     

     

  6. Save the changes to named.conf and close the file.
  7. Create the foward zone file we specified earlier (named.kiwimod.com) in /var/named. This directory will also contain named.local and named.ca. Just leave these files alone. They are fine as they are.
  8. Open the file in an editor. (Again, sudo is very useful for this.) Type in this, changing the names to fit your site:
  9.  

     

     

    ; DNS for KiwiMod.com
    
    $TTL 86400  ; 1 day
    kiwimod.com.          IN  SOA ns.kiwimod.com. admin.kiwimod.com. (
                              2003040101      ; Serial
                              10800           ; Refresh after 3 hours
                              3600            ; Retry after 1 hour
                              604800          ; Expire after 1 week
                              86400 )         ; Minimum TTL of 1 day
    
    ; name servers
    @	IN	NS	ns.kiwimod.com.
    @	IN	MX	10 mail.kiwimod.com.
    
    ; host to address mappings
    @		IN	A		60.234.129.2
    mail		IN	A		60.234.129.2
    ns		IN	A		60.234.129.2
    ; aliases
    www		IN	CNAME	mail
    amy		IN	CNAME	mail

     

  10. Save and close the file.
  11. Create the reverse zone file (named.129.234.60 or whatever you called it) in /var/named. Edit the file to read:
  12.  

     

     

    ; Reverse lookup for 60.234.129.2
    $TTL 86400  ; 1 day
    129.234.60.in-addr.arpa  IN  SOA ns.kiwimod.com. root.kiwimod.com. (
                                2003040101      ; Serial
                                10800           ; Refresh after 3 hours
                                3600            ; Retry after 1 hour
                                604800          ; Expire after 1 week
                                86400 )         ; Minimum TTL of 1 day
    
    ; name servers
    129.234.60.in-addr.arpa  IN  NS  ns.kiwimod.com.
    
    ; address to host mappings
    2                       IN  PTR kiwimod.com.
    2                       IN  PTR ns.kiwimod.com.
    2                       IN  PTR mail.kiwimod.com.

     

  13. Just change the IP and domain bits to be your settings. The digit 2 in address to host mappings is the last number of the IP address. In this example, only one IP is being used for the domain, but using more than one works pretty much the same way, you just need additional reverse zone files and reverse lookup settings in named.conf.

That’s it. All you have to do now is start up named and see if it worked.
In the terminal, type:

sudo named -c /etc/named.conf

to start up the nameserver. To see if the name is resolving, try digging it:

dig kiwimod.com

or

dig 192.168.your.IP

Use your own IP of course, the IP of the server that is. You should get back some information about the server, like what IP the nameserver has. If not, then something has gone horribly wrong!

Categories: root Tags: , , ,

Serving with OS X: BIND and DNS

15 May 2008 amychr Leave a comment

This is part one to setting up a basic, all-in-one server under Mac OS X. We’re going to investigate how the Mac stacks up as a server in setup and customization. For the most part, I’m going to assume you’ve either heard about or tinkered with these tools in some other *nix before.

( Skip to Quick Setup Guide! )

Let’s use an example setup. You have one computer, a mac, that you want to run apache and maybe some other services on. You also want to host your own domain. You’re probably going to want to decide how the domain is going to be organized ahead of time. This makes things a lot easier when you go to setup the actual domain structure in BIND. But lets get down to some basics about DNS first.

About DNS

In order for networked computers to translate between a shortcut name, like google.com, and a real IP address, they have to contact a Domain Name Server. DNS servers keep a list of what computer names are associated with what address. There is a lot (a lot!) more to know about DNS than this, so I refer you to the info list at the bottom for more. Ok, so how do we do this?

What you need

  1. a domain name which has been registered for you to an IP you are using on your server.
  2. a mac
  3. know what hosts you need. Hosts come in front of the domain, like www or mail.

Putting it together, an example

Our example is an all-in-one web, mail, and dns server. We’re going to call it kiwimod.com. OS X comes with the DNS server application, Bind, already installed and ready. (Bind and Named, pronounced name-d, are two names for one service.) We just have to add some information to the configure files to be off and running. Take a look at /etc/named.conf

Named.conf has the information about what domains your site is running and what files contain the configuration settings. In this file what you have to do is add a zone for each domain and each IP address your going to setup. Let’s use our example domain, kiwimod.com.

Continue to the DNS setup guide…

Running the daemon

Once you’re satisfied with your setup you want to make sure Bind starts up whenever your computer does. To do this, you need to add a startup script to your mac’s startup items. We’ll cover that in another guide. See you next time!

Categories: root Tags: , ,

X11 Focus settings

26 January 2008 amychr Leave a comment

Gimp for os x used to come with a script to change the focus settings of windows in X11. Today, I downloaded the newest os x compilation, 2.4, and surprise- no script! A little digging revealed a quick and easy way to toggle mouse focus for X11 whenever you want.

Run in the terminal:

defaults write com.apple.x11 wm_ffm -bool true

to turn on mouse focus. (That’s the kind where a window focuses without licking on it if the mouse is hovering over it.) To turn it off, just run the same command with false instead of true at the end.

At the moment, I can’t recommend turning mouse focus on since it seems to cause some trouble for Gimp 2.4. But that’s just my speculation.

Categories: geek Tags: , ,

Eee PC compiz install

25 January 2008 amychr 6 comments

I have fallen in love with the asus eee pc – my new mobile linux machine! It plays nice with my iMac and works well with a special eeeXubuntu install. After some trial and error I’ve put together some quick instructions for getting the snazzy window manager compositing engine Compiz running on this little box.

So this requires:

  • an Eee PC running eeeXubuntu.

That’s it.

::::Compiz install instructions::::

1. Either download this zipfile with configuration settings already set and ready …. or you feel really adventurous and want to do it all yourself later (not in this how to guide!).

2. Run

sudo apt-get install libgl1-mesa-dri compiz-core compiz-plugins compiz-fusion-plugins-main compiz-fusion-plugins-extra emerald compizconfig-settings-manager

3. Add to end of /etc/X11/xorg.conf

Section “Module”
  Load “glx”
  Load “dri”
  Load “dbe”

EndSection

Section “DRI”
  Mode 0666
EndSection

Make sure this file ends with two new lines (blank lines, carriage returns). It will totally mess up your X11 setup otherwise!

4. Restart the x server with ctrl-alt-backspace.

5. Hit alt-f2 and type in:

compiz –replace

This should result in a pause and then nifty new windows!! Now if you like the result, you can make it start up every time by adding the last command to your startup items (I’ll leave how up to you).

Categories: geek Tags: , ,