Deploy, configure, and maintain systems Flashcards
networking dynamically(from DHCP)
#cat /etc/sysconfig/network-cripts/ifcfg-eno1 NAME=eno1 HWADDR=[Mac Address] TYPE=ethernet UUID=[uuid number(hex)] ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=dhcp
Networking statically
-edit file /etc/sysconfig/network-scripts/ifcfg-eno1 NAME="eno1" BOOTPROTO="static" DNS1="10.1.1.1" GATEWAY= "10.1.1.1" HWADDR=[MAC Address] IPADDR="10.1.1.3" NETMASK="255.255.255.0" IPV6INIT="yes" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" UUID="[UUID hex number]"
after making changes to eth files
systemctl restart network
Primary network configuration files
/etc/hosts
/etc/resolv.conf
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-
/etc/hosts
Purpose is to resolve host names that cannot be resolved any other way. It can also be used to resolve host names on small networks with no DNS server. This file should contain a line specifying the IP address of the loopback device(127.0.0.1) as localhost.domain
/etc/resolv.conf
This file specifies the IP addresses of DNS servers and the search domain. Unless configured to do otherwise, the network initialization scripts populate this file. Review man 5 resolv.conf
/etc/sysconfig/network
This file specifies routing and host information for all network interfaces. It is used to contain directives which are to have global effect and not to be interface specific
/etc/sysconfig/network-scripts/ifcfg-
for each network interface, there is a corresponding interface script
Cron VS at
Cron is used to schedule recurring task while at is used to schedule a task to run at a particular time
Setting up a cron
systemctl list-unit-files | grep crond
make sure that crond is set to boot
#systemctl status crond.service check that crond is started
# cat /etc/crontab see rule example of job definition
* * * * *
1st star is for min(0-59)
2nd star is for hours(0-23)
3rd star is for day (1-31
)4th star is for month(1-12)
5th star is for day of the week(Sunday = 0 or 7, 0-6 Sunday-Saturday)
Review
#ls /var/spool/cron
#cat /var/spool/cron/root
Cron jobs that run periodically
These jobs are stored and run periodically # /etc/cron.daily # /etc/cron.weekly # /etc/cron.hourly # /etc/cron.monthly
List crontab
#crontab -l list crontab as owner #crontab -l -u user1 list crontab as root for user1
edit crontab
#crontab -e edit crontab for current user # crontab -e -u user1 edit crontab for user1only root can edit other user's crontab
/etc/cron.deny and /etc/cron.allow
add user to /etc/cron.deny or /etc/cron.allow to deny or allow them to be able to create cron jobs
Setting up at
#systemctl status atd.service check that the atd service has started # systemctl list-unit-files | grep atd make sure it's set to start at boot
List of commands for at
#at -f file.sh now+2minutes sets a job to run in 2 mins # atq jobs that are submitted # atrm 3 remove a job(enter job number) #at -f some.sh 12pm tomorrow run at 12PM tomorrow #ls /var/spool/at where the scrip for scheduled jobs are
Kickstart
- After an install a ks file is automatically created and stored in /root/anaconda-ks.cfg
- You can create a ks file by hand or you can use the system kickstart utility located here:Applications -> System tools -> kickstart (it’s not installed by default)
- in the kickstart file, the lines that starts with”@” means a group package to be installed. The lines that starts with “-“ means to exclue those packages from being installed.
Installing from a KS in an NFS partition
- first boot from the boot cd. Then press the ESC key
- at the boot prompt type(press Enter afterward)boot: linus ks=nfs:IP:/srv/nfs/ks.cfg
Installing from a KS in an FTP or http location
While still booting from an actual install cd, you could add the location of the ks to an ftp or http server, and add such entry in the KS file:usr –url=http://ip/rhel6
-After booting from the DVD install, press the tab key, then enter:> vmlinuz initrd = initrd.img ks=http://ip/rhel/ks.cfg ksdevice=eth0
or> vmlinuz initrd = initrd.img asknetwork ks=http://your.web.com/rhel6.cfg ksdevice=eth0