▲就业班和全程班的小伙伴看这里:(学习老王视频的作业第11-12节)
1、自建yum仓库,分别为网络源和本地源
建立本机yum仓库(光盘yum源)
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
# rpm -q autofs
# yum install autofs -y
# systemctl start autofs
# systemctl enable autofs
# ls /misc/cd
# cd /etc/yum.repos.d/
# mkdir repos.bak
# mv * ./repos.bak
# vim local.repo
[base]
name=cdrom
baseurl=file:///misc/cd
gpgcheck=1
[epel]
name=aliyun epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/$basearch/
gpgcheck=1
enabled=0
:wq
#yum clean all
#yum repolist
企业内部局域网YUM源服务器 (即支持Centos6 也支持Centos7)
(0)准备工作
1、关闭selinux
#vim /etc/selinux/config
SELINUX=disabled
:wq
2、关闭防火墙
#systemctl stop firewalld
#systemctl disable firewalld
(1)安装httpd服务
#yum install httpd -y
#systemctl start httpd
#cd /var/www/html
#mkdir -p centos/{6,7}/os/x86_64/
#mount /data/centos6.iso /var/www/html/centos/6/os/x86_64/
#mount /data/centos7.iso /var/www/html/centos/7/os/x86_64/
(2)客户端编辑 /etc/yum.repos.d/yum.repo文件
[yum]
name=Intranet base yum
baseurl=http://192.168.253.10/centos/$releasever/os/$basearch/
gpgkey=http://192.168.253.10/centos/$releasever/os/$basearch/RPM-GPG-KEY-CentOS-$releasever
:wq
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
服务器端:
[root@centos7 ~]#yum install httpd -y
[root@centos7 ~]#mkdir /var/www/html/soft
[root@centos7 ~]#cp httpd-2.4.25.tar.gz /var/www/html/soft
[root@centos7 ~]#systemctl restart httpd
[root@centos7 ~]#vim /data/autohttpd.sh
#!/bin/bash
systemctl stop firewalld
systemctl disable firewalld.service &>/dev/null
sed -ri.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config &>/dev/null
yum install gcc openssl-devel pcre-devel apr-devel apr-util-devel -y
mkdir /tar
wget http://192.168.253.10/soft/httpd-2.4.25.tar.gz
mv /root/httpd-2.4.25.tar.gz /tar
cd /tar
tar xvf httpd-2.4.25.tar.gz
cd /tar/httpd-2.4.25
./configure --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-so
echo "/apps/httpd24/bin/apachectl start" | cat >> /etc/rc.d/rc.local
make -j2
make install
chmod +x /etc/rc.d/rc.local
cd /apps/httpd24/bin/
./apachectl start
:wq
[root@centos7 ~]#cp /data/autohttpd.sh /var/www/html/soft
客户端:
[root@centos7 ~]# curl http://192.168.253.10/soft/autocmd.sh | bash
3、创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统 ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项
[root@centos7 ~]#fdisk -l /dev/sdc
Device Boot Start End Blocks Id System
/dev/sdc1 2048 4196351 2097152 83 Linux
[root@centos7 ~]#mkfs.ext4 -b 2048 -L 'TEST' -m 1 -O acl /dev/sdc1
[root@centos7 ~]#blkid
[root@centos7 ~]#mount /dev/sdc1 /test
[root@centos7 ~]#vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Jan 6 18:47:08 2020
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
UUID=eba60e1f-2430-45bf-ae03-b1e57187b85a / xfs defaults 0 0
UUID=5728ab6d-03be-4c85-9bbe-1b376135e6bd /boot xfs defaults 0 0
UUID=d995c41c-a6d6-4aa3-8880-f9e0861ab6b4 /data xfs defaults 0 0
UUID=3779dc1e-88af-43d9-becc-3b57b2a85bc7 swap swap defaults 0 0
UUID=ea304265-aa4f-462b-8a58-cb9aa2f0gc77 /test ext4 defaults 0 0
:wq
4、创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小 为16MB, 而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录
[root@centos7 ~]#lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 9:0 0 10G 0 disk
sdc 10:0 0 10G 0 disk
4.1、创建pv
[root@centos7 ~]#pvcreate /dev/sdb /dev/sdc
Physical volume "/dev/sdb" successfully created.
Physical volume "/dev/sdc" successfully created.
[root@centos7 ~]#pvdisplay
4.2、创建vg
[root@centos7 ~]#vgcreate testvg /dev/sdb /dev/sdc -s 16
Volume group "testvg" successfully created
[root@centos7 ~]#vgdisplay
4.3、创建lv
[root@centos7 ~]#lvcreate -n testlv -L 5G /dev/testvg
Logical volume "testlv" created.
[root@centos7 ~]#lvdisplay
4.4、格式化
[root@centos7 ~]#mkfs.ext4 /dev/testvg/testlv
4.5、挂载
[root@centos7 ~]#mkdir /users
[root@centos7 ~]#mount /dev/testvg/testlv /users
[root@centos7 ~]#df -h