anúncios

sábado, 9 de maio de 2015

Atualizando Debian para versão corrente estável

Se você tem o GNU/Linux Debian 6 Squeeze (ainda) ou o Debian 7 Wheezy instalado no seu computador desktop/server/notebook e pensa em fazer upgrade para o Debian 8 Jessie que saiu no dia 25/04/2015, então está no lugar certo.

Nesse post irei explicar como fazer upgrade Debian da versão anterior para versão corrente estável. Até a data deste post, a versão corrente estável do Debian é 8 (Jessie).

Então, vamos nessa ? Segue os passos na ordem.
Alterar o arquivo /etc/apt/sources.list
Basicamente é substituir o codinome squeeze ou wheezy por novo codinome jessie
Como segue:
Abrir o arquivo sources.list com o editor de sua preferência como root.
#vim /etc/apt/sources.list
deb http://ftp.br.debian.org/debian jessie main contrib non-free
deb-src http://ftp.br.debian.org/debian jessie main contrib non-free

deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ jessie-updates main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free


Salva o arquivo, no editor vim é ESC +:x (salva e fecha o arquivo).

Atualizar o repositório: #apt-get update
Instalar os pacotes dpkg, aptitude e apt referente a nova versão.
#apt-get install dpkg aptitude apt
Atualizar os pacotes instalados: #apt-get upgrade
Atualização de fato: #apt-get dist-upgrade

Executando os passos na ordem como descrito acima, não tem erro.
Para conferir a versão atualizada, execute #cat /etc/debian_version, deverá aparecer conforme abaixo.
8.0
Observação: Nota que esse procedimento é possível executar na próxima versão do Debian, bastando apenas alterar o codinome.
Feito!

sábado, 2 de maio de 2015

Instalando Skype no Debian,Ubuntu,Fedora e OpenSuSe

Nesse post, irei mostrar a instalação do Skype nas distribuições Linux Debian, Ubuntu, Fedora e OpenSuSe pelo instalador .deb e .rpm respectivamente. Acesse http://www.skype.com/pt-br/download-skype/skype-for-computer/ , selecione no combobox a distribuição que for instalar, conforme segue abaixo:

  • Debian: skype-debian_4.3.0.37-1_i386.deb
  • Ubuntu 12.04: skype-ubuntu-precise_4.3.0.37-1_i386.deb
  • Fedora: skype-4.3.0.37-fedora.i586.rpm
  • OpenSuSe: skype-4.3.0.37-suse.i586.rpm
Seleciando um dos itens acima irá redirecionar o download solicitando o diretório onde deseja salvar, normalmente é sugerido no diretório /home/seuUsuario/Downloads

Após o download do instalador de um dos itens acima, no Debian e Ubuntu é preciso instalar os pacotes "libqt4-dbus", "libqt4-network", "libqt4-xml", "libqtcore4", "libqtgui4", "libqtwebkit4" que dependem do instalador do Skype, para que não ocorra nenhum erro, nesse caso pode instalar os pacotes utilizando o gerenciador de pacotes APT para Debian/Ubuntu, como segue:

#apt-get install libqt4-dbus libqt4-network libqt4-xml libqtcore4 libqtgui4 libqtwebkit4

Já para o caso no Fedora os pacotes são instalados utilizando o gerenciador de pacotes YUM (exclusivo do Fedora, CentOS, RedHat), como segue:

#yum install libqt4-dbus libqt4-network libqt4-xml libqtcore4 libqtgui4 libqtwebkit4

E no OpenSuSE os pacotes são instalados utilizando o gerenciador de pacotes Zypper (exclusivo do SuSe/OpenSuSE), como segue:

#zypper install libqt4-dbus libqt4-network libqt4-xml libqtcore4 libqtgui4 libqtwebkit4

Após o término da instalação dos pacotes "libqt4-dbus", "libqt4-network", "libqt4-xml", "libqtcore4", "libqtgui4", "libqtwebkit4", poderá executar o instalador do Skype conforme o formato .deb ou .rpm que você fez o download.


Acesse o diretório onde você salvou o instalador do Skype e execute conforme abaixo:

