Difficult RHCSA Flashcards
Create a localrepo
Add disk with an iso
cd /
mkdir localrepo
df -h (do this to find path)
(the name of your disk will have spaces in it, cd into it and space to find the correct way to put it)
cd /disk….
cd Appstream
cd Packages
ls -ltr | wc -l (just to see how many packages)
du -sh (to see if we have enough storage)
cp -rv * /localrepo, (just grab one or two to save space)
rm -rf /etc/yum.respos.d/*
vim /etc/yum.repos.d/local.repo
[centos7]
name=centos7
baseurl=file:///localrepo/ (this is the directory we created)
enabled=1
gpgcheck=0
:wq
yum install createrepo
createrepo /localrepo/ (creates database for yum command)
yum clean all (clears cache from old repository)
yum repolist all (shows all repos)
REMEMBER:
If you’re running selinux on your reposerver, you need to change the context of the repo!!!!!
download ksh
Show ksh’s information
Show where configuration files are located
rpm -hiv ksh-23512.rpm
rpm -qa | grep ksh
rpm -qi ksh-23512.rpm
rpm -e ksh-23512.rpm
rpm -qa | grep ksh
which ksh
rpm -qf /usr/bin/ksh
Install screen via yum
rollback screen
(if you have an older version of screen this will just rollback the new one/update that you just installed)
Yum history undo 2
Describe dns record names
Host to IP - A Record
IP to Hostname - PTR Record
Hostname to Hostname - CNAME Record
Host - to - Host is if you have a bunch of servers and you all want them to have the same alias, since the other servers will technically have different names.
View all available time zones
Set time zone to Newyork
Set the date
set date and time
Sync time with ntp
timedatectl list-timezones
timedatectl set-timezone “America/New_York”
timedatectl set-time 2023-05-12
timedatectl set-time ‘2023-05-12 00:39:00;
timedatectl set-ntp true
timedatectl
check if chronyd or ntpd is running if timedatectl shows it is not synced
Install and use sendmail
yum install sendmail
yum install sendmail-cf
vim /etc/mailsendmail.mc
This is where you would put the FQDN of the mail server:
dnl define(‘SMART_HOST’,`smtp.your.provider’)dnl
(dns means comment)
systemctl restart sendmail
ps -ef | grep sendmail
mail -s “Hello!” joshcahoe@gmail.com
Welcome to fart
^d
Download and configure rsyslog
rpm -qa | grep rsyslog
vim /etc/rsyslog.conf
(If you’re sending syslog info to another server change the #*** @@remote-host:514)
systemctl start rsyslog
systemctl enable rsyslog
Where would you go to access the ssh configuration to change the port?
disable root login
What should you do afterword?
/etc/sshd/ssh_conf
PermitRootLogin no
let selinux know
semanage port -a -t ssh_port_t -p tcp 5183
open port on firewall
Send a keep alive message out every 600 seconds, if there is no response after 1 then close the ssh connection
This just makes sure there is a network connection
vim /etc/ssh/sshd_config
ClientAliveInterval 600 (seconds that a keep alive message is sent out)
ClientAliveCountMax 0 (You send one keep alive every 300 seconds and disconnect after 0 answers are missed.)
systemctl restart sshd
This checks if there is still a network connection
Remove empty password connections
vim /etc/ssh/sshd_config
remove hash from
PermitEmptyPasswords
systemctl restart sshd
Only allow one user in ssh
vim /etc/ssh/sshd_config
AllowUsers josh danny
systemctl restart sshd
Generate SSH-keys
Copy keys to the server
Login to test
ssh-keygen
Prompt will comup for where to save your key, this is the path, enter will use default location
Passphase enter
Copy the SHA256 key
ssh-copy-id root@lollipop
enter password for server’s root
(this copys to server’s folder : root/.ssh/authorized_keys)
Install and configure cockpit
via server
ping 8.8.8.8 to check network connectivity
yum install cockpit -y
rpm -qa | grep cockpit
systemctl start cockpit
systemctl enable cockpit
systemctl status cockpit
(cockpit is tcp 9090)
firewall-cmd –permanent –add-port=9090/tcp
firewall-cmd –permanent –add-service=cockpit
firewall-cmd –reload
Where is your DNS server stored?
/etc/resolv.conf
Show info about ens33
ethtool ens33