美文网首页
2020-05-21 虚拟机与宿主机环境

2020-05-21 虚拟机与宿主机环境

作者: 勇者与王者 | 来源:发表于2020-05-21 21:56 被阅读0次

    虚拟机配置与本机(宿主机)互通 且能上百度
    环境:vmware workstation 15
    centos 7.5
    虚拟机设置中网络适配器选择NAT 模式
    其次 ipconfig 查看本机的ip 确保 VMnet8 的ip与本机 物理网卡的ip在同一网段,且网关相同
    进入vmware - 编辑- 虚拟网络编辑器,上方列表选择Vmnet8
    修改最下方子网ip与 VMnet8为同网段,
    然后点击 NAT设置 网关ip改为 与 VMnet8里的网关一致
    最后修改 centos中网卡配置文件:/etc/sysconfig/network-script/ifcfg-ens33
    BOOTPROTO=none
    ONBOOT="yes"
    IPADDR=与Vmnet8同网段
    NETMASK也一致
    GATEWAY一致
    DNS1=VMnet8网关(这一步不确定)
    DNS2=114.114.114.114
    然后重启:/etc/init.d/network restart
    最后在宿主机中ping 虚拟机 在虚拟机中ping 宿主机 和baidu 都ok

    yum安装 出现
    The GPG keys listed for the "CentOS-7 - Base - mirrors.aliyun.com" repository are already installed but they are not correct for this package.
    Check that the correct key URLs are configured for this repository.

    解决办法:
    在后面加 --nogpgcheck 即可

    本机访问虚拟机中ngninx
    firewall-cmd --zone=public --add-port=80/tcp --permanent
    systemctl stop firewalld.service
    systemctl start firewalld.service

    安装php:--with-pdo-mysql 这个需要为 mysqld 的实际路径 which mysqld 查找
    ./configure --prefix=/usr/local/lib/php --with-mysql=/usr/local/lib/mysql --with-pdo-mysql=/usr/local/lib/mysql/bin/mysqld --with-iconv-dir=/usr/local/libiconv-1.14 --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp

    相关文章

      网友评论

          本文标题:2020-05-21 虚拟机与宿主机环境

          本文链接:https://www.haomeiwen.com/subject/wsrxahtx.html