Para Debian e Ubuntu é utilizado o utilitário dpkg para instalar pacotes .deb, como segue: Debian: #dpkg -i skype-debian_4.3.0.37-1_i386.deb
Ubuntu 12.04: #dpkg -i skype-ubuntu-precise_4.3.0.37-1_i386.deb

E para Fedora e OpenSuSe é utilizado o utilitário rpm para instalar pacotes .rpm, como segue:
Fedora: #rpm -i skype-4.3.0.37-fedora.i586.rpm
OpenSuSE: #rpm -i skype-4.3.0.37-suse.i586.rpm
Feito!

Instalando o navegador Chrome no Debian e Ubuntu

Nesse post, irei mostrar a instalação do navegador Google Chrome na distribuição Linux Debian e Ubuntu, pelo instalador .deb. Acesse https://www.google.com.br/chrome/browser/desktop/ , clique no botão "Fazer o download do Google Chrome", selecione a arquitetura do seu processador 32 bits ou 64 bits em para Debian/Ubuntu, em seguida clique no botão "Aceitar e instalar" que irá redirecionar o download do instalador "google-chrome-stable_current_i386.deb" e assim salve em algum diretório do seu sistema, normalmente é no diretório /home/seuUsuario/Downloads.

Após o download do instalador do Google Chrome (.deb), ainda precisará instalar o pacote "libcurl3" que depende do instalador do Chrome. No caso do GNU/Linux Debian e/ou Ubuntu é fácil, utilizando o gerenciador de pacotes APT, como segue abaixo.

#apt-get install libcurl3

Após o término da instalação do pacote "libcurl3", poderá executar o instalador do Google Chrome que irá instalar sem erro.
Acesse até o diretório onde você salvou o instalador e execute o utilitário dpkg que faz instalação de pacotes .deb no Debian e derivados.

#dpkg -i google-chrome-stable_current_i386.deb
Feito!

segunda-feira, 23 de março de 2015

Instalando NVIDIA no Debian

No post http://mundodacomputacaointegral.blogspot.com.br/2012/03/instalando-placa-de-video-nvidia.html foi explicado a instalação do driver da NVIDIA na distribuição Linux Slackware, então ao seguir os mesmos passos que fazia no Slackware que instalava normal, já no Debian não instalava devido conflito com nouveau, tendo que criar um arquivo disable-nouveau.conf e instalar os pacotes headers do Kernel instalado, compilador C, C++ e o module-assistant para efetivar a compilação do módulo necessários e por fim finalizar com a execução do binário do driver da NVIDIA.

Detalhe que no Slackware na instalação FULL já vem instalado o headers do Kernel, compiladores C, C++, make, etc, nesse caso basta fazer o download do binário da NVIDIA desabilitar o X e executar o binário da NVIDIA.

Bom, chega de papo e vamos direto os passos na prática.
Criar um arquivo que pode ser dado qualquer nome, como sugestão disable-nouveau.conf
#vim /etc/modprobe.d/disable-nouveau.conf
backlist nouveau
options nouveau modset=0

Salve o arquivo com ESC + :x
1. #apt-get install linux-headers-`uname -r`
2. #apt-get install gcc g++
3. #apt-get install module-assistant
O item 4 irá instalar automaticamente os pacotes necessários para a compilação do módulo.
4. m-a prepare
Com o driver NVIDIA da versão correspondente de sua placa de vídeo que deve fazer o download no site http://www.nvidia.com o binário .run
5. #init 3
6. Ctrl+Alt+F2
7. Acessar o diretório onde salvou o binário do driver NVIDIA e setar permissão cd Download
#chmod +x NVIDIA-Linux-x86-xx.xx.xx-pkg1.run
8. Executar o binário
#./NVIDIA-Linux-x86-xx.xx.xx-pkg1.run
9. Reboot
#reboot
Feito!

sábado, 21 de março de 2015

Como trocar nome da interface de rede eth1 por eth0 no Linux?

