This blog is about: Open Source, Operating Systems (mainly linux), Networking and Electronics The information here is presented in the form of howtos. Sometimes the information migth be in portuguese! As vezes a informação pode estar em portugues!
Thursday, May 31, 2007
Pic Programmer With Only Resistors, Capacitor and Diodes - RCD
http://feng3.cool.ne.jp/en/rcd.html
Wednesday, May 30, 2007
Instaling Java in Mozilla Firefox on Linux
The JRE is what you need to run java programs on your computer, but it doesn't allow you to develop in java, This is probably the more suited solution for you if you are not a developer, because is smaller the de JDK.
If you are a developer download the JDK (if you already don't have it already) which includes the JRE and adds the tools for developing.
To download you can go to:
http://java.sun.com/javase/downloads/index.jsp
Basically what we need to do is put a symbolic link for the plugin in the jre of either the JDK or the JRE, in Mozilla Firefox
-----------------------------------------------------------------------------------------------------
For JDK you must execute in the shell something like this:
# ln -s /path_to_jdk/jdkx.x.x_xx/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so
where you should replace "path_to_jdk" with the path to you JDK and replace "jdkx.x.x_xx" with the version of your JDK
----------------------------------------------------------------------------------------------------
For JRE you must execute in the shell something like this:
# ln -s /path_to_jre/jrex.x.x_xx/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so
where you should replace "path_to_jdk" with the path to you JDK and replace "jrex.x.x_xx" with the version of your JDK
And that's it, you can now see pages that use java components.
Thursday, May 24, 2007
Linux (Ubuntu) Network Install
Introduction
Some days ago I had to install Ubuntu Breezy – a GNU/Linux flavour based on Debian and powered by apt-get – on four machines and I had only one CD-Rom available. And doing some fast calculations you can find out that it’s faster to install through a 100Mbps LAN (~12.5 Mb/s highest peek) than using a normal 52x CD-Rom.
Initially, the idea was to load the boot sector directly from the onboard network card. Unfortunately, I wasn’t able to do so (it skipped network boot as if it didn’t detect anything) and I decided to stick with that sometimes useful floppy disk and include a small boot sector that had the drivers included.
Ready to start?
Setting up the server
First off, you'll need a server where your clients will be connecting. That server must have a small FTP, HTTP and DHCP server and, obviously, an Ubuntu installation CD available. The DHCP allows your clients to connect to your network and the HTTP/FTP server will deliver installation files and package repositories.
Our FTP server will be tftpd-hpa
. On Ubuntu/Debian this is a matter of
- root@server$ apt-get install package-name
and that’s it, everything gets installed and set up. Let’s install everything at once:
- root@server$ apt-get install tftpd-hpa apache2 dhcp3-server
Now it’s time to copy the content of the Ubuntu cd. Just do
- root@server:/var/lib/tftpboot$ mkdir ubuntu
- root@server:/var/lib/tftpboot$ mount -o loop /var/lib/tftpboot/ubuntu-5.10-install-i386.iso /var/lib/tftpboot/ubuntu
In order to get an ISO of your installation CD, you can do (astonish yourself)
- root@server$ cat /dev/hdb > ubuntu-5.10-install-i386.iso
where hdb is your CD-Rom device. It can be anything else other than hdb so you’d better figure out with dmesg (root@server # dmesg
) or doing whatever suits you.
Make a symlink from apache's root to the mounted ISO
- root@server:/var/www # ln -s /var/lib/tftpboot/ubuntu/
configure the DHCP server according to your network:
- root@server:~ # cat /etc/dhcp3/dhcpd.conf
- ping-check = 1;
- filename = "ubuntu/install/netboot/pxelinux.0";
- subnet 192.168.1.0
- netmask 255.255.255.0 {
- range 192.168.1.10 192.168.1.254;
- }
- root@server:~ # /etc/init.d/dhcp3-server restart
- Stopping DHCP server: dhcpd3.
- Starting DHCP server: dhcpd3.
And now run the clients. If you were able to see the Ubuntu boot prompt, that’s it. Now you just have to carry on with the installation. Otherwise, if you didn’t see anything and the boot continued as usual – just like happened to me – then keep reading this tutorial.The alternative is, like I said before, using a boot disk with the drivers. Etherboot has what we’re looking for. Download the latest version and read the README file. Then you just have to find out which network card you have and follow the very quick instructions.
taken from: http://mywheel.net/blog/index.php/ubuntu-network-install/
For other distros it's probably the same except for the packages download, here we used apt-get for downloading the needed packages, in other distros you may have some other way of downloading the packages like yum or you can always can go the internet and search for it.
Friday, May 18, 2007
Save a partition directly to a compressed file
To save the partition and later restore it, we are going to use three programs the first is 'dd' the which is used to make exact copies of partitions and restore them and the others are 'bzip2' which is used to compress and 'bunzip' to uncompress.
In order to save a partition to a compress a partition to a compress file, just do:
# dd if=/dev/hda2 bs=10M | bzip2 > /.../hda2_save.bz2
Where '/.../' must be replaced with the path to the dir where you want your partition compress save to be.
Has you can see above 'dd' has no 'of' (output file) so it's output will be the standart output (the shell), wich we redirect with '|' (pipe) to 'bzip2' standart input (which if not redirected is the keyboard), buzip2 will continuously compress the stream of data coming from 'dd', and that's it.
In order to save a partition to a compress a partition to a compress file, just do
# bunzip2 /.../hda2_save.bz2 --stdout | dd of=/dev/hda2
Where '/.../' must be replaced with the path to the dir where you want your partition compress save is.
Has you can see above 'bunzip2' has the option '--stdout' wich means that it will uncompress the file to the standart output (the shell) wich we redirect with '|' (pipe) to 'dd' standart input (which if not redirected is the keyboard).
Thursday, May 10, 2007
Instalar drivers da Nvidia em Ubuntu Feisty
A instalação foi realizada no meu notebook. A placa de vídeo aqui é uma NVIDIA GeForce 6150 256MB
Faça uma cópia de segurança do aquivo xorg.conf antes de iniciar a instalação.
$ sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_bkp
1- Removendo pacotes antigos
$ sudo apt-get --purge remove nvidia-glx nvidia-settings nvidia-kernel-common
2- Instalando pacotes necessários
Certifique-se de ter habilitado os repositórios universe e multiverse
$ sudo apt-get install linux-restricted-modules-$(uname -r) build-essential xserver-xorg-dev
3- Baixe o driver aqui!
Esse é o ultimo release do driver
Mais informações sobre o driver aqui!
4- Edite o arquivo linux-restricted-modules-common
$ sudo gedit /etc/default/linux-restricted-modules-common
Altere a linha DISABLED_MODULES=”"
Para DISABLED_MODULES=”nv”
5- Entrando em modo texto
Precione as teclas Ctrl + Alt + F1 e efetue o login. Não se assuste esse é o lado negro da força.
Após logado no modo texto vamos parar o gdm.
6 - Parando o gdm
$ sudo /etc/init.d/gdm stop
7- Executando o driver
Entre no diretório em que o foi salvo o aquivo .run
Transforme o aquivo em executável e em seguida execute o aquivo .run
$ sudo chmod +x NVIDIA-Linux-x86-1.0-9755-pkg1.run
A instalação e bem tranquila e só responder Ok em quase todas as perguntas. Só responda não na pergunta em que ele diz não ter um kernel compilado no sistema, se você aceitaria fazer o download desse kernel no site da nvidia.
$ sudo sh ./NVIDIA-Linux-x86-1.0-9755-pkg1.run
8 - Reinicie o sitema
$ sudo shutdown -r now
Pronto driver instalado!
9- Verificando a instalação
O primeiro sintoma que ocorreu no pc após a instalação do driver foi uma tela preta com o logo da nvidia antes de iniciar o gdm.
No menu Aplicações->Ferramentas do Sistema aparecerá a opção NVIDIA X Server Settings.
No terminal digite:
$ glxinfo | grep direct
Deve retornar
$ direct rendering: yes
Monday, May 7, 2007
Seeing and changing your DNS servers
cat /etc/resolv.conf
To alter (and also see) your dns servers you can always edit /etc/resolv.conf using a text editor like vi or gedit or any other for vi do the following:
# vi /etc/resolv.conf
for gedit the following:
# gedit /etc/resolv.conf
Starting, Stoping and Restarting Services in Linux
For example if you want to stop the dhcp service you just need to do :
# sudo /etc/init.d/dhcp stop
to start it again do:
# sudo /etc/init.d/dhcp start
to restart it do:
# sudo /etc/init.d/dhcp restart
For the other services you just change "dhcp" to the name service script in /etc/init.d.
As you migth already noticed, you can see which services you have by seeing which scripts exist in /etc/init.d.
Friday, May 4, 2007
Basic Use of NetCat (Windows e Linux)
TCP
---------------------------------------
With the comand below you can start a netcat server in any TCP port (here we use 53), in you local machine, and lets assume your local machine has the following IP 192.136.49.47.
# sudo nc -l -p 53
Now in another machine you can connect to the server at 192.136.49.47:53, with netcat as a client.
# sudo nc 192.136.49.47 53
To see if it's working you can type text in the bash (comand line) of the server or client and press enter and see if the text you inputed reaches the other machine, this is a simple and very reliable way to test connections between machines, and also firewalls
Bellow we have the same but for the UDP protocol.
UDP
------------------------------------
# sudo nc -l -p 53 -u
# sudo nc -u 192.136.49.47 53
Thursday, May 3, 2007
How to wire Ethernet and Console Cable (Cisco - Roll Over)
Cabling basics for network admins
- Your cable works at layer 1 — Physical of the OSI Model. Also at that layer are the 1’s and 0’s that traverse the cable as an electrical or light signal (depending on what type of cabling you are using).
- Unshielded twisted pair (UTP) copper cable is used for many functions in network cabling: Ethernet, Serial, ISDN, Console, and more.
- While you could put different ends on a UTP cable, typically it will have a RJ45 end with 8 pins.
- With a normal Ethernet cable, the wires run straight through, from one end to the other. Straight-through cables are used to connect a PC to a switch, as in Figure A-1 and Figure A-2. Where each one uses one off the cabling standards, the T568B and T568B
Figure A-1 - Straight-Through Cable
Graphic Courtesy of Cisco Systems
- With a crossover cable (Figure B), the source and destination of the UTP wires are crossed. This allows you to use it to connect a PC to PC, switch to switch, or router to router.
- In a crossover cable we use both off the cabling standads, T568A and T568B, one in each end, if one end uses T568B the other uses T568A, and vice-versa.
Graphic Courtesy of Cisco Systems
Now, how is cabling for Cisco routers and switches different?Cisco console and AUX port cabling
There are a few differences between Cisco cabling and other network device cabling. Two things immediately come to mind:
- Cisco routers, switches, and firewalls use a special “rolled” cable for console and auxiliary port access.
- Cisco offers intelligent serial cabling.
The Cisco console cable is a special cable. It isn’t wired like an Ethernet cable. However, if you didn’t have a console cable, you could cut off the end of a straight-through Ethernet cable, change the pin out, and recrimp it to make it a console cable.
Below, you can see the pin out of a console cable. The console cable is a “rolled” cable, because if you look at the pins from one end to the other, it is as if the end was rolled over (the order is flipped), as in Figure C.
Figure C - Console Cable (Rolled Cable)
Graphic Courtesy of Cisco Systems
Traditionally Cisco console cables were RJ45-RJ45 and then you would use a RJ45-DB9 adaptor to connect it to your PC’s serial port (COM port). Today, new Cisco devices come with console cables that have a DB9 adaptor integrated/molded to the cable on one end (Figure D). Keep in mind that the data moving across the console cable is serial data (not Ethernet).Figure D - RJ45-DB9 adaptor
Graphic Courtesy of Cisco Systems
For those equipements tha don't have an integrated DB9 ports, here how you can make your own DB9 adapter:Taken From: http://blogs.techrepublic.com.com/networking/?p=649
and added some stuff about the cabling standards (like here)
Another good reference for building ethernet cables is:
http://www.ertyu.org/steven_nikkel/ethernetcables.html