1用户需把/dev/myvg/mylv逻辑卷以支持磁盘配额的方式挂载到网页目录下
[root@localhost ~]# fdisk /dev/sd[bcde]1 磁盘分区
命令(输入 m 获取帮助):n
Select (default p): p
Last 扇区, +扇区 or +size{K,M,G} (2048-167772159,默认为 167772159):+20
[root@localhost ~]# mdadm -C /dev/md5 -l5 -n 3 /dev/sd[bcde]1 //创建RAID 5
[root@localhost ~]# pvcreate /dev/md5 //创建物理卷
[root@localhost ~]# vgcreate myvg /dev/md5 //创建myvg的卷组
[root@localhost ~]# lvcreate -L 20G -n mylv myvg // 创建mylv逻辑卷
[root@localhost ~]# mkfs.xfs /dev/myvg/mylv //格式化成xfs文件系统
卸载光盘
umount /dev/sr0
挂载光盘
mount /dev/sr0 /media/
-------------------------
构建本地YUM仓库文档
cd /etc/yum.repos.d
mkdir a/
mv C* a/
创建本地yum仓库文档
vi .a.repo
[a] //仓库名称
name=a
baseurl=file:///media //指定rpm包的位置
enabled=1 //启用本地yum仓库
gpgcheck=0 //禁用gpg校验
----------------
清除yum缓存
yum -y clean all
重建yum缓存
yum makecache
[root@localhost ~]# yum -y install gcc gcc-c++ make lynx //编辑对应语言和安装包
[root@localhost ~]# tar -xf httpd-2.2.17.tar.gz -C /usr/src //解压缩安装包
[root@localhost ~]# cd /usr/src/httpd-2.2.17/ //切入安装包位置
[root@localhost httpd-2.2.17]# ./configure --prefix=/usr/local/httpd/ && make && make install //对应刚才的语言进行编辑 // 安装对应语言
[root@localhost httpd-2.2.17]# vi /usr/local/httpd/conf/httpd.conf // 进入程序把#号删除,然后保存退出
[root@localhost httpd-2.2.17]# /usr/local/httpd/bin/apachectl start //开启阿帕奇 start(开启的意思)
root@localhost ~]# lynx 192.168.200.113 虚拟机的ip地址
2、在网页目录下创建测试文件index.html,内容为用户名称,通过浏览器访问测试
[root@localhost ~]# lynx 192.168.200.113
3、创建用户账户,对LVM配置磁盘配额限制用户磁盘容量为软限制80M;硬限制100M、文件数量软限制为80个;硬限制为100个。
[root@localhost ~]# vi /etc/fstab //设置自动配置挂载 默认后面加defaults,usrquota,grpquota
(用户配额)(grp配额)
[root@localhost ~]#quotacheck -avug //扫描文件系统并建立Quota
[root@localhost ~]#quotaon -a //开启
创建用户skt useradd skt 密码 123
[root@localhost ~]#edquota -u skt
[root@localhost ~]#setfacl -m u:skt:rwx /usr/local/httpd/htdocs //给tom用户设置这个文件的权限rwx
[skt@localhost root]$ touch /usr/local/httpd/htdocs/{1..110}.txt //创建文件并测试限额
[skt@localhost root]$ touch /usr/local/httpd/htdocs/{1..110}.txt
dm-2: write failed, user file limit reached.
touch: 无法创建"/usr/local/httpd/htdocs/99.txt": 超出磁盘限额 //超出限额警报
touch: 无法创建"/usr/local/httpd/htdocs/100.txt": 超出磁盘限额
—————————————————————————————————————————————
4.构建主从DNS域名解析环境
所有服务器:
iptables -F
systemctl stop firewalld
setenforce 0
主服务器:
[root@localhost ~]# yum -y install bind
[root@localhost ~]# vim /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.200.111
nameserver 192.168.200.112
[root@localhost ~]# vim /etc/hosts //加速DNS解析速度
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.study.com
192.168.200.112 ns2.study.com
[root@localhost ~]# vim /etc/named.conf //配置主配置文件
options {
directory "/var/named"; //区域数据文件的默认存放位
};
zone "study.com" IN { //正向“study.com”区域
type master; //类型为主区域
file "study.wang."; //区域数据文件为study.com.wang
allow-transfer { 192.168.200.112; }; //允许使用本DNS服务的网段
};
zone "200.168.192.in-addr.arpa" IN { //反向“192.168.200/24”区域
type master;
file "study.yue";
allow-transfer { 192.168.200.112; };
};
[root@localhost ~]#
[root@localhost ~]# vim /var/named/study.wang
$TTL 1D
@ IN SOA wwwstudy.com. 【授权域名】 admin.study.com. ( 【管理员】 //管理邮箱
20190820 【更新序列号】
3H 【3个小时重复一次】
15M 【15分钟重试】
1W 【坚持一周】
1D 【生命周期1D】
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 【优先级】 mail.study.com.
ns1 IN A 192.168.200.111
ns2 IN A 192.168.200.112
www IN A 192.168.200.113
[root@localhost ~]# vim /var/named/study.yue
$TTL 1D
@ IN SOA study.com. admin.study.com. (
20190820
3H
15M
1W
1D
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 mail.study.com.
111 IN PTR ns1.study.com.
112 IN PTR ns2.study.com.
113 IN PTR www.study.com.
[root@localhost ~]# chown :named /var/named/study.* //改属主关系
[root@localhost ~]# named-checkconf /etc/named.conf //语法检查工具
[root@localhost ~]# named-checkzone study.com /var/named/study.wang
[root@localhost ~]# named-checkzone study.com /var/named/study.yue
[root@localhost ~]# systemctl restart named //重启named文件
===============================================================================
从服务器:
[root@localhost ~]# yum -y install bind
[root@localhost ~]# vim /etc/resolv.conf
# Generated by NetworkManager
nameserver 192.168.200.111
nameserver 192.168.200.112
[root@localhost ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.111 ns1.study.com
192.168.200.112 ns2.study.com
[root@localhost ~]# vim /etc/named.conf
options {
directory "/var/named";
};
zone "study.com" IN {
type slave;
file "slaves/study.wang";
masters { 192.168.200.111; };
};
zone "200.168.192.in-addr.arpa" IN {
type slave;
file "slaves/study.yue";
masters { 192.168.200.111; };
};
[root@localhost ~]# systemctl restart named //重启named文件
5、主从DNS都可将www.study.com域名解析为192.168.200.113
6、客户机可通过浏览器访问www.study.com得到WEB服务器相应内容
7,主域名服务器要同时担任缓存域名服务器功能
[root@localhost ~]# vi /etc/named.conf
options {
listen-on port 53 { 192.168.200.111; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
recursing-file "/var/named/data/named.recursing";
secroots-file "/var/named/data/named.secroots";
allow-query { any; };
recursion yes;
};
zone "." IN {
type hint;
file "named.ca";
};
8、客户机通过nslookup域名测试工具可解析到www.jd.com等网站的域名解析结果