Quando precisamos adicionar uma nova interface de rede, podemos notar que é atribuída eth1 ou ethN [2,...,N], mas não queriamos que alterasse a interface eth0 por eth1.
Motivos:
-Se for um Firewall, normalmente a interface eth0 recebe a conexão da internet e a eth1 é a interface da rede interna.
-Reconfiguração do sistema.
-Ferramentas que utilizam seguir a placa de rede

Como alterar a interface de rede eth1 por eth0 OU eth2 por eth0 ?
No Debian, edite o arquivo /etc/udev/rules.d/70-persistent-net.rules
#vim /etc/udev/rules.d/70-persistent-net.rules

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.

# # You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:1e.0/0000:02:08.0 (e100)
SUBSYSTEM=="net", ACTION=="addi", DRIVERS=="?*", ATTR{address}=="00:0e:a6:46:10:8f", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1904:/sys/devices/pci0000:00/0000:00:1e.0/0000:02:09.0 (sc92031)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:02:2a:e4:2f:96", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:1e.0/0000:02:0a.0 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="e8:de:27:06:a7:a4", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

Observe que nesse arquivo existem 3 interfaces de redes, uma onboard e duas offboard, só alterar a interface ethX pelo índice que deseja, depois reiniciei o serviço de rede e pronto.
#/etc/init.d/networking stop
# /etc/init.d/networking start


No CentOS, o arquivo é o mesmo do Debian, /etc/udev/rules.d/70-persistent-net.rules

#vim /etc/udev/rules.d/70-persistent-net.rules

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:2b:f5:19", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


Basta alterar a interface ethX pelo índice desejado e reiniciar o serviço de rede.
#service network stop
# service network start

Feito!

segunda-feira, 12 de janeiro de 2015

Configurando VPN com OpenVPN no Linux

Para quem precisa configurar um servidor VPN para conectar empresa matriz e filial ou do escritório e casa, então você está no lugar certo, nesse post vou apresentar um breve resumo descrevendo sobre a VPN e o software OpenVPN que será utilizado para fazer a configuração na distribuição Linux CentOS 6.6, porém pode ser válido também para RHEL 6.6.

O OpenVPN é um software livre e open-source para criar redes privadas virtuais do tipo ponto-a-ponto ou server-to-multiclient através de túneis criptografados entre computadores. O OpenVPN é capaz de estabelecer conexões diretas entre computadores mesmo que estes estejam atrás de NAT e Firewall sem necessidade de reconfiguração da sua rede. OpenVPN foi escrito por James Yonan e publicado sob licença GNU General Pulic Licence (GPL). O OpenVPN permite autenticação ponto-a-ponto através de chaves secretas compartilhadas, certificados digitais ou autenticação com usuário e senha. Quando utilizado em modo multiclient-server ele permite que cada cliente utilize a autenticação pública com certificados digitais, fazendo isto através de assinaturas digitais e certificados de autoridade. OpenVPN utiliza extensivamente a criptografia OpenSSL. Usa também os protocolos SSLv3/TLSv1. Esta disponível para Solaris, Linux, OpenBSD, FreeBSD, NetBSD, Mac OS X, e Windows 2000/XP/Vista. OpenVPN contém muitos recursos de controle e segurança. Ele não é um cliente VPN baseado em web, não é compatível com IPsec ou qualquer outro tipo de pacote VPN.


Considerações:
Linux (CentOS) como servidor
Linux (Ubuntu) como cliente
Windows 7 Professional como cliente
Chega de papo, vamos a prática.
Segue os passos:
1)Instalar o repositório EPEL para o CentOS 6.X, conforme sua arquitetura.
#rpm -i http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm 32bits
#rpm -i http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm64bits
2)Instalar o pacote openvpn.
#yum install openvpn
3)Agora vamos verificar o binário que foi instalado o openvpn.
#which openvpn
/usr/sbin/openvpn

