RHCE集训笔记1

Linux技术 技术 最近更新

平时不好好上课,临时抱佛脚了只能

上午9点左右开始,2.5个小时,RHCSA部分
下午14点左右开始,3.5个小时,RHCE部分
2-3个工作日,20人一场
总分300分,210分及格

携带:
身份证
邮箱(收成绩,统一用QQ邮箱,上午下午一个邮箱)
ID号(补考也需要)
草稿纸和笔
键盘和鼠标垫

注意:
按顺序做,不要跳着做
练习 所有的题
要有排错能力
考场记录:不要大声说话、不要作弊!
不要SSH尝试登陆别人
考完之后1-3天内收到成绩,只有电子版
花5分钟考试说明,题目是中文

[1]系统密码重置&基础网络配置:
rd.break ——crtl+x
mount -o remount,rw /sysroot/
chroot /sysroot/
echo rrhh9708 | passwd –stdin root
touch /.autorelabel
exit
exit

hostnamectl set-hostname desktop.group8.example.com
vi /etc/hostname
bash

nmcli conn modify eth0 ipv4.add “172.24.8.10/24 172.24.8.254” ipv4.dns 172.24.8.254 ipv4.method manual connection.autoconnect yes
nmcli conn down eth0 && nmcli conn up eth0
cat /etc/resolv.conf
cat /etc/sysconfig/network–scripts/ifcfig-eth0
route -n
nslookup desktop.group8.example.com
ping server.group8.example.com

[2]Selinux配置:
getenforce
setenforce 1
vi /etc/sysconfig/selinux
reboot

[3]YUM源配置:
cd /etc/yum.repos.d/
ls
cat redhat.repo
touch dvd.repo

[dvd]
name=dvd
baseurl=http://server/group8.example.com/yum
enabled=1
gpgcheck=0

yum clean all
yum list all

[4]调整逻辑卷容量:
lvs
lvextend -L 290M /dev/vg0/lv0
df -hT ——确认文件类型
resize2fs /dev/vg0/lv0 _ex
or xfs_growfs /dev/ _xfs

[5]用户和用户组:
groupadd -g 40000 adminuser
useradd -G adminuser natasha
useradd -G adminuser harry
useradd -s /sbin/nologin sarah
echo redhat | passwd –stdin natasha
echo redhat | passwd –stdin harry
echo redhat | passwd –stdin sarah
su -natasha

cat /etc/passwd

[6]文件权限:
cp /etc/fstab /var/tmp
ll /var/tmp/fstab
setfacl -m u:natasha:rw- /var/tmp/fstab
setfacl -m u:harry:— /var/tmp/fstab

getfacl
setfacl -x 删规则
切换用户 编辑访问文件

[7]计划任务:
crontab -u natasha -e
23 14 * * * /bin/echo “hiya”

crontab -u natasha -l

[8]
cd /home/
ls
chown:adminuser admins
ll
chgrp adminuser amdins

chmod g+w,o-rx admins/
ll

chmod g+s admins/
touch admins/file
ll admin/file

[9]升级内核:
curl http://server.group8.example.com/pub/ | grep kernel
wget http://server.group8.example.com/pub/
rpm -ivh kernel-.rpm

yum install http://server.group8.example.com/pub/
尽量不要在线安装

修复yum remove

grub2-editenv list 下次启动版本
uname -r
reboot

[10]LDAP:
cd /etc/openldap/
mkdir cacerts
ls
wget http://server.group8.example.com/pub/.pem

yum install sssd
ntpdate -u 172.24.8.254

autoconfig-tui
Use LDAP – Use LADP auth…
Server:server.group8.example.com
Base DN:dc=group8,dc=example,dc=com

getent passwd thales

su- thales

systemctl status sssd

ll /etc/

[11]autofs:
yum install autofs
systemctl enable autofs
systemctl start autofs
rpm -qc autofs
vi /etc/auto.master
/home/ldap /etc/auto.ldap
vi /etc/auto.ladp
thales -rw,vers=3 server./
ls /home
systemctl restart autofs
lv /home/ldap

su – thales
reboot

[12]ntp:
vi /etc/chrony.conf
server server.grpup8.example.com iburst
systectl restart chronyd
chronyc sources
chronyc +wait

[13]归档:
tar -cjf /root/sysconfig.tar.bz2 /etc/sysconfig
tar -tf sysconfig.tar.bz2
file suysconfig.tar.bz2

[14]配置用户
useradd -u 3456 jay
echo glegunge | passwd –stdin jay
id jay

[15]SWAP分区:
swapon -s
free -m
lsblk
扩展分区要用
fdisk -l
fdisk /dev/sda
n
e
n
+512M
w
n
t
82
cat /proc/parttitions
partprobe

blkid

swapon -a
swapoff /dev/sda5

free -m

[16]查找文件:
find / -user jay
mkdir findfiles
find / -user jay -exec cp -a {} findfiles/ \;

[17]查找字符串:
cat /usr/share/dict/words | grep seismic | wc -l
cat /usr/share/dict/words | grep seismic | grep ^$ | wc -l
cat wordlist | wc -l

[18]创建逻辑卷:
PE
xfs
卷组起码1G
fdisk /dev/sda
n
+1G
t
8e
w
partprobe
lsblk
pvcreate /dev/sda6
vgcreate -s 16M datastore /dev/sda6
vgs
lvcreate -l 50 -n database datastore
lvs

blkid

mount
reboot

lvremove
vgremove
pv