How to Setup PXE Server FINAL.Txt.Rtf
Total Page:16
File Type:pdf, Size:1020Kb
Howto setup PXE server This is HOWTO for installing PXE (Preboot eXecution Environment) server on Centos 6.2 server. This HOWTO is writen by: Daniel Milas ([email protected]) and it is free to: use, share, modify, burn and every thing you can imagine. :-) Please don't send me e-mail's because i'm linux begginer. Internet reasoures that helped me are: http://www.smtps.net/pxe-kickstart.html http://www.server-world.info/en/note?os=CentOS_6&p=pxe&f=3 http://www.server-world.info/en/note?os=CentOS_6&p=pxe&f=2 http://secnut.blogspot.com/2010/04/pxe-kickstart-automating-centosredhat.html http://secnut.blogspot.com/2010/04/pxe-kickstart-automating-centosredhat.html http://secnut.blogspot.com/2010/04/building-kickstart-install-server.html http://wiki.centos.org/HowTos/PXE/Rescue_PXE http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-netboot-pxe-config.html http://ckozler.net/?p=292 BIG THANKS TO ALL!!! You can find Centos 6.2 install (ISO) files on: http://www.centos.org/ This PXE server is used to install this operating system on PXE clients: - Centos 6.2 Desktop This PXE server is also used to run Clonezilla Live on PXE clients: - Clonezilla Live You can find Clonezilla Live on: http://clonezilla.org/ If you need more than this two operating system to be installed, you can do it also, just follow procedure and change names, add things and so. This procedure is written by absolute LINUX begginer. !!!! There is no WARNITY what so ever !!!! !!!! You using this on your own risk !!!! Just to remind YOU that this procedure when selected Centos 6.2 installation !!!!!ERASE ALL DATA ON CLINET!!!!! If You need tho change this, look at ks.cfg (kickstart config) file and change this option. For security reasons DO NOT put this system in production environment. Security aspect of this system is not taken (YUST MAKE PXE TO WORK). So let's begin! Part: 1 Install Centos 6.2 on one PC with 1Gb RAM and 80Gb HDD. PC need LAN card. Some starting points are: PXE server operation system: Centos 6.2 (desktop install) IP Address: 192.168.1.15/24; Gateway: 192.168.1.1 (ADSL Router) DNS Server: 192.168.1.15 (ADSL Router) NO OTHER DHCP on network; Network install for Centos 6.2 distro Network install for Clonezilla Live distro Part: 2 I USE gedit COMMAND TO EDIT FILES (not using vi editor because don't know how to use it) First setup Centos 6.2 on one machine with at least 1Gb of RAM and 80Gb HDD, and disable firewall, log in as root. ---------------------------------------------------------------------------------- ### Install THIS Services first they are needed for this to work ### sudo yum install update sudo yum install httpd sudo yum install samba sudo yum install dhcp sudo yum install xinetd sudo yum install syslinux sudo yum install tftp-server sudo yum install tftp sudo yum install vsftpd sudo yum install system-config-kickstart ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### Set services allways ON, so when PXE Server is restarted it is ON ### ### DHCP chkconfig dhcpd on ### FTP chkconfig vsftpd on ### HTTPD chkconfig httpd on ### TFTP chkconfig xinetd on ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### BEFORE MAKE ANY CHANGES TO CONFIG FILES - !!! MAKE BACKUP !!! ### ### This commands are used to make copy of config files ### ### dhcpd.conf - DHCPD - DHCP Server config file ### cp /etc/dhcp/dhcpd.conf /home/dhcpd.conf.bak ### httpd.conf - HTTPD - HTTP Server config file ### cp /etc/httpd/conf/httpd.conf /home/httpd.conf.bak ### tftp - TFTP -TFTP server config file ### cp /etc/xinetd.d/tftp /home/tftp.bak ### vsftpd.conf - VSFTPD - FTP server config file ### cp /etc/vsftpd/vsftpd.conf /home/vsftpd.conf.bak ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### This commands are for starting selected services ### ### Please see note for some of services, because ### they need to be configured before starting. ### Start DHCP service !!!! BEFORE STARTING SERVICE MAKE CONFIGURATION !!!! ### Start DHCP service SEE ### DHCPD CONFIG LINE ### /etc/rc.d/init.d/dhcpd start ### Start FTP service !!!! BEFORE STARING SERVICE MAKE CONFIGURATION !!!! ### Start FTP service SEE ### VSFTPD CONFIG LINE ### /etc/rc.d/init.d/vsftpd start ### Start HTTPD service !!!! BEFORE STARTING SERVICE MAKE CONFIGURATION !!!! ### Start HTTPD service SEE ### HTTPD CONFIG LINE ### /etc/rc.d/init.d/httpd start ### Before start TFTP service !!!! YOU NEED TO EDIT CONFIG FILE FIRST !!!! gedit /etc/xinetd.d/tftp #line 14: change FROM yes > no disable = no ### Start TFTP Service !!! WHEN FINISHED EDITING CONFIG FILE START SERVICE !!!! /etc/rc.d/init.d/xinetd start ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### When finished with configuration restart all needed services ### ### Restart DHCP Service /etc/rc.d/init.d/dhcpd restart ### Restart FTP Service /etc/rc.d/init.d/vsftpd restart ### Restart HTTP service /etc/rc.d/init.d/httpd restart ### Restart TFTP Service /etc/rc.d/init.d/xinetd restart ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### DHCPD CONFIG FILE EDIT COMMAND ### gedit /etc/dhcp/dhcpd.conf #### DHCPD CONFIG LINE - BEGIN #### # Defaul file location # /etc/dhcp/dhcpd.conf # DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.sample # see 'man 5 dhcpd.conf' # ddns-update-style interim; ignore client-updates; authoritative; allow booting; allow bootp; allow unknown-clients; subnet 192.168.1.0 netmask 255.255.255.0 { # default gateway option routers 192.168.1.1; option subnet-mask 255.255.255.0; option domain-name "mynetwork.local"; option domain-name-servers 192.168.1.1; option broadcast-address 192.168.1.255; # EST Time Zone option time-offset -18000; # Client IP range range dynamic-bootp 192.168.1.100 192.168.1.199; default-lease-time 21600; max-lease-time 43200; # PXE Server IP next-server 192.168.1.15; filename "pxelinux.0"; } #### DHCPD CONFIG LINE - END #### ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### VSFTPD CONFIG FILE EDIT COMMAND ### gedit /etc/vsftpd/vsftpd.conf #### VSFTPD CONFIG LINE - BEGIN #### listen=YES anonymous_enable=NO local_enable=YES userlist_deny=NO userlist_enable=YES write_enable=YES connect_from_port_20=NO #port_enable=YES local_root=/var/ftp pam_service_name=vsftpd tcp_wrappers=YES #### VSFTPD CONFIG LINE - END #### ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### Before making any configuration to httpd file run this commands to ensure ### removing all files that is not needed ### REMOVE welcome page rm -f /etc/httpd/conf.d/welcome.conf ### REMOVE default error page rm -f /var/www/error/noindex.html ### CREATE a link for Perl ln -s /usr/bin/perl /usr/local/bin/perl ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### HTTPD CONFIG FILE EDIT COMMAND ### gedit /etc/httpd/conf/httpd.conf #### HTTPD CONFIG LINE - BEGIN #### ##Configure HTTPD Options # line 44: change ServerTokens Prod # line 76: change to ON KeepAlive On # line 262: Admin's address ServerAdmin [email protected] # line 276: change to your server's name ServerName www.pxe.local:80 # line 331: change (enable CGI and disable Indexes) Options FollowSymLinks ExecCGI # line 338: change AllowOverride All # line 402: add file name that it can access only with directory's name DirectoryIndex index.html index.cgi index.php # line 536: change ServerSignature Off # line 759: make it comment #AddDefaultCharset UTF-8 # line 796: uncomment and add file-type that apache looks them CGI AddHandler cgi-script .cgi .pl #### HTTPD CONFIG LINE - END #### ------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------ ### HTTPD TEST - Create this files to test HTTPD Service #### ### Create a HTML test page and access to it with web browser. ### It's OK if following page is shown. ------------------------------------------------------------------------------------ ### Create and edit index.html ### and paste conntent in it gedit /var/www/html/index.html #### index.html - BEGIN #### <html> <body> <div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"> PXE Local Test Page YEAAAAAA!!!! </div> </body> </html> #### index.html - END #### ------------------------------------------------------------------------------------ ### Create and edit index.cgi ### and paste conntent in it gedit /var/www/html/index.cgi #### index.cgi - BEGIN #### #!/usr/local/bin/perl print "Content-type: text/html\n\n"; print "<html>\n<body>\n"; print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n"; print "CGI Test Page"; print "\n</div>\n"; print "</body>\n</html>\n";