4)Criar as chaves de criptografia utilizando os scripts do próprio OpenVPN.
Fazer download dos scripts do OpenVPN direto no diretório /etc/openvpn via wget. #wget https://github.com/OpenVPN/easy-rsa/releases/download/2.2.2/EasyRSA-2.2.2.tgz
5)Extrair o pacote
#tar -xzvf EasyRSA-2.2.2.tgz
6)Criar o diretório keys
#mkdir keys && chmod +x *
7)Acessar o diretório EasyRSA
#cd EasyRSA
8)Executar como segue:
#source vars
# ./clean-all
9)Confirmar 2 arquivos serial e index.txt no diretório keys
ls -la keys
10)Criar autoridade do certificado
# ./build-ca Generating a 2048 bit RSA private key
..................+++
.................+++
writing new private key to 'ca.key'
----- You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:BR
State or Province Name (full name) [CA]:SC
Locality Name (eg, city) [SanFrancisco]:Joinville
Organization Name (eg, company) [Fort-Funston]:SAITAM
Organizational Unit Name (eg, section) [MyOrganizationalUnit]:SAITAM
Common Name (eg, your name or your server's hostname) [Fort-Funston CA]:
Name [EasyRSA]:SAITAM
Email Address [me@myhost.mydomain]:

11)Confirmar a existência dos arquivos gerados no diretório keys
ls -la keys
12)Criar a chave privada e depois as chaves clientes
# ./build-key-server server
Generating a 2048 bit RSA private key
.................................................................+++
..........................................................+++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:BR
State or Province Name (full name) [CA]:SC
Locality Name (eg, city) [SanFrancisco]:Joinville
Organization Name (eg, company) [Fort-Funston]:SAITAM
Organizational Unit Name (eg, section) [MyOrganizationalUnit]:SAITAM
Common Name (eg, your name or your server's hostname) [server]:
Name [EasyRSA]:SAITAM
Email Address [me@myhost.mydomain]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/EasyRSA-2.2.2/openssl-1.0.0.cnf Check that the request matches the signature
Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'BR'
stateOrProvinceName :PRINTABLE:'SC'
localityName :PRINTABLE:'Joinville'
organizationName :PRINTABLE:'SAITAM'
organizationalUnitName:PRINTABLE:'SAITAM'
commonName :PRINTABLE:'server'
name :PRINTABLE:'SAITAM'
emailAddress :IA5STRING:'me@myhost.mydomain'
Certificate is to be certified until Jan 8 17:12:29 2025 GMT (3650 days) Sign the certificate? [y/n]: y
13)Criar a chave do cliente01 # ./build-key cliente01
Generating a 2048 bit RSA private key
.................+++ ..................................................................................................+++
writing new private key to 'cliente01.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [US]:BR
State or Province Name (full name) [CA]:SC
Locality Name (eg, city) [SanFrancisco]:Joinville
Organization Name (eg, company) [Fort-Funston]:SAITAM
Organizational Unit Name (eg, section) [MyOrganizationalUnit]:SAITAM
Common Name (eg, your name or your server's hostname) [cliente01]:
Name [EasyRSA]:SAITAM
Email Address [me@myhost.mydomain]:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
Using configuration from /etc/openvpn/EasyRSA-2.2.2/openssl-1.0.0.cnf
Check that the request matches the signature Signature ok
The Subject's Distinguished Name is as follows
countryName :PRINTABLE:'BR'
stateOrProvinceName :PRINTABLE:'SC'
localityName :PRINTABLE:'Joinville'
organizationName :PRINTABLE:'SAITAM'
organizationalUnitName:PRINTABLE:'SAITAM'
commonName :PRINTABLE:'cliente01'
name :PRINTABLE:'SAITAM'
emailAddress :IA5STRING:'me@myhost.mydomain'
Certificate is to be certified until Jan 8 17:17:09 2025 GMT (3650 days) Sign the certificate? [y/n]: y

14)Criar a chave DH (Diffie-Hellman)
# ./build-dh
Generating DH parameters, 2048 bit long safe prime, generator 2 This is going to take a long time
.................................................................+..........+..............................+.....+............................................................................................................................................+...........................................................................................................+..............+...+.........+................................................................................+........................................................++*++*

