rhel7.9环境搭建

# 创建临时环境
[root@apache ~]# ifconfig eth0 ipv4 172.25.254.200 netmask 255.255.255.0

# 查看版本
[root@localhost ~]# hostnamectl 
   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 380f481f1fef42d7ab5705f1fca7b016
           Boot ID: e88a08eab09c42a4a12bdffc7b81e213
    Virtualization: vmware
  Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:7.9:GA:server
            Kernel: Linux 3.10.0-1160.el7.x86_64
      Architecture: x86-64
# 设置网卡规范名称
[root@apache ~]# grubby --update-kernel ALL --args net.ifnames=0

# 关闭selinux
[root@apache ~]# vim /etc/selinux/config 
[root@apache ~]# setenforce 0
setenforce: SELinux is disabled


# 关闭防火墙
[root@localhost ~]# systemctl disable --now firewalld
[root@localhost ~]# systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.

[root@localhost ~]# mkdir /rhel7
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# mount /dev/cdrom /rhel7/
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# df
文件系统                 1K-块    已用     可用 已用% 挂载点
devtmpfs                914496       0   914496    0% /dev
tmpfs                   931500       0   931500    0% /dev/shm
tmpfs                   931500   10172   921328    2% /run
tmpfs                   931500       0   931500    0% /sys/fs/cgroup
/dev/mapper/rhel-root 16353280 4048412 12304868   25% /
/dev/nvme0n1p1          406180  174884   231296   44% /boot
tmpfs                   186300       0   186300    0% /run/user/0
/dev/sr0               4420474 4420474        0  100% /rhel7


[root@localhost ~]# echo mount /dev/cdrom /rhel7/ >> /etc/rc.d/rc.local 
[root@localhost ~]# chmod +x /etc/rc.d/rc.local 

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
redhat.repo
[root@localhost yum.repos.d]# vim rhel7.repo
[root@localhost yum.repos.d]# cat rhel7.repo 
[rhel7]
name=rhel7
baseurl=file:///rhel7
gpgcheck=0
[root@localhost yum.repos.d]# 

[root@localhost ~]# vim /bin/vmset.sh
[root@localhost ~]# cat /bin/vmset.sh 
#!/bin/bash
rm -fr /etc/sysconfig/network-scripts/ifcfg-$1
cat > /etc/sysconfig/network-scripts/ifcfg-$1 <<EOF
DEVICE=$1
ONBOOT=YES
BOOTPROTO=none
IPADDR=$2
PREFIX=24
GATEWAY=172.25.254.2
DNS1=114.114.114.114
NAME=$1
EOF


nmcli connection reload
nmcli connection up $1

hostnamectl set-hostname $3

cat > /etc/hosts <<EOF
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
$2	$3
EOF



[root@nginx ~]# vmset.sh ens160 172.25.254.200 nginx.timinglee.org
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/6)

[root@nginx ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.25.254.200	nginx.timinglee.org

[root@nginx ~]# history -c
[root@nginx ~]# > ~/.bash_history 
[root@nginx ~]# 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值