Win7安装Vagrant

前言

原本以为Vagrant安装很容易,没想到整了大半天。网上看到的文章比较旧了,整理一篇新一些的,希望对像我一样遇到问题的人有所帮助。

安装Virtualbox

去VB官方网站下载VirtualBox的Windows安装包。一路Next就OK了。VirtualBox的硬件加速很重要,Windows 7 默认是关闭VT-x(Intel芯片),需要去BIOS里开启。

安装Vagrant

去Vagrant官网下载Windows下的安装包,同样是一路Next,安装完毕后需要重启,正好借此机会去BIOS里查看下是否开启了虚拟化技术。

添加路径到Path

有两个路径要手动添加:

  1. Virtualbox的运行程序路径,Vagrant脚本运行Virtualbox和VBoxManager的时候需要。
  2. ssh.exe程序所在路径,ssh.exe在安装git的时候会一起安装,如果还没有安装git,需要下载安装git

添加Box

虽然可以网络方式安装Box,但是,天朝的情况也是知道的,因此,保险起见,下载下来先。下载地址:http://www.vagrantbox.es/

下载完毕,假设把镜像存在d:\boxes下,运行命令:

vagrant box add trusty64 d:\boxes\trusty-server-cloudimg-amd64-vagrant-disk1.box

其中,trusty64是盒子在vagrant管理的盒子列表中的名字,后面跟的路径是盒子文件所在的路径。正常情况下,可以看到如下输出:

==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'trusty64' (v0) for provider:
    box: Unpacking necessary files from: file://d:/boxes/trusty-server-cloudi
mg-amd64-vagrant-disk1.box
    box: Progress: 100% (Rate: 19.0M/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'trusty64' (v0) for 'virtualbox'!

初始化工作区

工作区可以理解为项目在本机的代码,Vagrant会将这个代码挂载到启动的虚拟机的相应目录下,这就实现了,在本机编码,而代码在虚拟机里运行的方法,不再需要ftp或者别的方式去反复部署代码。假设工作区是d:\va, 在命令行下切换到这个目录,然后执行vagrant init trusty64, 其中trusty64就是在上一步创建的盒子名称,该命令就是使用trusty64盒子初始化当前目录为vagrant的工作区。命令执行成功,会输出如下信息:

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

在当前目录下,会有一个Vagrantfile文件。

运行

万事具备,可以运行一个实例了。使用命令 Vagrant up,正常情况下,会有如下输出:

D:\va>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: va_default_1456111656613_62745
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default:
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default:
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version o
f
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you
 see
    default: shared folder errors, please make sure the guest additions within t
he
    default: virtual machine match the version of VirtualBox you have installed
on
    default: your host and reload your VM.
    default:
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.0
==> default: Mounting shared folders...
    default: /vagrant => D:/va

管理虚拟机实例

以下几个命令,用来管理vagrant启动的虚拟机。

  1. 列出当前虚拟机状态:vagrant status
  2. 关闭当前虚拟机: vagrant halt
  3. 暂停当前虚拟机:vagrant suspend
  4. 重器,以使配置文件的更新生效: vagrant reload

错误排查

按照上述步骤,应该能一次搞定,如果还是遇到了问题,请先查看博文:http://my.oschina.net/u/248080/blog/618060

登陆虚拟机

安装完毕,运行起来后,总不能什么都不安装配置吧。势必需要ssh登陆。用Windows自带命令行也是可以的,执行vagrant ssh就可以了。

putty

如果习惯用putty,那需要先把Vagrant自带的key给转化成putty需要的格式:

  1. 运行puttygen.exe,Conversions菜单>>Import key
  2. Vagrant生成的私钥在工作区目录下的.vagrant\machines\default\virtualbox\private_key
  3. 导入这个私钥到puttygen里,点Save private key,转存成ppk格式。
  4. 启动putty.exe,在Connection>>SSH>>Auth里的选择刚刚生成的ppk文件
  5. Host为127.0.0.1,端口是2222,点Open
  6. ssh的用户名是vagrant
Secure Shell Client

如果习惯用Secure Shell Client,通过如下步骤添加一个公钥:

  1. 启动Secure Shell Client
  2. 进入Edit>>Settings>>Global Settings>>User Authentication>>Keys
  3. 点Generate New按钮,生成一个RSA 2048加密的密钥对。
  4. 生成完毕,点export导出。
  5. 再次用puttygen导入刚刚导出的私钥文件,复制文本框里的公钥字符串,粘贴到虚拟机的.ssh/authorized_keys文件里
  6. 同样的方法,用127.0.0.1,端口2222,用户名vagrant登陆。

转载于:https://my.oschina.net/u/248080/blog/618518

要成功地进行Xilinx Zynq-7000 SoC的集成开发,你将需要熟悉TLZ7xH-EVM开发板的硬件特性以及相应的软件编程。在此,我们推荐参考以下资源《创龙TLZ7xH-EVM开发板:Xilinx Zynq-7000双核Cortex-A9+Kintex-7》,这将为你的项目提供详尽的支持。 参考资源链接:[创龙TLZ7xH-EVM开发板:Xilinx Zynq-7000双核Cortex-A9+Kintex-7](https://wenku.youkuaiyun.com/doc/80nyorov3y) 首先,在硬件编程方面,你需要了解开发板的硬件架构和资源。TLZ7xH-EVM开发板集成了双核ARM Cortex-A9处理器和Kintex-7 FPGA。你应该首先阅读Zynq-7000开发板规格书,了解各个硬件接口和信号引脚的详细信息。根据你的项目需求,进行硬件资源配置,包括配置处理器的时钟频率、电源管理、存储接口以及外设接口等。 其次,在软件编程方面,Xilinx提供了Vivado和SDK套件,用于硬件逻辑设计和软件应用开发。在Vivado中,你需要完成硬件平台的设计和生成,包括创建项目、综合、实现和生成比特流文件。完成硬件设计后,你可以通过Xilinx SDK进行软件编程,创建应用程序和驱动,以与硬件平台交互。编写代码时,你需要参考开发板提供的Demo程序,这些示例程序展示了如何加载和运行用户代码。 确保你具备相关的硬件编程经验,以及掌握至少一种用于嵌入式开发的编程语言,如C/C++。在软件开发过程中,你还需要了解操作系统的选择和配置,比如使用PetaLinux等。 集成开发成功的关键在于硬件和软件的紧密配合,这通常需要进行多次迭代和调试。使用TLZ7xH-EVM开发板上的调试接口,比如JTAG和串口,进行代码调试和性能分析。 在开发过程中,不妨利用创龙科技提供的技术支持和服务,及时解决开发中遇到的问题。此外,你可以利用公司提供的增值服务平台,如定制化开发、培训等,进一步提升开发效率和产品品。 综上所述,通过阅读相关规格书,使用Vivado和SDK进行硬件设计和软件编程,结合创龙科技的技术支持,你将能够高效地完成Zynq-7000 SoC的集成开发任务。对于那些希望深入学习和探索更多高级功能和技巧的读者,我们再次推荐《创龙TLZ7xH-EVM开发板:Xilinx Zynq-7000双核Cortex-A9+Kintex-7》,这份资料不仅帮助你入门,还将引导你掌握更深层次的知识。 参考资源链接:[创龙TLZ7xH-EVM开发板:Xilinx Zynq-7000双核Cortex-A9+Kintex-7](https://wenku.youkuaiyun.com/doc/80nyorov3y)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值