15)Criar o diretório keys no /etc/openvpn/keys
#mkdir -p /etc/openvpn/keys
16)Copiar as chaves geradas anteriormente para o diretório criado
#cp -R /etc/openvpn/EasyRSA-2.2.2/keys/* /etc/openvpn/keys/
17)Criar o arquivo de configuração do servidor
#vim server.conf #Porta VPN
port 1194
#Prototolo VPN
proto udp
#Interface VPN
dev tun0
#chaves e certificados
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh2048.pem
#Rede clientes VPN (deve ser diferente da LAN)
server 172.16.10.0 255.255.255.0
#ifconfig-pool-persist ipp.txt
#Rota de acesso a LAN (10.0.0.0/24 para os clientes VPN)
push "route 10.0.0.0 255.255.255.0"
route 172.16.10.0 255.255.255.0 # roteamento do cliente VPN
client-to-client
#Permitir que múltiplos clientes se conectem na mesma chave/certificado #duplicate-on
#Monitoriamento da conexão: primeiro ping, segundo restart da vpn em segundos
keepalive 10 120
#compressão de dados
comp-lzo
user nobody
group nobody
#Mantém a chave carregada quando a VPN é reiniciada
#persist-key
#Mantém a interface tun carregada quando a VPN é reiniciada
#persist-tun
#Informações de status de conexao
status /var/log/openvpn/openvpn-status.log
#Arquivo de log
log /var/log/openvpn/openvpn.log
log-append /var/log/openvpn/openvpn.log
verb 3
18)Criar o diretório de log do openvpn
# mkdir -p /var/log/openvpn

19)Iniciar o servidor do openvpn
#chkconfig openvpn on
## service openvpn start
Iniciando o openvpn: [ OK ]


Se não apresentou nenhum erro ao iniciar o serviço do OpenVPN, execute #ifconfig para verificar a interface tun foi iniciada.
#ifconfig
eth0 Link encap:Ethernet Endereço de HW 08:00:27:2B:F5:19
inet end.: 10.0.0.103 Bcast:255.255.255.255 Masc:255.255.255.0
endereço inet6: fe80::a00:27ff:fe2b:f519/64 Escopo:Link
UP BROADCASTRUNNING MULTICAST MTU:1500 Métrica:1
RX packets:25249 errors:0 dropped:0 overruns:0 frame:0
TX packets:19705 errors:0 dropped:0 overruns:0 carrier:0
colisões:0 txqueuelen:1000
RX bytes:11346462 (10.8 MiB) TX bytes:2651997 (2.5 MiB) IRQ:10 Endereço de E/S:0xd020

lo Link encap:Loopback Local
inet end.: 127.0.0.1 Masc:255.0.0.0
endereço inet6: ::1/128 Escopo:Máquina
UP LOOPBACKRUNNING MTU:65536 Métrica:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
colisões:0 txqueuelen:0
RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)

tun0 Link encap:Não Especificado Endereço de HW 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet end.: 172.16.10.1 P-a-P:172.16.10.2 Masc:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Métrica:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
colisões:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)


É necessário habilitar IP forwarding no arquivo /etc/sysctl.conf e trocar 0 por 1 na linha net.ipv4.ip_forward = 1 .
Efetuar o atualização do arquivo com o comando #sysctl -p. Adicionar no script firewall #!/bin/bash
#Encaminhar os pacotes recebidos da interface local para IP do cliente
iptables -t nat -A POSTROUTING -d 10.0.0.0/24 -s 172.16.10.0/24 -j ACCEPT
#Encaminhar os pacotes do IP cliente para interface local
iptables -t nat -A POSTROUTING -s 172.16.10.0/24 -o eth0 -j MASQUERADE


