Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

2012-01-17

Configure a DHCP server (debian)


Installing dhcp server:
# apt-get install isc-dhcp-server

Define a static IP for the server
# nano /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.0.2 # server's IP address
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.1.255
gateway 192.168.0.1 #router's IP address


Configure DHCP server settings at /etc/dhcp/dhcpd.conf
# nano /etc/dhcp/dhcpd.conf

default-lease-time 600;


max-lease-time 7200;
option domain-name-servers 192.168.1.1, 192.168.1.2;
option domain-name "yourdomainname.com";

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.150 192.168.0.200; #Range of client's IP addresses: 150 to 200

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
}


Restart dhcp-server
# /etc/init.d/isc-dhcp-server restart

Restart eth0
#ifdown eth0
#ifup eth0

Links:
http://wiki.debian.org/DHCP_Server

2008-09-17

MPD: Music Player Daemon

About:

Music Player Daemon (MPD) allows remote access for playing music (MP3, Ogg Vorbis, FLAC, AAC, Mod, and wave files) and managing playlists. MPD is designed for integrating a computer into a stereo system that provides control for music playback over a local network. It also makes a great desktop music player, especially if you are a console junkie, like frontend options, or restart X often.

@ MPD homepage

Overview:

I wont explain what it is - everyone knows it's a media player - ops i just did it.
I'm here to show you how to install it. It can be a little bit confusing.

Installation/Configuration:

