BEM VINDO AO BLOG DO MARCOS CARRARO CRIADOR DO "CARRARO DASHBOARD". MUITO MAIS QUE UM SIMPLES BLOG.
Mostrando postagens com marcador image. Mostrar todas as postagens
Mostrando postagens com marcador image. Mostrar todas as postagens

segunda-feira, 10 de julho de 2017

Criando um Servidor PXE para Iniciar arquivos ISO para AcronisTrueImage recover/backup

Bom Dia,

Documentando processo para servidor de PXE com boot de arquivos em .ISO de sistemas operacionais na rede, ideal para equipamentos que não disponham de leitores e ou seja preciso disponibilizar um boot por ISO para o suporte.

1 - Habilitar login do root por ssh
Comente a seguinte linha no arquivo /etc/ssh/sshd_config

# PermitRootLogin without-password


2 - Definir um IP para a interface ligada aos computadores da rede
# vim /etc/network/interfaces

auto eth1
iface eth1 inet static
address  10.255.255.1
netmask 255.255.255.0



3 - Instalar o DHCP necessário para distribuir os IPs para as máquinas com os parâmetros para boot.

# apt-get install isc-dhcp-server

Após instalar o DHCP, vamos fazer uma cópia de segurança do arquivo de configuração
# cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.bkp

Feito este backup, vamos alterar o dhcpd.conf para habilitar o boot pela rede.
# vim /etc/dhcp/dhcpd.conf

default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;

subnet 10.255.255.0 netmask 255.255.255.0 {
  range 10.255.255.100 10.255.255.200;
  option broadcast-address 10.255.255.255;
  filename "pxelinux.0";
  allow booting;
  allow bootp;
}

4.0 - Ajustar diretórios
O diretório deve ficar conforme estrutura abaixo.

# mkdir -p /repositorio_imagens/boot/
# mkdir -p /repositorio_imagens/boot/pxelinux.cfg/
# mkdir -p /repositorio_imagens/boot/isos
# ln -s /repositorio_imagens/boot/isos/ /repositorio_imagens/isos
# touch /repositorio_imagens/boot/pxelinux.cfg/default

4.1 - Vamos instalar o TFTPD, que é o protocolo responsável por transferir os arquivos pelo PXE.
# apt-get install tftpd-hpa

Substitua o conteúdo do arquivo "tftpd-hpa" pelo seguinte arquivo

# vim /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -s /repositorio_imagens/boot/"

Onde "repositorio_imagens/boot" é um ponto de montagem de um disco de alguns terabytes que estarão armazenados todas minhas ISOS e imagens necessárias

5 - Vamos instalar o pxelinux que irá disponibilizar os arquivos necessários para montar a tela de boot

# apt-get install pxelinux syslinux

Vamos copiar os arquivos necessários para iniciar o menu do boot

# cp -vax /usr/lib/PXELINUX/pxelinux.0 /repositorio_imagens/boot/
# cp -vax /usr/lib/syslinux/modules/bios/ldlinux.c32 /repositorio_imagens/boot/
# cp -vax /usr/lib/syslinux/modules/bios/menu.c32 /repositorio_imagens/boot/
# cp -vax /usr/lib/syslinux/modules/bios/vesamenu.c32 /repositorio_imagens/boot/
# cp -vax /usr/lib/syslinux/modules/bios/libcom32.c32 /repositorio_imagens/boot/
# cp -vax /usr/lib/syslinux/modules/bios/libutil.c32 /repositorio_imagens/boot/
# cp -vax /usr/lib/syslinux/modules/bios/reboot.c32 /repositorio_imagens/boot/
# cp -vax /usr/lib/syslinux/modules/bios/poweroff.c32 /repositorio_imagens/boot/
# cp -vax /usr/lib/syslinux/memdisk /repositorio_imagens/boot/

6 - Agora vamos criar o arquivo responsável pelo menu e suas entradas para boot

# vim /repositorio_imagens/boot/pxelinux.cfg/default