20)Configurar o cliente VPN no Windows
Premissas:
* Fazer o download do OpenVPN e instalar ( https://openvpn.net/index.php/open-source/downloads.html )
* Copiar as chaves e certificados gerados no servidor para o cliente deixando o arquivo cliente.ovpn e arquivos de chaves e certificados no mesmo diretório, que estão no diretório do servidor /etc/openvpn/keys, devem copiar: ca.crt, cliente01.crt, cliente01.key para C:\Program Files\OpenVPN\config no computador cliente Windows 7.
* Criar um arquivo cliente.ovpn no diretório C:\Program Files\OpenVPN\config junto com as chaves e certificados.
cliente.ovpn
client
tls-client
dev tun
proto udp
remote 10.0.0.103 #IP fixo do servidor VPN
remote-random
resolv-retry infinitive
nobind
persist-key
persist-tun
#SSL
ca ca.crt
cert cliente01.crt
key cliente01.key
comp-lzo
pull
tun-mtu 1500
Executar o Gui VPN como Administrador e conectar na VPN do servidor.
Digite no cmd (prompt) do Windows o comando ipconfig para mostrar o IP do cliente VPN atribuído.

21)Configurar o cliente VPN no Linux (Ubuntu)
No terminal execute:
$sudo apt-get update
$sudo apt-get install openvpn
É necessário fazer o procedimento da geração das chaves e certificados da mesma forma que foi feito para o cliente01 para o cliente02, copiar os arquivos ca.crt, cliente02.crt, cliente02.key do servidor para o /etc/openvpn.
Criar o arquivo cliente02.conf client
tls-client
dev tun
proto udp
remote 10.0.0.103 #IP fixo do servidor VPN
remote-random
resolv-retry infinitive
nobind
persist-key
persist-tun
#SSL
ca /etc/openvpn/ca.crt
cert /etc/openvpn/clinte02.crt
key /etc/openvpn/cliente02.key
comp-lzo


Reiniciar o serviço do OpenVPN.
#/etc/init.d/openvpn restart
Verificar se a interface tun0 foi iniciada com comando #ifconfig

Log do Servidor
root@Saitam# tail -f /var/log/openvpn/openvpn.log
Mon Jan 12 16:01:56 2015 10.0.0.102:55858 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
Mon Jan 12 16:01:56 2015 10.0.0.102:55858 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Mon Jan 12 16:01:56 2015 10.0.0.102:55858 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA
Mon Jan 12 16:01:56 2015 10.0.0.102:55858 [cliente01] Peer Connection Initiated with [AF_INET]10.0.0.102:55858
Mon Jan 12 16:01:56 2015 cliente01/10.0.0.102:55858 MULTI_sva: pool returned IPv4=172.16.10.6, IPv6=(Not enabled)
Mon Jan 12 16:01:56 2015 cliente01/10.0.0.102:55858 MULTI: Learn: 172.16.10.6 -> cliente01/10.0.0.102:55858
Mon Jan 12 16:01:56 2015 cliente01/10.0.0.102:55858 MULTI: primary virtual IP for cliente01/10.0.0.102:55858: 172.16.10.6
Mon Jan 12 16:01:59 2015 cliente01/10.0.0.102:55858 PUSH: Received control message: 'PUSH_REQUEST'
Mon Jan 12 16:01:59 2015 cliente01/10.0.0.102:55858 send_push_reply(): safe_cap=940
Mon Jan 12 16:01:59 2015 cliente01/10.0.0.102:55858 SENT CONTROL [cliente01]: 'PUSH_REPLY,route 10.0.0.0 255.255.255.0,route 172.16.10.0 255.255.255.0,topology net30,ping 10,ping-restart 120,ifconfig 172.16.10.6 172.16.10.5' (status=1)
^C


root@Saitam# tail -f /var/log/openvpn/openvpn-status.log
OpenVPN CLIENT LIST
Updated,Mon Jan 12 16:04:42 2015
Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
cliente01,10.0.0.102:55858,9251,7357,Mon Jan 12 16:01:56 2015
ROUTING TABLE
Virtual Address,Common Name,Real Address,Last Ref
172.16.10.6,cliente01,10.0.0.102:55858,Mon Jan 12 16:03:31 2015
GLOBAL STATS
Max bcast/mcast queue length,0 END


Referências
[1] Documentação OpenVPN. https://openvpn.net/index.php/open-source/documentation/howto.html
Feito!

segunda-feira, 6 de outubro de 2014

Instalando ZSNES no Linux