# apt-get install mpd sonata
Now, the hard tash. It's necessary to configure mpd before any use of it. To start, edit the file /etc/mpd.conf. I recomend to make a backup copy just in case.
# cp /etc/mpd.conf /etc/mpd.conf.backup
# nano /etc/mpd.conf

  1. REQUIRED PATHS & OPTIONAL PATHS
    In this step it's necessary to configure the respective directories where are locatedyour music files. In the field music_directory add your music's directorie (it's only to possible to add one) and in the rest cpy the exemple.
    ######################## REQUIRED PATHS ########################
    # You can put symlinks in here, if you like. Make sure that
    # the user that mpd runs as (see the 'user' config parameter)
    # can read the files in this directory.
    music_directory “/home/os.meus.documentos/music”
    playlist_directory “~/.mpd/playlists”
    db_file “~/.mpd/tag_cache”
    log_file “~/.mpd/mpd.log”
    error_file “~/.mpd/errors.log”
    pid_file “~/.mpd/pid”

    ################################################################
    #
    ######################## OPTIONAL PATHS ########################
    #
    # If specified, MPD will save its current state (playlist,
    # current song, playing/paused, etc.) at exit. This will be
    # used to restore the session the next time it is run.
    #
    state_file “~/.mpd/state”
    #
    ################################################################
  2. DAEMON OPTIONS
    Add you user(in my case it's qaz) in the field user. Uncomment the rest.
    ######################## DAEMON OPTIONS ########################
    #
    # If started as root, MPD will drop root privileges and run as
    # this user instead. Otherwise, MPD will run as the user it was
    # started by. If left unspecified, MPD will not drop root
    # privileges at all (not recommended).
    #
    user “qaz”
    #
    # The address and port to listen on.
    #
    bind_to_address “localhost”
    port “6600″

    #
    # Controls the amount of information that is logged. Can be
    # “default”, “secure”, or “verbose”.
    #
    log_level “default”
    #
    ################################################################
  3. AUDIO OUTPUTS & MIXER
    Uncomment the the text lines wich represent your audio output. Im my case it's alsa.
    ########################## AUDIO OUTPUT ########################
    #
    # MPD supports many audio output types, as well as playing
    # through multiple audio outputs at the same time. You can
    # specify one or more here. If you don't specify any, MPD will
    # automatically scan for a usable audio output.
    #
    # See
    # for examples of other audio outputs.
    #
    # An example of an ALSA output:
    #
    audio_output {
    type “alsa”
    name “My ALSA Device”

    # device “hw:0,0″ # optional
    # format “44100:16:2″ # optional
    }
    #
    # An example of an OSS output:
    #
    #audio_output {
    # type “oss”
    # name “My OSS Device”
    # device “/dev/dsp” # optional
    # format “44100:16:2″ # optional
    #}
    #
    # An example of a shout output (for streaming to Icecast):
    #
    #audio_output {
    # type “shout”
    # name “My Shout Stream”
    # host “localhost”
    # port “8000″
    # mount “/mpd.ogg”
    # password “hackme”
    # quality “5.0″
    # bitrate “128″
    # format “44100:16:1″
    # user “source” # optional
    # description “My Stream Description” # optional
    # genre “jazz” # optional
    # public “no” # optional
    #}
    #
    # Force all decoded audio to be converted to this format before
    # being passed to the audio outputs.
    #
    #audio_output_format “44100:16:2″
    #
    ################################################################
    #
    ############################# MIXER ############################
    #
    # MPD needs to know what mixer settings to change when you
    # adjust the volume. If you don’t specify one here, MPD will
    # pick one based on which ones it was compiled with support for.
    #
    # An example for controlling an ALSA mixer:
    #
    mixer_type “alsa”
    mixer_device “default”
    mixer_control “PCM”

    #
    # An example for controlling an OSS mixer:
    #
    #mixer_type “oss”
    #mixer_device “/dev/mixer”
    #mixer_control “PCM”
    #
    # If you want MPD to adjust the volume of audio sent to the
    # audio outputs, you can tell it to use the software mixer:
    #
    #mixer_type “software”
    #
    ################################################################
  4. OTHER OPTIONS
    Uncomment this two lines:
    ######################### OTHER OPTIONS ########################
    #
    # The metadata types MPD will recognize.
    #
    metadata_to_use “artist,album,title,track,name,genre,date,composer,performer,disc”
    #
    # Enable this if you wish to use your MPD created playlists in
    # other music players.
    #
    save_absolute_paths_in_playlists “no”
    #
    ################################################################
  5. Outher configurations
    Stay as they are. To avoid any doubts,here is my final result.

Now, add your user( mine is qaz) at mpd group (can't explain why this step).

# groupadd mpd
# gpasswd -a qaz mpd

Make sure the folder ~/.mpd doesn't need root privileges.

To create data base (this can take a while):
$ mpd --create-db
In this moment we have mpd completed instaled and configurated.
$ mpd

Frontend:

We still need a frontend. I choose Sonata.

Sonata is an elegant GTK+ music client for the Music Player Daemon (MPD).

@ Sonata Homepage

Sonata's Screenshot. Click in the image to see more pics.

Sonata also needs some configuration. But first let us open it:
$ sonata
Go to Preferences, in the tab MPD add you datasi. My case:

  • Name: qaz
  • Host: localhost
  • Port: 6600
  • Password: (em branco)
  • Music dir: /home/os.meus.documentos/music/

If necessary kill both process (killall) e start mpd & sonata again.

References:
» Techzone/Zwame
» ArchLinux Wiki
» MPD homepage

My files:
» http://dotfiles.org/~uterrorista/%2Fetc%2Fmpd.conf

FeedBack:
Have a question? Please submit a comment :P

2008-04-20

How to install (JRE) Java in Ubuntu (8.04)

I'm trying to install Java at my new Ubuntu and I'm getting some difficulties.
I was scrolling Synaptic Package Monitor for a while and i couldn't find it.

So i Google it..

There are these packages:

sun-java6-bin sun-java6-fonts sun-java6-jre sun-java6-src
sun-java6-demo sun-java6-javadb sun-java6-plugin
sun-java6-doc sun-java6-jdk sun-java6-source


All you (probably) need is:
$ sudo apt-get install sun-java6-jre sun-java6-fonts sun-java6-plugin

Note: The package sun-java6-plugin contain the Firefox plugin.

2008-04-16

Shockwave Player and Plugin for Linux

As you already know, there is no such player/plugin! And the only solution is firefox.exe running through wine.

But, there's some hope. Sign here an online petition..
The Shockwave Player and Plugin for Linux Petition to Macromedia was created by members of the Linux Community and written by Rob Jensen...

2008-04-15

History - terminal tip

With the new meme's fashion:
history|awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
Did anyone just typed history in terminal?

If you try it, you can see the list of the last commands used.

Instead of pressing upper arrow hundred times to see the command that we used in the previous day, just type history

$ history

Check also the manual:

$ man history

2008-04-14

One step forward, two steps back

In Feisty, agere et131x - Ethernet card of my LG P1 - was automatically installed.
Today with Hardy 8.04 and new versions of kernel, there is no 'out of the box'!

One step forward, two steps back! Hrr

To install it:

Download et131x-1.2.3-2.tar.gz (or more recent ) here.

$ sudo apt-get install build-essential linux-headers-$(uname -r)
go to the unpackaged et131x folder
$ make
$ sudo make modules_install
$ insmod et131x.ko
$ sudo depmod
$ sudo modprobe et131x


There might me some errors... close your eyes!
Reboot.

The audio card - Realtek LC880 - was never fixed. I only have audio on phones!

Create new file:
$ sudo gedit /etc/modprobe.d/snd-hda-intel
Paste and save:
options snd-hda-intel model=lg
Reboot!

Links:
»Drivers: et131x

2008-04-12

Pytube - download videos from Youtube

PyTubes is a multimedia converter program.

Features:

  • Downloads videos from Youtube, GoogleVideos, Metacafe, MySpaceTV... And converts them to ogm, mpg, avi, flv, gif, mp4, 3gp, amv, mp3, ogg and wav files.
  • Encode Videos to formats previously mentioned.
  • Search Youtube's videos.
  • Multimedia Tools - Apply audio track to video files, Generate ringtones, Merge videos, Resize videos, Rotate videos.

Screenshot:

Links:
»Homepage: http://bashterritory.com/pytube
»Download page: http://bashterritory.com/

2008-04-11

Linux Distribution Chooser

If you have doubt's about choosing the best Gnu/Linux distribution to you, this site can help.
It will ask you some questions, inquiring you about your experience and preferences with Linux.

If you wanna see some screenshots of the different distros, go here!

PS: if you make the test, let me know about the result!
I got Ubuntu, Debian and Xubuntu! I already use Ubuntu :D !

Links:
»Linux Distribution Chooser: Homepage
»Linux Screenshots: The coding studio

2008-03-07

Set the battery in conky correctly

Configure the battery at Conky can be a nightmare looking for this solution at web 'cus there isn't very information about it. I already had this problem...


ACPI battery number is given as argument, at 'funtions' battery, battery_bar and battery_percent. By default the argument is BAT0. But if it doen't work, let's find out the correct argument:

  • Open the terminal and type:
$ ls /proc/acpi/battery

  • There can be various kind of output:
CMB0
BAT1
BAT0
...etc

My output was: CMB0

  • Open the .conkyrc file and edit to (examples):
${battery CMB0}
${battery_bar CMB0}
${battery_percent CMB0}


Obviously, replace CMB0 with the output you received earlier.

2008-03-01

Debian - NVIDIA drivers

A quick and easy tutorial about how to install NVIDIA drivers as simply as possible.

Prerequisites:

As a starting point, download the latest stable drivers.

Then you’ll need to install a few packages :

$ sudo apt-get install build-essential linux-headers-$(uname -r)
Debian Sarge users have to replace linux-headers with kernel-headers.


Installation:

First you’ll need to kill the X server. You can do that by switching to console #1 : press CTRL-ALT-F1 simultaneously.

Once there, log in with your username and password.

Stop the graphical login manager :

$ sudo /etc/init.d/gdm stop
Then install the drivers :

$ sudo sh NVIDIA-Linux-x86-1.0-9755-pkg1.run
and follow the installation process.

Make sure you tell the installer to automatically modify your /etc/X11/xorg.conf file so you’ll end up using the NVIDIA drivers.


Xorg.conf:

If you haven’t, then you simply have to make a few changes to your /etc/X11/xorg.conf file. Here they are. Debian Sarge users have to modify /etc/X11/XF86Config-4 instead.

In Section “Modules” comment the dri and GLcore modules :

#Load "dri"
#Load "GLcore"

In Section “Device” make sure you use the NVIDIA driver :

Driver "nvidia"

And finally comment the whole Section “DRI” :

#Section "DRI"
# Mode 0666
#EndSection

Here is an example xorg.conf file with the proper changes made.


X:

Once done, load the NVIDIA module :

$ sudo modprobe nvidia
And restart the graphical login manager, which will bring back X :

$ sudo /etc/init.d/gdm start

Tips:

If you happen to update your kernel, then you don’t need to reinstall the whole NVIDIA driver, but only the kernel module. So running this command will do the trick :

$ sudo sh NVIDIA-Linux-x86-1.0-9755-pkg1.run -K

2008-02-06

Java + Compiz

Start by downloading this patch for the jre engine, and then move it to the path of the folder and uncompress it.

$ cd /path/of/the/patch/
$ tar -xf patch.tar
$ cd patch


Now You will do a backup off rt.jr. Usually the path to rt.jr is /usr/lib/jvm/java-6-sun/jre/lib/. I suppose that you are using the latest sun java version.

$ sudo cp /usr/lib/jvm/java-6-sun/jre/lib/rt.jar /usr/lib/jvm/java-6-sun/jre/lib/rt.jar.old
$ sudo cp /usr/lib/jvm/java-6-sun/jre/lib/rt.jar rt.zip



Now you will apply the patch:

$ zip -f rt.zip sun/awt/X11/*
$ sudo cp rt.zip /usr/lib/jvm/java-6-sun/jre/lib/rt.jar


After that you will be able to run any application who use java, like mercury messenger.

2008-01-05

Solution for Compiz + Matlab

  • * You only need to edit the matlab bin file by paste just after the "#!/bin/sh" command:
export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/
  • You will find the matlab bin file on:
/path to matlab/bin/matlab
  • Now edit matlab bin file:
$ gedit /path to matlab/bin/matlab
  • The result after editing the file would be something like this:
#!/bin/sh
export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/
#
# Name:
# matlab script file for invoking MATLAB
#
bla bla bla

  • Save and run Matlab ;)

2007-12-17

Alias - how to

Definition (alias [ˈeiliəs] noun):
a false name

Example: What alias did the crook use this time?
Arabic: إسْم مُسْتَعَار
Chinese (Simplified): 化名
Chinese (Traditional): 化名
Czech: falešné jméno
Danish: alias; dæknavn
Dutch: alias
Estonian: valenimi
Finnish: peitenimi
French: faux nom
German: der Deckname
Greek: ψευδώνυμο
Hungarian: álnév
Icelandic: falskt nafn, tökuheiti
Indonesian: nama palsu, nama lain
Italian: pseudonimo

Japanese: 偽名, 通称
Korean: 별명
Latvian: pieņemts vārds
Lithuanian: slapyvardis, pravardė
Norwegian: dekknavn
Polish: pseudonim, fałszywe nazwisko
Portuguese (Brazil): pseudônimo
Portuguese (Portugal): pseudónimo
Romanian: supranume
Russian: кличка; прозвище
Slovak: falošné meno
Slovenian: lažno ime
Spanish: seudónimo
Swedish: alias
Turkish: sahte a
source: dictionary.com


Alias command definition:

Alias is a built-in shell command that allows you create shortcuts/synonyms for other shell commands.

How to make an alias:
  • Sintax
alias [name=['command']]
  • example - make an alias for clear command:
$ alias cl='clear'
  • description: now when you type cl at your terminal, is the same thing as type clear. This can be used for more and/or long stings..
  • other alias:
$ alias p='pwd'

$ alias x="exit"

$ alias folderx='cd /home/your_user/Desktop/folderx'


How to remove an alias:

  • Sintax
unalias [alias_name]
  • example - remove an alias for clear command:
$ unalias cl

Note:

When the computer is rebooted all alias will be lost.
How to prevent it? All alias must be added to .bashrc file located at your user folder (example: /home/uterrorista/.bashrc)
  • example:
$ gedit /home/uterrorista/.bashrc
  • paste:
alias cl='clear'
etc...
  • now you have to 'compile' your .bashrc file
$ source .bashrc
  • Now cl alias it's saved..
My tutorial:

Make an alias to create other alias..
  • Edit .bashrc
$ cd
$ gedit .bashrc

  • and paste (replace your_user_name with your nick session):
## Add new alias and compile i
alias aalias='gedit /home/
your_user_name/.bashrc && source /home/your_user_name/.bashrc'
  • compile
$ source .bashrc
  • Now you can add the alias you want just simple doing:
$ aalias
  • add (for example. you can make now your desired alias):
## One folder up
alias up='cd ..'

## Clear screen
alias cl='clear'

alias ff='find . -name $*'
alias untar='tar zxvf'
alias p='pwd'

alias ls="ls --color=auto"
alias ll="ls -l --color=auto"
alias la="ls -l -a --color=auto"

alias x="exit"

alias compilar='sudo ./configure && sudo make && sudo make install'

alias apti='sudo apt-get install'
alias aptud='sudo apt-get update'
alias aptug='sudo apt-get upgrade'

alias aptar='sudo apt-get autoremove'
alias aptr='sudo apt-get remove'

alias aptc='sudo apt-get clean'
alias aptac='sudo apt-get autoclean'


function today {
echo "Today's date is:"
date +"%A, %B %-d, %Y"
}


  • Note: you if have noticed i have a function on my .bashrc file - function today. To run it type: today.
  • to remove an alias: just edit the .bashrc file (aalias) and remove/delete the alias you don't need anymore..
Be free to submit a comment and post your alias..

2007-12-08

Bluetooth @ ubuntu - kdebluetooth/kbluetooth

I've some difficulties connecting my Nokia 6820 to the Laptop (maybe it was just my ignorance...)
And know i've a band new Sony Ericsson M600i.

The question survived : How to send files to my phone?

I was using the default gnome bluetooth manager... That was not enough..
I did some research and found out that Kde bluetooth manager was (much) better.

Screenshots



How to use

  • Launch kbluetooh
    An icon will appear at Notification area.
  • Click and you'll get the window previously showed..
    Then the Computer will automatically scan for bluetooth devices(e.g: M600i.box). Remember to turn on your bluetooth's phone.
  • Click on M600i.box icon, then File transfer/Obex File Transfer.
  • Now check your mobile phone. A message asking permission to pair the phone with computer should pop up. Accept it. And enter 'pair code'. At your computer will pop up a window asking the same 'pair code'.
Now you have the two devices are paired. You can explore your mobile content. Copy/Drag files wherever you want to.
Note: depending your mobile phone model you'll still need to check your phone to accept the connection everytime you explore a different folder at your computer.


Install
  • Direct link:
install
  • or console:
sudo apt-get install kdebluetooth

  • Note: you will need to install konqueror and obexftp at least..
    Don't know if any more dependences are necessary because I've KDE installed on my computer.

2007-07-01

NetworkManager in systray

When NetworkManager's icon doesn't appear in systray (a.k.a Notification Area) you can add it yourself.
(I think it works on all desktop environments)
  • Go to:
Applications » Settings » Sessions
  • Click 'add' and type:
Name e.g: 'Networkmanager'
Command put: 'nm-applet –sm-disable &'
  • And now restart X (ctrl+alt+backspace)

2007-06-28

Touchpad - Configure it!

Feisty Fawn lacks the ability to personalize the Synaptics Touchpad. Here are a few tips. These can be also applied to other distros.

Backup xorg.conf
  • First of all, backup your xorg.conf
$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup


Enable/Disable Touchpad
  • Edit you xorg.conf
$ sudo gedit /etc/X11/xorg.conf
  • find «Identifier "Synaptics Touchpad"» and change it to: ("SHMConfig" "true")
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "SHMConfig" "true"
EndSection
  • Disable: (go to terminal and type:)
$ synclient TouchpadOff=1
  • Enable:
$ synclient TouchpadOff=0

Disable Touchpad while typing
It's annoying when a person is typing and touch accidentally in the touchpad. This tip disables the touchpad for 'x' seconds when you press a key. It needs the configuration(xorg.conf) carried through in the previous tip to work.
  • Go to terminal and type: (disables touchpad for 1 second)
$ syndaemon -i 1 -d

visit syndaemon page for more info

Gsynaptics
Gsynaptics allows to configure your Touchpad. It enables/disables touchpad/tapping and configure scroll movements.
(click on screenshot to enlarge)
  • Install:
$ sudo apt-get install gsynaptics
  • Run at terminal:
$ gsynaptics
  • Or go to System » Preferences » Touchpad

Note: for KDE » ksynaptics

Add these tips to startup
If you like some of these tips, and you pretend to use it every time, just add it to start up.
  • Go to System » Preferences » Sessions:
Click New,
Name: 1sec touchpad
Code: syndaemon -i 1 -d

repeat procedure to any desire program..

2007-06-27

Games 4 Linux

Here i will post some cool games for Linux.
Note: this topic will be updated with more games.

  • Pang Zero

Download:
pangzero.deb | official page



i will update this post soon ;)

2007-06-22

Compiz + Beryl = Compiz Fusion (repository)

Note: Fusion is a new project merging Compiz with Beryl.
Screenshot:


(click to enlarge)

To install:

  1. First remove compiz and beryl.
$ sudo apt-get remove beryl*
$ sudo apt-get remove compiz*


  1. Open Terminal and edit sources.list:
$ sudo gedit /etc/apt/sources.list
  1. Add to file:
deb http://download.tuxfamily.org/3v1deb feisty eyecandy
deb-src http://download.tuxfamily.org/3v1deb feisty eyecandy
  1. Save and get back to Terminal and type:
$ wget http://download.tuxfamily.org/3v1deb/DD800CD9.gpg -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get install compiz-#gnome or kde
$ sudo apt-get install compizconfig-settings-manager
$ sudo apt-get install compizconfig-backend*
$ sudo apt-get install compiz-fusion-*
  1. Remove the existing directories
$ rm -fR ~/.beryl*
$ rm -fR ~/.emerald*
$ rm -fR ~/.compiz*
  1. Run Compiz
$ compiz --replace

Post update: 16.00 - 2007Jun25

Add Compiz Fusion to startup:
  1. Go to System » Preferences » Sessions and add:
compiz --replace

Edit: 22.00 - 2007Jun25

2007-06-10

TLS problems

TLS does not seem to work and I have tcl/tk 8.5. How can I fix it ?
  • Open Terminal and type:
$ sudo gedit /usr/lib/tls1.50/pkgIndex.tcl
  • and change the line :
"package ifneeded tls 1.5"
  • to
"package ifneeded tls 1.50"

2007-06-02

A Better Looking Firefox



  • Open the Terminal and type:
$ wget http://users.tkk.fi/~otsaloma/art/firefox-form-widgets.tar.gz

$ tar -xvzf firefox-form-widgets.tar.gz

$ sudo cp /usr/lib/mozilla-firefox/res/forms.css /usr/lib/mozilla-firefox/res/forms.css.bak

$ cat firefox-form-widgets/res/forms-extra.css | sudo tee --append /usr/lib/mozilla-firefox/res/forms.css > /dev/null

$ sudo cp -r firefox-form-widgets/res/form-widgets /usr/lib/mozilla-firefox/res

$ rm -rf firefox-form-widgets
  • Reboot Firefox if open..