本地搭建Linux环境
说明:本工具可以支持Windows/Mac/Linux等环境,但是目前本人仅在Mac上测试。使用工具
工具 | 说明 | 下载 |
---|---|---|
Vagrant | 用于配置,管理虚拟机的工具,提供简单易使用的命令行接口。使用模版来描述虚拟机环境,所以可以复用网上的模版。 | http://www.vagrantup.com/downloads.html |
Virtualbox | 跨平台的虚拟机环境,用于运行Vagrant模版。 | https://www.virtualbox.org |
下载虚拟机
安装完Virtualbox和Vagrant之后,可以直接下载虚拟机的模版。因为我们生产环境使用的linux版本是CentOS6.5,我们在开发环境最好也使用同样的环境. CentOS 6.5的下载地址: https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box 更多的Vagrant上的模版可以从以下站点获取: http://www.vagrantbox.es/使用说明
先将虚拟机加到box list,然后使用该box初始化一个vagrant虚拟机环境。最后使用vagrant up
就可以启动虚拟机了。
$ vagrant box add {title} {url}
$ vagrant init {title}
$ vagrant up
$ vagrant box add centos65 ../centos65-x86_64-20140116.box
$ vagrant init centos65
$ vagrant up
vagrant ssh
就可以登录到虚拟机上。虚拟机的文件系统是共享本地路径的,所以文件直接copy到制定目录就可以使用了。使用vagrant halt
可以关闭该虚拟机。
$ vagrant ssh
[vagrant@vagrant-centos65 ~]$ exit
$ vagrant halt
Jings-MacBook-Pro:new-box jingy$ vagrant ?
Usage: vagrant [options] <command> [<args>]
-v, --version Print the version and exit.
-h, --help Print this help.
Common commands:
box manages boxes: installation, removal, etc.
connect connect to a remotely shared Vagrant environment
destroy stops and deletes all traces of the vagrant machine
global-status outputs status Vagrant environments for this user
halt stops the vagrant machine
help shows the help for a subcommand
init initializes a new Vagrant environment by creating a Vagrantfile
login log in to Vagrant Cloud
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
provision provisions the vagrant machine
rdp connects to machine via RDP
reload restarts vagrant machine, loads new Vagrantfile configuration
resume resume a suspended vagrant machine
share share your Vagrant environment with anyone in the world
ssh connects to machine via SSH
ssh-config outputs OpenSSH valid configuration to connect to the machine
status outputs status of the vagrant machine
suspend suspends the machine
up starts and provisions the vagrant environment
version prints current and latest Vagrant version
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
分类: web
标签:
搜索
标签
study
ab
amap
apache
apahe
awk
aws
bat
centos
CFS
chrome
cmd
cnpm
composer
consul
crontab
css
curl
cygwin
devops
di
docker
docker,docker-compose
ethereum
excel
fiddler
fluentd
framework
front-end
git
gitgui
github
glide
go
golang
gorm
grafana
gzip
ioc
item2
iterm2
javascript
jenkins
jsonp
kafka
laradock
laravel
larval
linux
liunux
log
mac
mac, wi-fi
macos
magento
mariaDB
minikube
mongoDB
msp
mysql
netbeans
nginx
nodejs
nohup
npm
nsq
oracle
php
php-fpm
php7
phpstorm
php扩展
Protobuf
python
redis
scp
server
shell
soap
socket
socket5
sql
sre
ssdb
ssh
ssl
study
sublime
swift
system
td-agent
uml
v2ray
vagrant
vagrnat
vim
vpn
vue
vue.js
webpack
webrtc
websocket
webtatic
windows
windows7
word
wps
xdebug
yarn
yii2
yum
zookeeper
世界国家
互联网
以太坊
分类
前端
小程序
打印机
排序算法
搞笑
权限
粤语
缓存
网络
虚拟机
视频
设计模式
项目管理
热门文章
友情链接