Open ghost opened 6 years ago
vagrant box list
List các box trong máy PC. Hình ảnh:
vagrant box add <name-box>
Thêm mới box mới. Hình ảnh:
vagrant box remove <name-box>
Remove một box trong PC. Hình ảnh:
vagrant package --base <box-name> --output <position-save>
Xuất ra file cấu hình có trong máy PC Hình ảnh:
vagrant plugin install <name-plugin>
cài đặt plugin. Hình ảnh:
vagrant plugin list
List các plugin trong PC. Hình ảnh:
vagrant plugin uninstall <name-plugin>
Xóa các plugin trong PC. Hình ảnh:
vagrant up
Add box vào virtual box. Hình ảnh:
vagrant halt
Dừng vagrant. Hình ảnh:
vagrant reload
Reload lại nếu cấu hình có thay đổi. Hình ảnh:
vagrant provison
Kiểm tra các điều khoản Hình ảnh:
Tên của box.
Máy thực và máy ảo liên lạc qua cổng nào.
cấu hình địa chỉ IP local.
Cấu hình địa chỉ IP public.
Đồng bộ file
Thông tin nhà cung cấp mở được box.
sudo apt-get install apache2
Hình ảnh: Vào trình duyệt 192.168.33.10
sudo apt install php7.2-mysql php7.2 php7.2-cli
Hình ảnh:
sudo apt install mysql-server
Vào file /var/www/html tạo index.php có nội dung như sau
<?php echo "Hello World"; ?>
Vào trình duyệt gõ địa chỉ 192.168.33.10
<?php phpinfo(); ?>
sudo mysql -u -p root
LGTM. thanks
Các lệnh về vagrant
vagrant box
list boxes
List các box trong máy PC. Hình ảnh:
add box
Thêm mới box mới. Hình ảnh:
remove box
Remove một box trong PC. Hình ảnh:
export box
Xuất ra file cấu hình có trong máy PC Hình ảnh:
vagrant plugins
install plugin
cài đặt plugin. Hình ảnh:
list plugin
List các plugin trong PC. Hình ảnh:
uninstall plugin
Xóa các plugin trong PC. Hình ảnh:
vagrant
vagrant start
Add box vào virtual box. Hình ảnh:
vagrant stop
Dừng vagrant. Hình ảnh:
vagrant reload
Reload lại nếu cấu hình có thay đổi. Hình ảnh:
Vagrant provision
Kiểm tra các điều khoản Hình ảnh:
config.vm.box
Tên của box.
config.vm.network "forwarded_port"
Máy thực và máy ảo liên lạc qua cổng nào.
config.vm.network "private_network"
cấu hình địa chỉ IP local.
config.vm.network "public_network"
Cấu hình địa chỉ IP public.
config.vm.synced_folder
Đồng bộ file
config.vm.provider
Thông tin nhà cung cấp mở được box.
Cài đặt web server
Install apache
Hình ảnh: Vào trình duyệt 192.168.33.10
Install PHP
Hình ảnh:
Install mysql
Hình ảnh:
php hello world
Vào file /var/www/html tạo index.php có nội dung như sau
Hình ảnh:
Vào trình duyệt gõ địa chỉ 192.168.33.10
php phpinfo()
Vào file /var/www/html tạo index.php có nội dung như sau
Vào trình duyệt gõ địa chỉ 192.168.33.10
Config vhost
Kết nối tới mysql từ terminal, từ workbench
Kết nối tới mysql từ terminal
Kết nối tới mysql từ workbench