zoukankan      html  css  js  c++  java
  • Fedora-23 installation in VM image

    Steps to install Fedora-23 in VM image

    Target:on the VM image, we can make gcc32bit and gcc64bit build.

    Set up a bridge on host

    We need set up a bridge on the interface which connect to internet, then attach a tap device(VM) to the bridge, so that VM can connect to internet to download software and package.

    How to set up bridge

    Create virtual machine and install OS

    1. Download OS version (*.iso file) from website. For some, you can get from: http://linux-ftp.jf..com/pub/mirrors. For others, you need to get from its official website.


    2. Use WinSCP to copy the *.iso file to host. I put the iso to /home/img/


    3. Allocate memory for VM image

    qemu-img create –f qcow2 f23.img 20G
    

    (The current directory is /home/osimg/)

    4. Install guest OS from ISO to VM image using qemu

    qemu-system-x86_64 -enable-kvm -m 2048 -cdrom /home/img/Fedora-Server-DVD-x86_64-23.iso -boot d -drive file=/home/osimg/f23.img  
    -vnc :10 -daemonize
    

    5. Open Xming, install OS from vncviewer.

    vncviewer :10
    

    Select the default step by step for the OS installation. Then reboot. If it leads you to reinstall the OS, kill the procedure

    ps -ef |grep qemu
    kill -9 <the number of the procedure>
    

    Set VM

    1. Edit a script file to start VM.

    vim f23-start.sh
    

    Add a tap to connect the VM and internet

    #!/bin/sh
    qemu-system-x86_64 
    -mem-path /mnt/huge -mem-prealloc 
    -enable-kvm -m 2048 -smp cores=2,sockets=1 -cpu host -name dpdk1-f23 
    -drive file=/home/osimg/f23.img 
    -netdev tap,id=ipvm1,ifname=tap3,script=/etc/qemu-ifup -device rtl8139,netdev=ipvm1,id=net0,mac=00:00:00:00:00:01 
    -localtime -vnc :10 –daemonize
    

    2. Add execute permission and run the script

    chmod +x f23-start.sh
    ./f23-start.sh
    

    3. Login the VM with VNC, check the IP address

    vncviewer :10
    ifconfig
    

    3.1 When you get the IP address you can access to VM by SSH

    Note: Fedora20 and before versions are graphical interface, if you want to get IP address, you need operate as follows:

    Activities --> Type to search(input “IP”) --> Network

    Then you can see the IP address.


    3.2 Allocate an IP address manually If there is not IP address allocated automatically, you can assign a IP address manually.

    dhclient
    

    If there is still not IP address allocated, you must set the IP address/netmask and gateway:

    ifconfig ethx 0.0.0.0 netmask 255.255.255.0
    route add default gw 0.0.0.1<code>
    
    


    4. When the VM has IP but can’t be connected, the reason may be firewall and proxy

    Close the firewall:

    <code>systemctl disable firewalld.service
    systemctl stop firewalld.service
    

    5. Optional settings


    5.1 Set hostname

    nmcli general hostname stv-vm-f23.sh.intel.com
    

    Then check the hostname

    [root@localhost ~]# hostname
    stv-vm-f23.sh.intel.com
    

    Note: The command can work only on fedora21/22/23. On fedora20 and before you must configure hostname by ifcfg file.


    5.2 Check the status of ssh

    systemctl show sshd
    

    You can see the following information:

    Description=OpenSSH server daemon
    LoadState=loaded
    ActiveState=active
    SubState=running
    UnitFileState=enabled
    

    It means no need to do extra operations.

    Else, you may install and enable ssh manully.

    yum install openssh
    systemctl enable sshd.service
    systemctl restart sshd.service
    
  • 相关阅读:
    PHP 支付类库, cURL开源HTTP类库
    sublime text3 批量查找替换文件夹或项目中的字符
    php 腾讯云 对象存储V5版本 获取返回的上传文件的链接方法
    Redis Desktop Manager 利用ssh连接 Redis
    一键PHP/JAVA安装工具 OneinStack
    函数之局部变量和使用global语句
    函数之定义形参
    函数之定义函数
    大数据入门第二十天——scala入门(二)scala基础02
    大数据入门第二十天——scala入门(二)scala基础01
  • 原文地址:https://www.cnblogs.com/lusix/p/9186177.html
Copyright © 2011-2022 走看看