1. 程式人生 > 實用技巧 >vmware新裝虛擬機器基礎配置

vmware新裝虛擬機器基礎配置

最小化完成虛擬機器安裝過程

登陸伺服器之後需要需要做的一些基礎配置如下:

一:配置yum源-採用本地yum源方式

# 使用命令ip a 檢視Ip地址,使用遠端連線工具連線到虛擬機器
# 如果沒有Ip 使用dhclinet 命令獲取Ip地址
[root@localhost ~]# ip a | grep inet

# rhel7的yum源配置方式:

# rhel8的yum源配置方式:
# 使用mount命令掛載磁碟,如果掛載提示如下,則檢查虛擬機器的光碟掛載情況
mount: /mnt: no medium found on /dev/sr0.

[root@localhost ~]# mount /dev/cdrom /mnt                                                     # 將磁碟掛載到/mnt目錄中
mount: /mnt: WARNING: device write-protected, mounted read-only.            # 提示這個則掛載成功
# 編寫yum源的配置檔案
cat <<EOF>>  /etc/yum.repos.d/rhel8-2.repo
[BaseOS]
baseurl=file:///mnt/BaseOS/
enable=1
gpgcheck=0

[AppStream]
baseurl=file:////mnt/AppStream/
enable=1
gpgcheck=0
EOF

[root@localhost yum.repos.d]# yum repolist                                          # 檢視yum源是否配置成功
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repository 'BaseOS' is missing name in configuration, using id.
Repository 'AppStream' is missing name in configuration, using id.
repo id                                                                         repo name
AppStream                                                                       AppStream
BaseOS                                                                          BaseOS

二:安裝基礎軟體包

[root@localhost ~]# yum -y install bash-completion                                # 安裝bash-completion工具,可以使用tab鍵補全命令
[root@localhost ~]# yum -y install vim                                                      # 習慣使用vim的命令,所以安裝vim包
[root@localhost ~]# yum -y install net-tools                                                # 安裝net-tools工具,支援netstat命令
[root@localhost ~]# rpm -ql net-tools | grep sbin                                    # 檢視安裝net-tools所產生的命令
/usr/sbin/arp
/usr/sbin/ether-wake
/usr/sbin/ifconfig
/usr/sbin/ipmaddr
/usr/sbin/iptunnel
/usr/sbin/mii-diag
/usr/sbin/mii-tool
/usr/sbin/nameif
/usr/sbin/plipconfig
/usr/sbin/route
/usr/sbin/slattach

三:調整防火牆策略

此配置用於學習實驗環境配置,將防火牆以及selinux進行關閉

[root@localhost ~]# systemctl disable firewalld.service
[root@localhost ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=permissive            #此引數關閉
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

自此基本的使用配置已經完成,有操作習慣的包也安裝上