rh254复习
来源:互联网 发布:讨鬼传2捏脸数据女 编辑:程序博客网 时间:2024/06/06 07:00
server:
ip=172.25.x.10,gateway=172.25.x.254,dns1=172.25.254.254
desktop:
ip=172.25.x.11,gateway=172.25.x.254,dns1=172.25.254.254
desktop 与 server 主机防火墙开启;
desktop 与 server 主机 selinux=enforcing;
desktop 和 server 的 yum 源为 http://172.25.254.254/rhel7.0/x86_64/dvd
确保以下操作在 desktop 和 server 主机重启后依然生效;
#1. server 主机配置 mariadb 服务如下:
- 该服务阻断所有来自网络的 tcp/ip 连接,仅支持本地连接;
- 给数据库设置密码 fentiao ;
- 新建数据库 westosinfo ,该数据库中创建表 hostinfo ;
- hostinfo 表包含的字段为 ip 和 hostname ,表中插入 3 条记录(自己随便写);
- 创建用户 redhat 对 westosinfo 数据库的所有表只能查看不能修改;
- redhat 用户的认证密码为 redhat
#2. 配置链路聚合:
- 在 desktop 与 server 主机配置一链路,此链路使用 eth1 和 eth2;
- 此链路在一个接口失效时仍能正常工作;
- 此链路 serverx 使用 ipv6 地址 2014:ac18::10a/64;
- 此链路 desktopx 使用 ipv6 地址 2014:ac18::11b/64;
- 此链路在系统重启之后仍然保持正常状态;
#3. server 主机配置 dns 服务如下:
- server 主机搭建的 dns 管理的域为"westos.org";
- 根据下面 ip 与域名的对应关系实现正向解析和反向解析:
desktopx.westos.org 172.25.x.10
serverx.westos.org 172.25.x.11
desktop 主机可执行命令 dig serverx.westos.org @172.25.x.11; //根据域名解析到对
应的 ip
dig -x 172.25.0.11 @172.25.0.11 //根据 ip 反解析到对应的域名
#4. server 主机配置 web 服务如下:
- 下载 http://172.25.254.254/materials/station.html 到 apache 默认发布目录并重命名为
index.html,
确保 http://serverx.example.com 可访问,日志位置在 logs/default-vhost.log ,日志格
式为 combined;
- 拓展 web 主机站点 http://wwwx.example.com 创建一虚拟主机,确保设定默认
发布目录为 /var/virtual ,访问内容为 "wwwx.example.com" ,日志存储在
logs/wwwX.example.com.log ,日志格式为 combined;
- 在默认发布目录下创建一个名为 admin 的目录,访问该目录的页面内容为
admin page ,实现 apache 基于用户认证功能的实现,只有 admin 用户可通过
密码 fentiao 登陆浏览页面内容;
- 实现动态 web 内容,动态内容下载地址为 http://172.25.254.254/materials/script.wsgi,
虚拟主机监听端口:8989,desktop 主机访问 http://wsgi.example.com:8989 可看动态
网页;
#5. server 主机配置 iSCSI 服务:
- 在 vdb 磁盘上分一个 2G 大小的 LVM 分区,用以创建逻辑卷组
iSCSI_vg 和一个 1G 大小的逻辑卷 disk1_lv;
- 使用 disk1_lv 作为 iSCSI 的后端存储名称为 serverX.disk1;
- 定义 IQN 为 iqn.2017-06.com.example:serverX;
- 设置 ACL 允许 initiator name 为 iqn.2017-06.com.example:desktopX
的客户端可以连接。程序监听 172.25.X.11 的 3260 端口;
desktopX 安装客户端程序,连接 serverX 的 iSCSI 目标资源到本地,用以创建一个
xfs 文件系统,并开机自动挂载到 /iscsidisk.
拓展:扩展共享的设备到 1.5G
#6. 配 SMB 服务:
- 创建共享目录为 /smbshare ,共享名为 smbshare ,工作组为 WESTOS ,
marketing 组成员可以读写此共享,不属于 marketing 组的人只能读。
- 创建 samba-only 用户 brian 和 rob ,其中 brian 用户属于
marketing 组,用户密码都是 westos 。
- 在 desktopX 上建立挂载点 /mnt/multiuser 目录,开机自动挂载
serverX 上的 smbshare 共享,激活 smb 多用户挂载支持。
#7. 配置 nfs 服务:
- serverx 主机共享本地目录/nfsshare;
- desktopX 可以读写访问此共享,并且开机自动挂载到 /mnt/nfsshare 目录上;
#8. 在 serverX 和 desktopX 配置 postfix 服务:
- 设置服务开机自启,防护墙允许此服务。
- 将 serverX 配置为邮件空客户端,只监听本地回环接口,只允
许 127.0.0.0/8 这个网段转发邮件,从 serverX 上发出的邮件域
名都被重写为 desktopX.example.com ,所有邮件都被转发到
smtpX.example.com 主机( DNS 上已有 MX 记录,指向 desktopX ),
本地不存储邮件。
- desktopX 可以接收来自 serverX 的邮件。
答案
1.
yum install mariadb-server -y
systemctl start mariadbsystemctl enable mariadb
vim /etc/my.cnf
skip-networking=1
mysql_secure_installation
mysql -uroot -pfentiao
create database westosinfo;
use westosinfo;
create table hostinfo(
ip varchar(15) not null,
hostname varchar(15) not null
);
insert into hostinfo values('user1','123');
insert into hostinfo values('user2','123');
insert into hostinfo values('user3','123');
mysql -uroot -pfentiao
create user redhat@localhost identified by 'redhat';
grant select on westosinfo.* to redhat@localhost;
2.
nmcli connection add con-name team0 ifname team0 type team config '{"runner":{"name":"activebackup"}}' ip6 2:ac2:;10a/64
nmcli connection add con-name eth1 ifname eth1 type team-slave master team0
nmcli connection add con-name eth2 ifname eth2 type team-slave master team0
3.
yum install bind -y
vim /etc/namd.conf
cd /var/named
cp -p named.localhost westos.org.zone
vim westos.org.zone
N SOA dns.westos.org. root.westos.org. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westos.org.
dns A 172.25.2.11
desktop2 A 172.25.2.10
server2 A 172.25.2.11
vim /etc/named.rfc1912.zones
zone "westos.org" IN {
type master;
file "westos.org.zone";
allow-update { none;};
};
cp -p named.loopback westos.org.ptr
vim westos.org.ptr
$TTL 1D
@ IN SOA dns.westos.org. root.westos.org. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.westos.org
dns A 172.25.2.10
10 PTR desktop2.westos.org
11 PTR server2.westos.org
vim /etc/named.rfc1912.zones
zone "2.25.172.in-addr.arpa" IN {
type master;
file "westos.org.ptr";
allow-update { none;};
};
systemctl restart named
firewall-cmd --permanent --add-service=dns
firewall-cmd --reload
测试端
vim /etc/resolv.conf
nameserver 172.25.2.10
dig server2.westos.org @172.25.2.11
dig -x 172.25.2.11 @172.25.2.10
4.
yum install httpd lftp -y
systemctl start httpd
systemctl enable httpd
weget http://172.25.254.254/materials/station.html
mv station.html /var/www/html/index.html
vim /etc/httpd/conf.d/vhost.conf
<Virtualhost _default_:80>
DocumentRoot "/var/www/html"
ServerName server2.example.com
Cusomlog "logs/default-vhost.log" combinded
</Virtualhost>
<Virtualhost *:80>
ServerName "www2.example.com"
DocumentRoot "/var/virtual"
Customlog "logs/www2.example.com.log" combined
</Virtualhost>
<Directory "/var/virtual">
Require all granted
</Directory>
<Directory "/var/www/html/admin">
AuthUserfile "/etc/httpd/passwd"
AuthName "show passwd add username
AuthType basic
Require user admin
</Directory>
<VirtualHost *:8989>
WSGIScriptAlias / /var/www/cgi-bin/script.wsgi
ServerName wsgi.example.com
</VirtualHost>
Listen 8989
mkdir /var/virtual
semanage fcontext -a -t httpd_sys_content_t '/var/virtual(/.*)?'
restorecon RvvF /var/virtual
echo www2.example.com > /var/virtual/index.html
mkdir /var/www/html/admin
echo 'admin page' > /var/www/html/admin/index.conf
htpasswd -cm /etc/httpd/passwd admin
yum install mod_wsgi.x86_64 -y
cd /var/www/cgi-bin
wget http://172.25.254.254/materials/scripts.wsgi
systemctl restart httpd
测试主机
vim /etc/hosts
172.25.2.11 server2.example.com www2.example.com wsgi.example.com
访问页面测试
5.
server2主机:
fdisk /dev/vdb
partprobe
pvcreate /dev/vdb1
vgcreate iSCSI_vg /dev/vdb1
lvcreate -L 1G -n disk1_lv iSCSI_vg
yum install target -y
systemctl enable target
systemctl start target
firewall-cmd --permanent --add-port=3260/tcp
firewall-cmd --reload
targetcli
/bachstores/block create server2.disk1 /dev/iSCSI_vg/disk1_lv
/iscsi create iqn.2017-06.com.example:server2
/iscsi/iqn.2017-06.com.example:server2/tpg1/luns create /backstores/block/server2.disk1
/iscsi/iqn.2017-06.com.example:server2/tpg1/acls create iqn.2017-06.com.example:desktop2
/iscsi/iqn.2017-06.com.example:server2/tpg1/portals create 172.25.2.11
clearconfig confirm=True
lvextend -L 1.5G /dev/iSCSI_vg/disk1_lv
desktop2主机:
vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2017-06.com.example:desktop2
iscsiadm -m discovery -t st -p 172.25.2.11
iscsiadm -m node -T iqn.2017-06.com.example:stragel -p 172.25.2.11 -l
fdisk /dev/sda
partprobe
mkfs.xfs /dev/sda1
mount /deb/sda1 /mnt
vim /etc/fstab
UUID=" " /mnt xfs defatults,_netdev 0 0
6.在server2主机:
yum install samba samba-common samba-client -y
systemctl start smb nmb
systemctl enable smb nmb
firewall-cmd --permanent --add-service=samba
firewall-cmd --permanent --add-service=samba-client
firewall-cmd --reload
groupadd marketing
useradd -s /sbin/nologin -G marketing brian
useradd -s /sbin/nologin rob
smbpasswd -a brian
smbpasswd -a rob
mkdir /smbshare
semanage fcontext -a -t samba_share_t '/smbshare(/.*)?'
restorecon -RvvF
chmod +w /smbshare
vim /etc/samba/smb.conf
[smbshare]
path = /smbshare
comment localshare
workgroup =WESTOS
write list = +marketing
在desktop2主机:
vim /root/hello
username=brian
password=westos
chmod 600 /root/hello
yum install cifs-utils -y
mkdir /mnt/multiuser
vim /etc/rc.d/rc.local
mount -o credentials=/root/hello,multiuser,sec=ntlmssp //172.25.2.11/smbshare /mnt/multiuser
7.服务端:
yum install nfs-untils -y
systemctl enable nfs-server
systemctl start nfs-server
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=mountd
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --reload
mkdir /nfsshare
chmod 777 /nfsshare
vim /etc/exports
/nfsshare 172.25.2.10(rw,sync)
exportfs -rv
测试端:
mkdir /mnt/nfsshare
vim /etc/fstab
172.25.2.11:/nfsshare /mnt/nfsshare nfs defaults 0 0
mount -a
8.服务端:
firewall-cmd --permanent --add-service=smtp
firewall-cmd --reload
vim /etc/postfix/main.cf
76 myhostname = server2.example.com
86 mydomain = example.com
99 myorigin =desktop2.example.com
116 inet_interfaces = all
164 mydestination = $myhostname, $mydomain, localhost
264 mynetworks =127.0.0.0/8
316 relayhost = 172.25.2.10
systemctl restart postfix.service
测试端:
vim /etc/postfix/main.cf
76 myhostname = desktop2.example.com
86 mydomain = example.com
99 myorigin =desktop2.example.com
116 inet_interfaces = all
164 mydestination = $myhostname, $mydomain, localhost
mail root
- rh254复习
- rh254复习题
- RH254测试
- Linux--RH254---unit4 postfix2
- Linux--RH254---PXE
- Linux--RH254---rh254exam
- Linux--RH254---脚本作业
- Linux--RH254---unit4 postfix电子邮件
- Linux--RH254---unit 10 iptables
- Linux--RH254---unit 10 firewalld
- Linux--RH254---unit 7 Samba
- Linux---RH254---unit 6 NFS
- Linux--RH254---unit 5 ISCSI
- Linux--RH254---uint 11 Bash
- Linux--RH254---unit 3 高速缓存DNS
- Linux--RH254---unit 8 mariadb数据库
- Linux--RH254---unit 2 高级网络配置
- Linux--RH254---unit 9 apache web服务
- 分享快乐-查询或删除表中的重复数据
- EasyDarwin如何支持点播和RTMP/HLS直播?EasyDSS!
- 安卓RecyclerView的用法
- AsyncTask的一些小细节
- Python中元组,列表,字典的区别
- rh254复习
- 不同的二叉树查找II
- 选择排序算法
- 关于Android的面试题目汇总
- Tomcat Ajax跨域访问
- 找不到arm-none-linux-gnueadi-gcc
- Java设计模式之创建型模式--建造者模式
- vuejs第二天1
- spring的面试题库