UI vesamenu.c32
TIMEOUT 3600
PROMPT 0
MENU RESOLUTION 1024 768
MENU TITLE    PXE BOOT MENU
# Format is: MENU COLOR <Item> <ANSI Seq.> <foreground> <background> <shadow type>
MENU COLOR screen      0  #80ffffff #00000000 std      # background colour not covered by the splash image
MENU COLOR border      0  #ffffffff #ee000000 std      # The wire-frame border
MENU COLOR title       0  #ffff3f7f #ee000000 std      # Menu title text
MENU COLOR sel         0  #ff00dfdf #ee000000 std      # Selected menu option
MENU COLOR hotsel      0  #ff7f7fff #ee000000 std      # The selected hotkey (set with ^ in MENU LABEL)
MENU COLOR unsel       0  #ffffffff #ee000000 std      # Unselected menu options
MENU COLOR hotkey      0  #ff7f7fff #ee000000 std      # Unselected hotkeys (set with ^ in MENU LABEL)
MENU COLOR tabmsg      0  #c07f7fff #00000000 std      # Tab text
MENU COLOR timeout_msg 0  #8000dfdf #00000000 std      # Timout text
MENU COLOR timeout     0  #c0ff3f7f #00000000 std      # Timout counter
MENU COLOR disabled    0  #807f7f7f #ee000000 std      # Disabled menu options, including SEPARATORs
MENU COLOR cmdmark     0  #c000ffff #ee000000 std      # Command line marker - The '> ' on the left when editing an option
MENU COLOR cmdline     0  #c0ffffff #ee000000 std      # Command line - The text being edited
# Options below haven't been tested, descriptions may be lacking.
MENU COLOR scrollbar   0  #40000000 #00000000 std      # Scroll bar
MENU COLOR pwdborder   0  #80ffffff #20ffffff std      # Password box wire-frame border
MENU COLOR pwdheader   0  #80ff8080 #20ffffff std      # Password box header
MENU COLOR pwdentry    0  #80ffffff #20ffffff std      # Password entry field
MENU COLOR help        0  #c0ffffff #00000000 std      # Help text, if set via 'TEXT HELP ... ENDTEXT'

# OPCOES DE ESCOLHA MENU

LABEL GParted
MENU LABEL GParted
LINUX ../memdisk
INITRD ../isos/gparted-live-0.28.1-1-i686.iso
APPEND iso raw

LABEL memtest
MENU LABEL memtest86
LINUX ../memdisk
INITRD ../isos/memtest86+-5.01.iso
APPEND iso raw

LABEL discoLocal
MENU LABEL Disco Local
MENU DEFAULT
localboot

LABEL reiniciar
MENU LABEL Reiniciar
COM32 ../reboot.c32

LABEL desligar
MENU LABEL Desligar
COM32 ../poweroff.c32



7 - Baixar a ISO do memtest86
# cd /repositorio_imagens/isos
#  wget http://www.memtest.org/download/5.01/memtest86+-5.01.iso.zip
# apt-get instal unzip
# unzip memtest86+-5.01.iso.zip
# rm -rf memtest86+-5.01.iso.zip


8 - Baixar a ISO do GParted
# cd /repositorio_imagens/isos
# wget http://downloads.sourceforge.net/gparted/gparted-live-0.28.1-1-i686.iso

9 - Transfira a ISO do Acronis TrueImage para o diretório /repositorio_imagens/isos e criei a entrada no arquivo /repositorio_imagens/boot/pxelinux.cfg/default

LABEL acronisTrueImage
MENU LABEL AcronisTrue Image 
LINUX ../memdisk
INITRD ../isos/acronisTrueImage.iso
APPEND iso raw

9 - Preparação para fazer os backups e restores das imagens dos sistemas operacionais usando o AcronisTrueImage

Vamos utilizar o samba para fazer o leitura e transferência de arquivos para o servidor, poderíamos utilizar o NFS, porém a performance do mesmo fica minima coisa melhor que samba, então decidimos utilizar o samba.

# apt-get install samba

# mkdir -p /repositorio_imagens/imagens
# chmod 777 -R /repositorio_imagens/imagens

Altera o arquivo "/etc/samba/smb.conf" para o seguinte conteúdo

[global]
   workgroup = SUPORTE
   server string = Servidor de Backup e Restore
   netbios name = repositorio
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   server role = standalone server
   map to guest = bad user
   usershare allow guests = yes
   security = user
   guest account = nobody
   oplocks = false
   level2 oplocks = false
   fake oplocks = no
   locking = no
   posix locking = false
   strict locking = false
   kernel oplocks = no
   socket options = IPTOS_LOWDELAY TCP_NODELAY SO_SNDBUF=20480 SO_RCVBUF=20480
   os level = 2
   domain logons = no
   preferred master = no
   domain master = no
   veto files = /autorun.inf/*.pif/*.com/*.mp3/*.wav/*.pif/*.mpg/*.mpeg

[REPOSITORIO]
   path = /repositorio_imagens/imagens
   browseable = yes
   public = yes
   read only = no
   writable= yes
   create mask = 0777
   directory mask = 0777
   csc policy = disable




Read More

Posts que a turma mais esta lendo...

Posts que a turma mais esta lendo...

Marcos Carraro