RHCE第二次

1、配置ssh免密登陆:客户端主机通过redhat用户基于秘钥验证方式进行远程连接服务器的root用户。

[root@localhost ~]# systemctl status firewalld
  firewalld.service - firewalld - dynamic firewall daemon
     Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: >
     Active: inactive (dead)
       Docs: man:firewalld(1)

[root@localhost ~]# getenforce

Permissive

[root@localhost ~]# systemctl restart sshd

[redhat@localhost ~]$ ssh-keygen -t rsa   
Generating public/private rsa key pair.
Enter file in which to save the key (/home/redhat/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/redhat/.ssh/id_rsa
Your public key has been saved in /home/redhat/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:YtHvnY56SZBoXUGwgs60MT6P0qs9n7SpugjDd7sr41E redhat@localhost.localdomain
The key's randomart image is:
+---[RSA 3072]----+
|        .oo.     |
|     . . ..      |
|    = oooo       |
|   = +oo+.       |
|    *Eo S..      |
|.  ..= . ... .   |
|o..oo.o  ...o    |
|.o.=+o.+  oo     |
|. ==*BB .o. .    |
+----[SHA256]-----+

[redhat@localhost ~]# ssh-copy-id root@192.168.116.128

[redhat@localhost ~]$ ssh root@192.168.116.128

2、综合练习:请给openlab搭建web网站

网站需求: 1.基于域名www.openlab.com可以访问网站内容为 welcome to openlab!!!

[root@localhost ~]# vim /etc/httpd/conf.d/vhosts.conf 

<Virtualhost 192.168.101.200:80>           
        DocumentRoot  /www/openlab        
        ServerName www.openlab.com      
</VirtualHost>

<Directory /www>
        AllowOverride none                          
        Require all granted                           
</Directory>

[root@localhost ~]# vim /etc/hosts
192.168.101.200  www.openlab.com

[root@localhost ~]# mkdir -p /www/openlab

[root@localhost ~]# echo 'welcome to openlab!!!' > /www/openlab/index.html

[root@localhost ~]# systemctl restart httpd

[root@localhost ~]# setenforce 0

[root@localhost ~]# curl www.openlab.com

welcome to openlab!!!
 

2.给该公司创建三个子界面分别显示学生信息,教学资料和缴费网站,基于www.openlab.com/student 网站访问学生信息,www.openlab.com/data网站访问教学资料,www.openlab.com/money网站访问缴费网站。

[root@localhost ~]# vim /etc/httpd/conf.d/vshots.conf

<VirtualHost 192.168.101.200:80>
        DocumentRoot  /www/openlab
</VirtualHost>

[root@localhost ~]# systemctl restart httpd

[root@localhost ~]# mkdir /www/openlab/data

[root@localhost ~]# echo 'this is openlab data' > /www/openlab/data/index.html

[root@localhost ~]# curl www.openlab.com/data/
this is openlab data

配置dns服务的正向解析

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值