rhcsa备战笔记

笔记全部手打 转载请加原文链接

0)重置密码
开机按e 找到linux16行 rd.break console=tty0  ctrl+x
mount -o remount,rw /sysroot
chroot /sysroot
echo redhat | passwd --stdin root
touch /.autorelabel
exit
reboot

1)设置yum仓库
rm -rf /etc/yum.repos.d/*
vim /etc/yum.repos.d/dvd.repo
[dvd]
name=dvd
baseurl=实际url
enabled=1
gpgcheck=0
yum clean all
yum repolist

2)磁盘分区
fdisk /dev/vdb
p查看分区 n新建
+300M +500M +2G
+512M
partprobe
lsblk->300M 500M 2G 1K 512M
vgcreate systemvg /dev/vdb1
lvcreate -n vo systemvg
mkfs.ext3 /dev/systemvg/vo
vgextend systemvg /dev/vdb2
lvcreate -L 300M /dev/systemvg/vo
resize2fs /dev/systemvg/vo
vim /etc/fstab
/dev/systemvg/vo  /vo  defaults 0 0
mkdir /vo
mount -all

3)创建用户账户
groupadd adminuser
useradd -G adminuser natasha
useradd -G admin harry
useradd -s /sbin/nologin sarah
echo XX | passwd  --stdin  natasha、harry、sarah

4)配置文件权限
cp /etc/fstab  /var/tmp/fstab
setfacl -m u:natasha:rw /var/tmp/fstab
setfacl -m u:harry:- /var/tmp/fstab

5)设置定时任务
crontab -e -u  natasha
23 14 * * * /bin/echo hiya
systemctl restart crond
systemctl enable crond

6)创建共享目录
mkdir /home/admins
chown :adminuser /home/admins
chmod 2770 /home/admins

7)内核审计
uname -r
yum -y install 地址
reboot
uname -r

8)ldap
yum -y install sssd
authconfig-tui
选中ldap的 输入服务器与dn
下载证书
cd /etc/openldap/cacerts
wget 地址
systemctl restart sssd
systemctl enable sssd
id ldapuser0

9)autofs
yum -y install autofs
mkdir /home/guests
vim /etc/auto.master
/home/guests /etc/auto.guests
vim /etc/auto.guests
* -rw classroom.example.com:/home/guests/&
systemctl restart autofs
systemctl enable autofs
su - ldapuser0 -c "pwd"

10)ntp
yum -y install chrony
vim /etc/chrony.conf
server 域名 iburst
systemctl restart chrony
systemctl enable chrony
timedatectl

11)创建用户账户
useradd -u XX  alex
echo XX | passwd --stdin alex

12)
mswap /dev/vdb5
vim /etc/fstab
/dev/vdb5 swap swap defaults 0 0
swapon -a
swapon -s

13)查文件
mkdir /root/XXX
find / -user student -type f -exec cp {} /root/XXX \;

14)查字符串
grep XX /worldlist > /root/target

15)创建逻辑卷
vgcreate -s 16M datastore
lvcreate -n database -l 50 datastore
mkfs.ext3 /dev/datastore/database
vim /etc/fstab
/dev/datastore/database  /mnt/database ext3 defaults 0 0
mkdir /mnt/database
mount -admin

16)创建归档
tar -jcPf 1.tar.bz2 源
tar -zcvf 2.tar.gz 源
tar -cvf  3.tar 源

上一篇:rhcsa{2}


下一篇:基本操作命令解析