<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                環境: Docker Vagrant https://xueyuanjun.com/post/354.html Laragon https://xueyuanjun.com/post/9609 參考文章: [https://www.cnblogs.com/hafiz/p/9175484.html](https://www.cnblogs.com/hafiz/p/9175484.html) [https://segmentfault.com/a/1190000000264347](https://segmentfault.com/a/1190000000264347) https://blog.csdn.net/qq_38962739/article/details/103517520 安裝和使用 [https://blog.csdn.net/woqianduo/article/details/81091154](https://blog.csdn.net/woqianduo/article/details/81091154) [TOC] ### 原理 vagrant介紹 vagrant是一個基于Ruby的工具,用于創建和部署虛擬化開發環境。使用Oracle的開源virtualBox虛擬化系統,使用Chef創建自動化虛擬環境。同時,vagrant也支持其他類型的虛擬機系統,如:vmware、kvm、qemu,甚至是容器系統,如docker等,當然,用的比較多的還是virtralBox。 &nbsp; &nbsp; vagrant與virtualBox原理 這里我們簡述一下vagrant與virtualBox的原理,virtualBox(本身也可以創建虛擬機,只是相對麻煩)會開放一個創建虛擬機的接口,Vagrant會利用這個接口創建虛擬機,并且通過Vagrant來管理,配置和自動安裝虛擬機。 &nbsp; &nbsp; 使用Vagrant來創建虛擬機 前提,首先確保本機已經安裝好兩者。 新建一個空文件夾:mkdir centos7 ,并進入該文件夾:cd centos7/ 在該目錄下初始化一個創建centos7的Vagrantfile文件,執行命令:vagrant init centos/7 創建centos7虛擬機,執行命令:vagrant up,如果本地有base box,會使用本地的,否則將會從網絡中下載,此過程可能偏久,會生成名字為如下圖所示的虛擬機: 接下來,我們將在virtualBox中看到剛剛創建的虛擬機: 注:在vagrant中box概念,是一個打包的單一文件,其中包含了一個完整系統的虛擬機相關數據。 vagrant的基本使用 執行命令:vagrant ssh ,就會通過ssh連接至剛剛我們所創建的虛擬機 如果需要退出當前連接,執行命令:exit,將會回到本地目錄 查看虛擬機狀態,在本地目錄里執行命令:vagrant status 停掉虛擬機,執行命令:vagrant halt 開啟虛擬機,執行命令:vagrant up 刪除虛擬機:vagrant destroy 查看目前已有的box:vagrant box list 新增加一個box:vagrant box add 刪除指定box:vagrant box remove 重啟虛擬機:vagrant reload &nbsp; &nbsp; ### 一、準備工作 準備以下軟件: 1.virtualbox [https://www.virtualbox.org/wiki/Downloads](https://www.virtualbox.org/wiki/Downloads) 2.vagrant [https://www.vagrantup.com/downloads.html](https://www.vagrantup.com/downloads.html) 3.git【包含gitbash】 4.已開啟vt-x【硬件虛擬化加速】 首先確認自己的CPU支持虛擬化,可以拿CPU型號去對應的廠商官網去查 重啟開機按F2或者Del進入BIOS界面。 `如果是華碩主板EZmode模式,選擇=》高級=》cpu選項,拉到最底部,選擇開啟intel虛擬化` `如果是一般的BIOS 參見:https://blog.csdn.net/sunrise_zhu/article/details/78889793 重啟后進入startup menu,選擇Computer Setup(F10) 菜單欄中選擇Security —> System Security Virtualization technology(VTx) 設置為enable` 5.準備好要安裝的box 官網下載鏈接:https://app.vagrantup.com/laravel/boxes/homestead/versions/8.2.1/providers/virtualbox.box 網盤下載鏈接:https://pan.baidu.com/s/1oj9g9nAORLswYSvKrhOIaA 密碼 kvf4 &nbsp; &nbsp; ### 二、安裝各種軟件和插件 安裝 vagrant 安裝 vagrant的插件來支持nfs文件共享 vagrant plugin install vagrant-winnfsd --plugin-clean-sources --plugin-source https://gems.ruby-china.com/ &nbsp; &nbsp; ### 三、安裝box【這里以官方box里的centos7為例】 找一個盤,這里是F盤,創建目錄vagrantBox/{box名稱} 這里是vagrantBox/centos7,即F:\vagrantBox\centos7 在centos7目錄下,右擊gitbash,打開bash命令行界面,進行box初始化 ``` $ vagrant init centos7 #執行完會生成一個vagrant啟動虛擬機的配置文件 Vagrantfile ``` 然后將box導入vagrant ``` $ vagrant box add centos7 {已下載好的centos7的box文件路徑,可以放到F:\vagrantBox\centos7目錄下,則只需要填文件名} $ vagrant box list centos7 (virtualbox, 0) $ vagrant up #這里會出現無法掛載共享目錄的提示,可以通過安裝 vagrant插件解決 vagrant plugin install vagrant-vbguest --plugin-clean-sources --plugin-source https://gems.ruby-china.com/ # 1.成功后再執行啟動命令 vagrant up # 2.有可能用啟動命令進行下載會比較慢【不知為何】,可以先vagrant halt 關閉box,打開Oracle VM VirtualBox,手動雙擊打開box, #使用默認的帳號密碼 user:root password:vagrant 進行登錄,并使用yum update 進行更新 再vagrant halt 并重新vagrant up,最終就快了很多 #這樣會下載安裝一些軟件依賴, 最終Copy iso file E:\virtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso并完成安裝和掛載 ``` 以下為我的啟動配置文件項 ``` # -*- mode: ruby -*- # vi: set ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Please don't change it unless you know what # you're doing. Vagrant.configure("2") do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. config.vm.box = "centos7" #ssh賬戶和密碼,默認都為vagrant,注意root權限密碼也是vagrant config.ssh.username = "vagrant" config.ssh.password = "vagrant" #開啟下面的配置 #網絡三種模式之一:較為常用是端口映射,就是將虛擬機中的端口映射到宿主機對應的端口直接使用 #guest: 80 表示虛擬機中的80端口, host: 8080 表示映射到宿主機的8080端口。 config.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", disabled: "true" config.vm.network "forwarded_port", guest: 80, host: 80 config.vm.network "forwarded_port", guest: 15672, host: 15672 config.vm.network "forwarded_port", guest: 22, host: 2221 #配置共享目錄 #原理是window共享目錄的內容,都會時時同步到虛擬機上 #"E:/phpstudy_pro/WWW":代表window路徑 ,SVN代碼checkout這里的 #"/home/www":代表linux路徑,會將window 中項目同步到這里 config.vm.synced_folder "E:/phpstudy_pro/WWW", "/home/www" config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine vb.gui = true # Customize the amount of memory on the VM: vb.memory = "4096" vb.cpus = 4 end # Disable automatic box update checking. If you disable this, then # boxes will only be checked for updates when the user runs # `vagrant box outdated`. This is not recommended. # config.vm.box_check_update = false # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine. In the example below, # accessing "localhost:8080" will access port 80 on the guest machine. # NOTE: This will enable public access to the opened port # config.vm.network "forwarded_port", guest: 80, host: 8080 # Create a forwarded port mapping which allows access to a specific port # within the machine from a port on the host machine and only allow access # via 127.0.0.1 to disable public access # config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" # Create a private network, which allows host-only access to the machine # using a specific IP. # config.vm.network "private_network", ip: "192.168.33.10" # Create a public network, which generally matched to bridged network. # Bridged networks make the machine appear as another physical device on # your network. # config.vm.network "public_network" # Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. And the optional third # argument is a set of non-required options. # config.vm.synced_folder "../data", "/vagrant_data" # Provider-specific configuration so you can fine-tune various # backing providers for Vagrant. These expose provider-specific options. # Example for VirtualBox: # # config.vm.provider "virtualbox" do |vb| # # Display the VirtualBox GUI when booting the machine # vb.gui = true # # # Customize the amount of memory on the VM: # vb.memory = "1024" # end # # View the documentation for the provider you are using for more # information on available options. # Enable provisioning with a shell script. Additional provisioners such as # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # documentation for more information about their specific syntax and use. # config.vm.provision "shell", inline: <<-SHELL # apt-get update # apt-get install -y apache2 # SHELL end ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看