dnmp安装

centos7.2.box下载地址

链接: https://pan.baidu.com/s/1ny20PN2x7YuA6dwYA-P0yQ 提取码: wrdk 

1 下载centos.box 

新建dnmp目录 下载的复制到该目录下

vagrant box add dnmp vagrant-centos-7.2.box

vagrant init dnmp  //生成Vagrantfile 

复制下面到Vagrantfile里面

agrant.configure("2") do |config|
 
  config.vm.box = "dnmp"
	
	config.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", disabled: "true"
	config.vm.network "forwarded_port", guest: 22, host: 7777
	config.vm.network "private_network", ip: "192.168.33.70"
	config.vm.synced_folder "d:/dnmp", "/www/dnmp"
	config.vm.synced_folder "e:/src", "/usr/local/src"
	
	config.vm.provider "virtualbox" do |v|
	v.memory = 2048
	v.cpus = 2
	end
 
end
知识兔

vagrant up

E:\vbox_list\dnmp>vagrant box add dnmp vagrant-centos-7.2.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'dnmp' (v0) for provider:
box: Unpacking necessary files from: file://E:/vbox_list/dnmp/vagrant-centos-7.2.box
box:
==> box: Successfully added box 'dnmp' (v0) for 'virtualbox'!

:\vbox_list\dnmp>vagrant init dnmp
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.

E:\vbox_list\dnmp>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'dnmp'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: dnmp_default_1568880279009_33589
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 7777 (host) (adapter 1)
    default: 29324 (guest) => 29324 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:7777
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Connection reset. Retrying...
    default: Warning: Connection aborted. Retrying...
    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 of
    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 the
    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.30
    default: VirtualBox Version: 6.0
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => E:/vbox_list/dnmp
    default: /www/dnmp => D:/dnmp
    default: /usr/local/src => E:/src
==> default: Starting notify-forwarder ...
    default: Notify-forwarder: guest listening for file change notifications on 0.0.0.0:29324.
==> default: Notify-forwarder: Unsupported host operating system
知识兔

 

使用xshell登录 

账号root vagrant    

密码 vagrant

更新root密码和yum

]# sudo passwd root
Changing password for user root.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.
[root@localhost ~]# yum -y update
知识兔

安装git 和上传工具

um -y install git lrzsz vim
知识兔

安装docker

1、Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。

通过 uname -r 命令查看你当前的内核版本

$ uname -r
知识兔

2、使用 root 权限登录 Centos。确保 yum 包更新到最新。

 sudo yum update
知识兔

3、卸载旧版本(如果安装过旧版本的话)

 sudo yum remove docker  docker-common docker-selinux docker-engine
知识兔

4、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

 sudo yum install -y yum-utils device-mapper-persistent-data lvm2
知识兔

5、设置yum源

 sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
知识兔

6、可以查看所有仓库中所有docker版本,并选择特定版本安装

 yum list docker-ce --showduplicates | sort -r
知识兔

7、安装docker

 sudo yum install docker-ce  #由于repo中默认只开启stable仓库,故这里安装的是最新稳定版17.12.0
$ sudo yum install <FQPN>  # 例如:sudo yum install docker-ce-17.12.0.ce
知识兔

8、启动并加入开机启动

 sudo systemctl start docker
$ sudo systemctl enable docker
知识兔

9、验证安装是否成功(有client和service两部分表示docker安装启动都成功了)

 docker version
知识兔

 

  

计算机