Acredito que todos já tiveram um Super Nintendo (SNES) né, e pensa em recordar os jogos do SNES no computador com sistema operacional Linux.
Nesse caso é necessário instalar o ZSNES que é um emulador de Super Nintendo, assim pode fazer download das rooms [1] do jogo que tinha nas fitas do Super Nintendo.
Então nesse post, compartilho os procedimentos que realizei para instalar o ZSNES na distribuição Linux Debian.

No Slackware FULL, simplesmente executei $./configure && make; #make install e fez a instalação do ZSNES normalmente.
No Debian precisou fazer algumas configurações adicionais.
Download do ZSNES no site http://www.zsnes.com no link Linux, Download ZSNES Linux, será redirecionado o download do arquivo zsnes151src.tar.bz2.

Nota que optei por salvar o arquivo zsnes151src.tar.bz2 no diretório Downloads do meu /home, no seu caso escolha salvar onde achar melhor.
Antes de iniciar, é necessário instalar o compilador C e C++, se caso não tiver instalado no Debian.
#apt-get install gcc g++
Extrair o arquivo zsnes151src.tar.bz2 do download
reginaldo@Saitam:~/Downloads/$ tar -jxvf zsnes151src.tar.bz2
Acessar o diretório correspondente da extração
reginaldo@Saitam:~/Downloads$ cd zsnes_1_51/src
Executar o arquivo configure
reginaldo@Saitam:~/Downloads/zsnes_1_51/src$ ./configure
loading cache ./config.cache
checking for gcc... gcc
checking whether the C compiler (gcc -pipe -I. -Wall ) works... yes
checking whether the C compiler (gcc -pipe -I. -Wall ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking for nasm... error:: command not found
checking for a BSD compatible install... /usr/bin/install -c
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking build system type... i686-pc-linux-gnu
checking how to run the C preprocessor... gcc -E
checking for X... libraries , headers
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.0... no
*** Could not run SDL test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means SDL was incorrectly installed
*** or that you have moved SDL since it was installed. In the latter case, you
*** may want to edit the sdl-config script: /usr/bin/sdl-config
configure: error: SDL >= 1.2.0 is required


Solução: Instalar os pacotes Nasm e SDL correspondente.
root@Saitam:~/Downloads/zsnes_1_51/src# apt-get install nasm libsdl1.2-dev
Execute novamente o arquivo configure.
reginaldo@Saitam:~/Downloads/zsnes_1_51/src$ ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for nasm... nasm
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.0... yes
checking for zlib - version >= 1.2.3... yes
checking for libpng - version >= 1.2.0... yes
checking if you want the zsnes debugger... yes
checking for initscr in -lcurses... no
checking for initscr in -lncurses... no
checking for initscr in -lpdcurses... no
configure: error: A curses library is required to use the debugger


Solução: Instalar os pacotes ncurses e libncurses5-dev como segue:
root@Saitam:~/Downloads/zsnes_1_51/src# apt-get install ncurses libncurses5-dev Execute novamente o arquivo configure. reginaldo@Saitam:~/Downloads/zsnes_1_51/src$ ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for nasm... nasm
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.0... yes
checking for zlib - version >= 1.2.3... yes
checking for libpng - version >= 1.2.0... yes
checking if you want the zsnes debugger... yes
checking for initscr in -lcurses... yes
checking for initscr in -lncurses... yes
checking for initscr in -lpdcurses... no
checking if you want libao support... no
checking how to run the C preprocessor... gcc -E
checking for X... libraries , headers
checking for glGetError in -lGL... yes
checking for OpenGL... yes
checking for JMA support... yes
checking for cpu info... found
checking if you want gdb friendly executable... no
checking which cpu architecture to optimize for... native
checking if you want crazy optimizations... no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether sys/types.h defines makedev... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
ZSNES v1.51
SDL support Version 1.2.15
NASM support NASM version 2.10.01 compiled on Jun 14 2012
zlib support Version 1.2.7
PNG support Yes, version 1.2.49
OpenGL support Yes
JMA support Yes
ZSNES debugger Enabled
The binary will be installed in /usr/local/bin
Configure complete, now type 'make' and pray.
Nota que agora a execução do configure está OK, execute o make.
reginaldo@Saitam:~/Downloads/zsnes_1_51/src$ make
g++ -pipe -I. -I/usr/local/include -I/usr/include -D__UNIXSDL__ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -
D__OPENGL__ -march=native -O3 -fomit-frame-pointer -s -fno-rtti -o tools/strutil.o -c tools/strutil.cpp
In file included from tools/strutil.cpp:22:0:
tools/strutil.h: In static member function ‘static int ci_char_traits::compare(const char*, const char*, size_t)’:
tools/strutil.h:34:96: error: ‘strncasecmp’ was not declared in this scope
make: ** [tools/strutil.o] Erro 1


reginaldo@Saitam:~/Downloads/zsnes_1_51/src$ make
g++ -pipe -I. -I/usr/local/include -I/usr/include -D__UNIXSDL__ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -
D__OPENGL__ -march=native -O3 -fomit-frame-pointer -s -fno-rtti -o tools/depbuild tools/depbuild.cpp tools/fileutil.o tools/strutil.o
tools/depbuild.cpp: In function ‘void dependency_calculate(const char*, stat&)’:
tools/depbuild.cpp:167:37: error: ‘F_OK’ was not declared in this scope
tools/depbuild.cpp:167:41: error: ‘access’ was not declared in this scope
tools/depbuild.cpp: At global scope:
tools/depbuild.cpp:186:5: warning: first argument of ‘int main(size_t, const char* const*)’ should be ‘int’ [-Wmain]
make: ** [tools/depbuild] Erro 1


Opa, erro de compilação, aqui nesse ponto, deve incluir diretamente no código fonte do ZSNES.
No fonte /src/tools/strutil.h incluir a biblioteca como segue.
#include < string.h >
No mesmo diretório acima, no fonte depbuild.cpp incluir a biblioteca e o argumento da função main, como segue. #include < cstdlib >
int main (int argc, const char *const *const argv)
No fonte /src/parsegen.cpp incluir as bibliotecas , e mesma modificação feita no passo anterior da função main, como segue.
#include < cstdlib >
#include < cstring >
...
int main (int argc, const char *const *const argv)

Com as alterações necessárias realizadas corretamente como descritas aqui, pode executar o ./configure, make e make install como segue.

Execute novamente o arquivo configure.
reginaldo@Saitam:~/Downloads/zsnes_1_51/src$ ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for nasm... nasm
checking for sdl-config... /usr/bin/sdl-config
checking for SDL - version >= 1.2.0... yes
checking for zlib - version >= 1.2.3... yes
checking for libpng - version >= 1.2.0... yes
checking if you want the zsnes debugger... yes
checking for initscr in -lcurses... yes
checking for initscr in -lncurses... yes
checking for initscr in -lpdcurses... no
checking if you want libao support... no
checking how to run the C preprocessor... gcc -E
checking for X... libraries , headers
checking for glGetError in -lGL... yes
checking for OpenGL... yes
checking for JMA support... yes
checking for cpu info... found checking if you want gdb friendly executable... no
checking which cpu architecture to optimize for... native
checking if you want crazy optimizations... no
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether sys/types.h defines makedev... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h

ZSNES v1.51

SDL support Version 1.2.15
NASM support NASM version 2.10.01 compiled on Jun 14 2012
zlib support Version 1.2.7
PNG support Yes, version 1.2.49
OpenGL support Yes
JMA support Yes
ZSNES debugger Enabled
The binary will be installed in /usr/local/bin
Configure complete, now type 'make' and pray.


Execute make para compilar.
reginaldo@Saitam:~/Downloads/zsnes_1_51/src$ make
Aguarde terminar compilação.

Execute make install como root para instalar
root@Saitam:~/Downloads/zsnes_1_51/src# make install

Procederá instalação, o binário do zsnes ficará em /usr/local/bin, utilize esse caminho para criar um atalho no menu.
Veja o resultado do room Top Gear clássico!


[1] Rooms SNES. http://www.roxdownload.net/roms/snes
Feito!