问题:
解答:
fdisk 不打标签是否有影响?????????
1 重设root密码
rd.break
[ctrl+x]
mount -l
mount -o remount,rw /sysroot
chroot /sysroot
passwd
[redhat/redhat]
touch /.autorelabel
exit
exit
2 调出图形界面
init 5
systemctl isolate graphical.target
3 调整主机名和网络
hostnamectl set-hostname server0.example.com RHCSA.docx
nmcli connection show
nmcli connection modify eth0 ipv4.addresses "172.25.0.11/24 172.25.0.254"
nmcli connection modify eth0 ipv4.dns 172.25.254.254
nmcli connection modify eth0 ipv4.method manual
nmcli connection up eth0
ifconfig
cat /etc/resolv.conf
route -n
4 设置selinux
vim /etc/sysconfig/selinux
setenforce 1
getenforce
5 配置yum源
cd /etc/yum.repos.d
cat yum.repo
[root@server0 yum.repos.d]# cat yum.repo
[yum]
baseurl=http://classroom.example.com/content/rhel7.0/x86_64/dvd/
name=yum
enable=1
gpgcheck=0
yum clean all
yum repolist
yum -y install xclock
6 扩大文件系统
lvextend -L 290M -n /dev/mapper/vg00-vo
resize2fs /dev/mapper/vg00-vo
xfs_growfs /dev/mapper/vg00-voxfs
7 创建用户
groupadd adminuser
useradd natasha
usermod natasha -aG adminuser
useradd harry
usermod harry -aG adminuser
tail /etc/passwd
useradd -s /sbin/nologin sarah
echo "redhat"|passwd --stdin sarah
echo "redhat"|passwd --stdin natasha
echo "redhat"|passwd --stdin harry
8 配置/var/tmp/fstab权限
cp /etc/fstab /var/tmp/
chown root:root /var/tmp/fstab
ll /var/tmp/fstab
setfacl -m u:natasha:rw- /var/tmp/fstab
setfacl -m u:harry:--- /var/tmp/fstab
getfacl /var/tmp/fstab
9 配置cron任务=====================================??
crontab -e -u natasha
crontab -l -u natasha
23 14 * * * /usr/bin/echo hiya
10 创建一个共享目录
mkdir -p /home/admins
ll -d /home/admins
chown -R :adminuser /home/admins
chmod -R 775 /home/admins
chmod g+s /home/admins
ll -d /home/admins/
11 安装内核升级
wget http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/kernel-3.10.0-123.1.2.el7.x86_64.rpm
rpm -ivh kernel-3.10.0-123.1.2.el7.x86_64.rpm
reboot
12 绑定外部验证服务器
yum list |grep ldap
yum -y install sssd krb5-workstation nss-pam-ldapd authconfig-gtk
id ldapuser1
authconfig-gtk
LDAP
dc=example,dc=com
ldap://classroom.example.com
Use TLS
Download CA C==》http://classroom.example.com/pub/example-ca.crt
LDAP password
id ldapuser1
13 配置NTP
yum -y install system-config-date
system-config-date
打勾 Synch。。。
清空NTP Server
添加classroom.example.com
timedatectl status
NTP synchronized: yes
tail /etc/chrony.conf
server classroom.example.com iburst
14 配置autofs===============================??
yum -y install autofs
systemctl enable autofs
showmount -e 172.25.0.254
mkdir /home/guests
vim /etc/auto.master
/home/guests /etc/auto.misc
vim /etc/auto.misc
* -fstype=nfs,rw,soft,intr,vers=3 classroom.example.com:/home/guests/&
ping classroom.example.com
systemctl start autofs
su - ldapuser1
su - ldapuser2
su - ldapuser3
15 创建一个用户账号
useradd -u 3400 iar
echo "redhat" |passwd --stdin iar
16 添加一个swap分区
fdisk /dev/sdb
加个500M的/dev/sdb2
partprobe /dev/sdb
fdisk -l
mkswap /dev/sdb2
free -m
vi /etc/fstab
UUID=240b95d9-c7d2-474b-acf5-565fe72b8ff4 swap swap defaults 0 0
mount -a
free -m
swapon -a
free -m
swapon -s
17 查找文件
mkdir /root/findresults
find / -user iar -exec cp -a {} /root/findresults/ \;
cd /root/findresults/
ls
18 查找一个字符串
grep seismic /usr/share/dict/words >/root/lines.txt
cat /root/lines.txt
19 创建名为/root/backup.tar.bz2的备份文件
man tar
tar -jcvf /root/backup.tar.bz2 /usr/local
file /root/backup.tar.bz2
tar -tjvf /root/backup.tar.bz2
20 创建一个逻辑卷
fdisk /dev/sdb
创建1G的盘/dev/sdb3
partprobe /dev/sdb
fdisk -l
pvcreate /dev/sdb3
vgcreate -s 16M datastore /dev/sdb3
vgs
lvcreate -l 50 -n database datastore
lvs
mkfs.ext3 /dev/mapper/datastore-database
blkid
mkdir /mnt/database
vi /etc/fstab
UUID=37e9e8cd-e284-4066-b53f-5d3c0fe25b2c /mnt/database ext3 defaults 0 0
mount -a
df -hT
![fj.png](/image/default/fj.png)
解答:
fdisk 不打标签是否有影响?????????
1 重设root密码
rd.break
[ctrl+x]
mount -l
mount -o remount,rw /sysroot
chroot /sysroot
passwd
[redhat/redhat]
touch /.autorelabel
exit
exit
2 调出图形界面
init 5
systemctl isolate graphical.target
3 调整主机名和网络
hostnamectl set-hostname server0.example.com RHCSA.docx
nmcli connection show
nmcli connection modify eth0 ipv4.addresses "172.25.0.11/24 172.25.0.254"
nmcli connection modify eth0 ipv4.dns 172.25.254.254
nmcli connection modify eth0 ipv4.method manual
nmcli connection up eth0
ifconfig
cat /etc/resolv.conf
route -n
4 设置selinux
vim /etc/sysconfig/selinux
setenforce 1
getenforce
5 配置yum源
cd /etc/yum.repos.d
cat yum.repo
[root@server0 yum.repos.d]# cat yum.repo
[yum]
baseurl=http://classroom.example.com/content/rhel7.0/x86_64/dvd/
name=yum
enable=1
gpgcheck=0
yum clean all
yum repolist
yum -y install xclock
6 扩大文件系统
lvextend -L 290M -n /dev/mapper/vg00-vo
resize2fs /dev/mapper/vg00-vo
xfs_growfs /dev/mapper/vg00-voxfs
7 创建用户
groupadd adminuser
useradd natasha
usermod natasha -aG adminuser
useradd harry
usermod harry -aG adminuser
tail /etc/passwd
useradd -s /sbin/nologin sarah
echo "redhat"|passwd --stdin sarah
echo "redhat"|passwd --stdin natasha
echo "redhat"|passwd --stdin harry
8 配置/var/tmp/fstab权限
cp /etc/fstab /var/tmp/
chown root:root /var/tmp/fstab
ll /var/tmp/fstab
setfacl -m u:natasha:rw- /var/tmp/fstab
setfacl -m u:harry:--- /var/tmp/fstab
getfacl /var/tmp/fstab
9 配置cron任务=====================================??
crontab -e -u natasha
crontab -l -u natasha
23 14 * * * /usr/bin/echo hiya
10 创建一个共享目录
mkdir -p /home/admins
ll -d /home/admins
chown -R :adminuser /home/admins
chmod -R 775 /home/admins
chmod g+s /home/admins
ll -d /home/admins/
11 安装内核升级
wget http://classroom.example.com/content/rhel7.0/x86_64/errata/Packages/kernel-3.10.0-123.1.2.el7.x86_64.rpm
rpm -ivh kernel-3.10.0-123.1.2.el7.x86_64.rpm
reboot
12 绑定外部验证服务器
yum list |grep ldap
yum -y install sssd krb5-workstation nss-pam-ldapd authconfig-gtk
id ldapuser1
authconfig-gtk
LDAP
dc=example,dc=com
ldap://classroom.example.com
Use TLS
Download CA C==》http://classroom.example.com/pub/example-ca.crt
LDAP password
id ldapuser1
13 配置NTP
yum -y install system-config-date
system-config-date
打勾 Synch。。。
清空NTP Server
添加classroom.example.com
timedatectl status
NTP synchronized: yes
tail /etc/chrony.conf
server classroom.example.com iburst
14 配置autofs===============================??
yum -y install autofs
systemctl enable autofs
showmount -e 172.25.0.254
mkdir /home/guests
vim /etc/auto.master
/home/guests /etc/auto.misc
vim /etc/auto.misc
* -fstype=nfs,rw,soft,intr,vers=3 classroom.example.com:/home/guests/&
ping classroom.example.com
systemctl start autofs
su - ldapuser1
su - ldapuser2
su - ldapuser3
15 创建一个用户账号
useradd -u 3400 iar
echo "redhat" |passwd --stdin iar
16 添加一个swap分区
fdisk /dev/sdb
加个500M的/dev/sdb2
partprobe /dev/sdb
fdisk -l
mkswap /dev/sdb2
free -m
vi /etc/fstab
UUID=240b95d9-c7d2-474b-acf5-565fe72b8ff4 swap swap defaults 0 0
mount -a
free -m
swapon -a
free -m
swapon -s
17 查找文件
mkdir /root/findresults
find / -user iar -exec cp -a {} /root/findresults/ \;
cd /root/findresults/
ls
18 查找一个字符串
grep seismic /usr/share/dict/words >/root/lines.txt
cat /root/lines.txt
19 创建名为/root/backup.tar.bz2的备份文件
man tar
tar -jcvf /root/backup.tar.bz2 /usr/local
file /root/backup.tar.bz2
tar -tjvf /root/backup.tar.bz2
20 创建一个逻辑卷
fdisk /dev/sdb
创建1G的盘/dev/sdb3
partprobe /dev/sdb
fdisk -l
pvcreate /dev/sdb3
vgcreate -s 16M datastore /dev/sdb3
vgs
lvcreate -l 50 -n database datastore
lvs
mkfs.ext3 /dev/mapper/datastore-database
blkid
mkdir /mnt/database
vi /etc/fstab
UUID=37e9e8cd-e284-4066-b53f-5d3c0fe25b2c /mnt/database ext3 defaults 0 0
mount -a
df -hT
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31441616/viewspace-2147236/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31441616/viewspace-2147236/