Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jojoee/vagrant-examples
Vagrant examples
https://github.com/jojoee/vagrant-examples
example vagrant vagrantfile
Last synced: about 1 month ago
JSON representation
Vagrant examples
- Host: GitHub
- URL: https://github.com/jojoee/vagrant-examples
- Owner: jojoee
- License: mit
- Created: 2017-03-19T12:48:45.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-19T14:09:18.000Z (almost 8 years ago)
- Last Synced: 2024-11-07T12:33:54.227Z (3 months ago)
- Topics: example, vagrant, vagrantfile
- Language: HTML
- Homepage:
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vagrant-examples
- Vagrant: Manages VM software
- Vagrantfile: virtual machine configuration## Getting started
1. Install VirtualBox
2. Install [Vagrant](https://www.vagrantup.com/), after install Vagrant, it'll update our hosts file
3. Go to directory: `cd baked-lamp`
4. Start: `vagrant up`## CLI
```
Basic
$ vagrant help
$ vagrant -v
$ vagrant box list
$ vagrant box update
$ vagrant init [box-name]
$ vagrant init ubuntu/trusty64
$ vagrant upTo access
$ vagrant sshPlugin
$ vagrant plugin list
# vagrant plugin update
$ vagrant plugin install
$ vagrant plugin install vagrant-vbguestWhile running
$ vagrant provision
$ vagrant suspend...........pause
$ vagrant halt..............power off VM
$ vagrant destroy...........stop and remove VM
$ vagrant status
$ vagrant reloadBox
$ vagrant box add [box-path]
$ vagrant box add ubuntu/trusty64
$ vagrant box add laravel/homestead
$ vagrant box add debian/jessie64
$ vagrant box add centos/7
$ vagrant box add miya0001/vccw
$ vagrant remove
```## Provisioning
Baked: make it from scratch
```
$ vagrant up
$ vagrant sshInside VM
$ sudo yum update -y
$ sudo yum install -y nano git unzip screen
$ sudo yum install -y httpd httpd-devel httpd-tools
$ sudo yum install -y php php-cli php-common php-devel php-mysql
$ sudo chkconfig --add httpd
$ sudo chkconfig httpd on
$ cd /var/www
$ sudo rm -rf html
$ sudo ln -s /vagrant /var/www/html
$ sudo service httpd restart
$ sudo yum install -y mysql mysql-server mysql-devel
$ sudo chkconfig --add mysqld
$ sudo chkconfig mysqld on
$ sudo service mysqld start
$ mysql -u root -e "CREATE DATABASE IF NOT EXISTS jojoee_test";
$ mysql -u root -e "SHOW DATABASES";
$ exitExport to box
$ vagrant status
$ vagrant package --output baked-lamp.box
$ vagrant box add "jojoee/baked-lamp" baked-lamp.boxTest
$ cd baked-lamp-test
$ vagrant uphttp://localhost:8080/
http://localhost:8080/index.php
http://localhost:8081/
http://localhost:8081/index.php
```## Update
- [x] Work with database (e.g. MySQL)
- [ ] Plugin## Reference
- [Vagrant](https://www.vagrantup.com/)
- [Vagrant documentation](https://www.vagrantup.com/docs/)
- [Vagrantfile](https://www.vagrantup.com/docs/vagrantfile/)
- Vagrant Box: [Discover Vagrant Boxes](https://atlas.hashicorp.com/boxes/search), [Vagrantbox.es](http://www.vagrantbox.es/)
- [Available Vagrant Plugins](https://github.com/mitchellh/vagrant/wiki/Available-Vagrant-Plugins)