Configurar Servidores Linux v.2.2
Configurar Servidores Linux v.2.2
2. Modificar en el BIOS en la opcin Advanced Chipset Control fijando el parmetro como Sata Raid Enable, asi el disco duro ser reconocido como SATA (/dev/sda) 3. 4. 5. 6. 7. Instalar el servidor en la opcin Server-GUI Fijar el huso horario en Amrica La Paz, quitando la opcion UTC Fijar contrasea del usuario administrador root en utepsa Luego de la instalacion ingresar al servidor Linux mediante una consola Deshabilitar el firewall
8.
Deshabilitar el SELinux
# vi /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=disabled # SELINUXTYPE= type of policy in use. Possible values are: # targeted - Only targeted network daemons are protected. # strict - Full SELinux protection. SELINUXTYPE=targeted
9. Modificar el archivo /etc/modprobe.conf para deshabilitar el soporte para ipv6 adicionando parmetros
# vi /etc/modprobe.conf alias eth0 tg3 alias scsi_hostadapter ahci alias scsi_hostadapter1 ata_piix alias net-pf-10 off alias ipv6 off
10.
LANG=C runlevel chkconfig --list | grep 5:on | awk '{ print $1 }' > servicios.txt for i in $(cat servicios.txt); do chkconfig $i off; done
11.
13. 14.
# mkdir -p {bin,conf,targz,rpms}
# cd /root/bin # vi tailm tail -n 30 -f /var/log/messages # chmod +x /root/bin/tailm # vi visor tail -n 30 -f /var/log/squid/access.log # chmod +x visor
15.
16.
# vi /etc/grub.conf # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/VolGroup01/LogVol00 # initrd /initrd-version.img #boot=/dev/sda default=0 timeout=3 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-164.el5) root (hd0,0) kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup01/LogVol00 initrd /initrd-2.6.18-164.el5.img
17.
18.
Modificar el archivo /etc/hosts para resolver el nombre del servidor Linux lacancha.fassil.com.bo vi /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost alumno
a. Fijar password para el acceso mediante vnc # vncpasswd Password: Verify: b. Habilitar el servicio vnc en el servicio vncserver :5 c. Para terminar el servicio vnc vncserver kill :5 d. Editar archivo de configuracin del vnc cd vi .vnc/xstartup #!/bin/sh # Uncomment the following two lines for normal desktop: # unset SESSION_MANAGER # exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic &
# xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & # twm &
gnome-session & 20. Sacar una imagen del DVD instalador del software CentOS Linux mkdir /media/CentOS mkdir /isos umount /dev/cdrom readcd f=/isos/CentOS-5.4-x86_64.iso
Read speed: 22160 kB/s (CD 125x, DVD 16x). Write speed: 0 kB/s (CD 0x, DVD 0x). Capacity: 2255600 Blocks = 4511200 kBytes = 4405 MBytes = 4619 prMB Sectorsize: 2048 Bytes Copy from SCSI (4,0,0) disk to file '/isos/CentOS-5.4-x86_64.iso' end: 2255600 addr: 2255600 cnt: 48 Time total: 304.287sec Read 4511200.00 kB at 14825.5 kB/sec.
Modificar el nivel de arranque del servidor Linux para que inicie en modo 3 Full multiuser texto
This file describes how the INIT process should set up the system in a certain run-level. Miquel van Smoorenburg, <[email protected]> Modified for RHS Linux by Marc Ewing and Donnie Barnes
# Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:3:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc l1:1:wait:/etc/rc.d/rc l2:2:wait:/etc/rc.d/rc l3:3:wait:/etc/rc.d/rc l4:4:wait:/etc/rc.d/rc l5:5:wait:/etc/rc.d/rc l6:6:wait:/etc/rc.d/rc 0 1 2 3 4 5 6
# Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 # Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm nodaemon
Recargar el archive de configuracion /etc/inittab init q 22. Reiniciar el servidor Linux reboot
Configure los DNS de acuerdo a su conexin a internet (aqu se muestran los DNS de CotasNet)
Descargar el paquete del repo EPEL # wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm Instalar paquete de definicin de acceso al repo EPEL # rpm -ivh epel-release-5-4.noarch.rpm
b.
Descargar el paquete del repo RPMFORGE # wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm Instalar paquete de definicin de acceso al repo RPMFORGE # rpm -ivh rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
2. INSTALAR SOFTWARE DESDE LA IMAGEN ISO DEL DVD INSTALADOR Montar la imagen del instalador de Linux mount -o loop /isos/CentOS-5.4-x86_64.iso /media/CentOS/ Si usa una PC Virtual, primero introduzca el CD en la PC Virtual (o monte una ISO en el lector) mount -o loop /dev/cdrom /media/CentOS/ Instalar el software desde la imagen yum --disablerepo=* --enablerepo=c5-media install dhcp -y Desmontar imagen umount /media/CentOS 3. SERVICIO VPN
yum install openvpn -y
SERVICIO FIREWALL
Crear archivo vi /etc/rc.d/rc.firewall
#!/bin/sh echo ## SCRIPT de IPTABLES ##Declaramos una variable $IPT para utlizarla mas adelante IPT="/sbin/iptables" echo -n Aplicando Reglas de Firewall... ## FLUSH de reglas $IPT -F $IPT -X $IPT -Z $IPT -t nat -F
echo -n Estableciendo politica por defecto.... ## Establecemos politica por defecto $IPT -P INPUT ACCEPT $IPT -P OUTPUT ACCEPT $IPT -P FORWARD ACCEPT $IPT -t nat -P PREROUTING ACCEPT $IPT -t nat -P POSTROUTING ACCEPT
$IPT -A INPUT -i lo $IPT -A INPUT -m state --state RELATED,ESTABLISHED ############################################## ########### OUTPUT ############## ##############################################
############################################## ########### FORWARD ############## ############################################## $IPT -A FORWARD -m state --state RELATED,ESTABLISHED ############################################## ########### POSTROUTUING ############## ############################################## -j ACCEPT
echo " OK" # Fin del script service iptables save echo
Dar permiso de ejecucion chmod +x /etc/rc.d/rc.firewall Ejecutar el firewall sh /etc/rc.d/rc.firewall Que el servicio se inicie al levantar el Servidor chkconfig iptables on
chmod +x /etc/cron.daily/ntp
Ejecutar el archivo
sh /etc/cron.daily/ntp