1.破解密码,设置网络
reboot
e
rd.break console=tty0
ctrl + x
mount -o rw,remount /sysroot
chroot /sysroot
passwd
touch /.autorelabel
exit
reboot
网络:
vim /etc/sysconfig/network-scripts/ifcfg-eth0
cat /etc/sysconfig/network(centos6位置)
vim /etc/hostname
2.selinux
setenforce 1
3.yum
vim rhel7.repo
[rhel7]
name=rhel7
baseurl=http://,,,,
gpgcheck=0
yum install -y autofs chrony
4.lvs
lvscan
df -Th
lab lvm setup(准备环境)
lvextend -L 302M /dev/finance/loans
ext3/4:resize2fs /dev/finance/loans
xfs :xfs_growfs /dev/finance/loans
df -Th
lvscan
5.adminuser
groupadd adminuser
useradd natasha -G adminuser
useradd harry -G adminuser
useradd sarash -s /sbin/nologin
echo "tianyun" | passwd --stdin natasha
echo "tianyun" | passwd --stdin harry
echo "tianyun" | passwd --stdin sarash
id harry
su - sarash
6.facl
cp -rf /etc/fstab /var/tmp
setfacl -m u:natasha:rw- /var/tmp/fstab
setfacl -m:harry:- /var/tmp/fstab
getfacl /var/tmp/fstab
7.crontab
crontab -e -u natasha
20 14 * * * /bin/echo hello
crontab -l -u natasha
8.git
mkdir /home/admins
chgrp adminuser /home/admins
chmod 770 /home/admins }==\
==>chmod 2770 /home/admins
chmod g+s /home/admins }==/
ll -d /home/admins
9.kernel
vim /etc/yum.repo.d/kernel.repo
[kernel]
name=kernel
baseurl=http://
gpgcheck=0
wq
yum repolist
yum list kernel
uname -a
yum install -y kernel
reboot
10.LDAP
yum install -y openldap openldap-clients sssd authconfig-gtk
authconfig-gtk
图形无法打开解决:
|---> ssh -X root@server0
|---> authconfig-gtk
LDAP server classroom.example.com
LDAP search Base DN: dc=example,dc=com
use TLS :http://classroom.example.com/pub/example-ca.crt
LDAP password
id ldapuser0
ssh ldapuser0@localhost
11.NTP
yum install -y chrony
vim /etc/chrony.conf
注释前四行(server 0~4)
加入:server classroom.example.com iburst
wq
systemctl restart chronyd
systemctl enable chronyd
验证:
timedatectl
NTP enabled: yes
NTP synchronized:yes
12.autofs
yum install -y autofs
vim /etc/auto.master
/home/guests /etc/auto.ldap(自定义监控目录guests)
wq
vim /etc/auto.ldap
ldapuser0 -rw,v3 classroom.example.com:/home/guests/ldapuser0(配置监控方式)
wq
systemctl restart autofs
systemctl enable autofs
验证:
ssh ldapuser0@localhost
df
vim /etc/auto.ldap
* -rw,v3 classroom.example.com:/home/guests/&
13.useradd
useradd jack -u 2000
passwd
tianyun
14.swap
fdisk -l 查看分区信息
fdisk /dev/sda
n
e
enter;enter
n
l
+512M
w
partprobe /dev/sdb
lsblk
mkswap /dev/sdb5
blkid /dev/sdb5(复制分区的uuid)
vim /etc/fstab
UUID="..." swap swap default 0 0
wq
swapon -a
swapon -s
15.find
mkdir /findfiles
find / -user alice
find / -user natasha -exec cp -a {} /findfiles \;
验证:
ls /findfiles
16.grep
grep "seismic" /usr/share/dict/words > /root/filelist
cat !$
17.bzip2
yum istall -y bzip2
tar -cjvf /root/backup.tar.bz /etc
验证:
file /root/backup.tar.bz
18.lv
fdisk /dev/sdb
n
l
enter
+200M
w
partprobe /dev/sdb
lsblk
pvcreate /dev/sdb6
vgcreate datastore /dev/sdb6 -s 16M
验证:vgdisplay datastore ; 删除:vgremove datastore
lvcreate -l 10 -n database datastore
mkfs.ext3 /dev/datastore/database
mkdir /mnt/database
vim /etc/fstab
/dev/datastore/database /mnt/database ext3 defaults 0 0
wq
mount- a
lsblk
reboot