Compare commits
10 Commits
v0.0.1-alp
...
windows
Author | SHA1 | Date | |
---|---|---|---|
|
652fab3cf8 | ||
a037b0fffc | |||
7798b2847e | |||
03ac98fc27 | |||
28edd2bdf9 | |||
d8f9419e23 | |||
da94b32950 | |||
a62d3ca5c7 | |||
f475357ddb | |||
e3dcbdb4a6 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
*.key
|
||||
*.box
|
||||
.vagrant
|
||||
vm_share
|
24
README.md
24
README.md
@@ -1,9 +1,19 @@
|
||||
|
||||
# Vagrant
|
||||
|
||||
```shell
|
||||
# 插件安装
|
||||
➜ vagrant plugin install vagrant-vbguest
|
||||
➜ vagrant plugin install vagrant-hosts
|
||||
```
|
||||
|
||||
```sh
|
||||
➜ vagrant box add -f centos-7.2 centos-7.2.box
|
||||
|
||||
➜ cd base
|
||||
|
||||
➜ wget https://www.dropbox.com/s/nuz6ts1hlx4vy27/vagrant-centos-7.2.box\?dl\=0 -O vagrant-centos-7.2.box
|
||||
|
||||
➜ vagrant box add -f centos-7.2 vagrant-centos-7.2.box
|
||||
|
||||
➜ vagrant up # 执行 init.sh 脚本时,最好保证能够 fq
|
||||
|
||||
➜ vagrant package --output centos-7.2-ehlxr.box
|
||||
@@ -11,3 +21,13 @@
|
||||
➜ vagrant box add -f centos-7.2-ehlxr centos-7.2-ehlxr.box
|
||||
|
||||
```
|
||||
|
||||
```sh
|
||||
# onedrive.live.com、drive.google.com、pan.baidu.com 下载 centos-7.2-ehlxr.box
|
||||
|
||||
➜ vagrant box add -f centos-7.2-ehlxr centos-7.2-ehlxr.box
|
||||
# vagrant package --base vghost1 --output centos-ehlxr.box
|
||||
|
||||
➜ vagrant up # 执行 init.sh 脚本时,最好保证能够 fq
|
||||
|
||||
```
|
8
Vagrantfile
vendored
8
Vagrantfile
vendored
@@ -45,16 +45,18 @@ Vagrant.configure("2") do |config|
|
||||
# do NOT check the correct additions version when booting this machine(插件安装:vagrant plugin install vagrant-vbguest)
|
||||
cfg.vbguest.auto_update = false
|
||||
|
||||
cfg.vm.synced_folder "/Users/ehlxr/works/Vagrant", "/vagrant"
|
||||
cfg.vm.synced_folder "E:\\ehlxr\\Vagrant", "/vagrant", disabled: true
|
||||
cfg.vm.synced_folder "E:\\ehlxr\\Vagrant\\vm_share", "/root"
|
||||
|
||||
# 开机运行命令
|
||||
cfg.vm.provision "shell", run: "always", inline: <<-SHELL
|
||||
echo -e "\033[1;33mInit cmd...\033[0m"
|
||||
echo -e "\033[1;33mConfig ssh...\033[0m"
|
||||
mkdir -p ~/.ssh && cat /vagrant/config/authorized_keys >> ~/.ssh/authorized_keys
|
||||
mkdir -p ~/.ssh && cat /root/config/authorized.key >> ~/.ssh/authorized_keys
|
||||
sed -i 's/^#RSAAuthentication.*/RSAAuthentication\ yes/g' /etc/ssh/sshd_config
|
||||
sed -i 's/^#PubkeyAuthentication.*/PubkeyAuthentication\ yes/g' /etc/ssh/sshd_config
|
||||
sed -i 's/^PasswordAuthentication.*/PasswordAuthentication\ yes/g' /etc/ssh/sshd_config
|
||||
echo -e "\033[1;33mConfig dns...\033[0m"
|
||||
cp /root/config/resolv.conf /etc/
|
||||
SHELL
|
||||
|
||||
# 自定义初始化执行脚本
|
||||
|
2
base/Vagrantfile
vendored
2
base/Vagrantfile
vendored
@@ -3,7 +3,7 @@ Vagrant.configure("2") do |config|
|
||||
config.vm.box = "centos-7.2"
|
||||
config.vm.network "private_network", ip: "192.168.3.3"
|
||||
config.vbguest.auto_update = false
|
||||
config.vm.synced_folder "/Users/ehlxr/works/Vagrant", "/vagrant"
|
||||
cfg.vm.synced_folder "E:\\ehlxr\\Vagrant", "/vagrant"
|
||||
# 自定义初始化执行脚本
|
||||
config.vm.provision "shell", path: "../config/init.sh"
|
||||
|
||||
|
@@ -27,6 +27,7 @@ git clone https://github.com/zsh-users/zsh-history-substring-search.git /root/.o
|
||||
|
||||
echo -e "\033[1;33mConfig oh-my-zsh...\033[0m"
|
||||
cp -f /vagrant/config/zshrc ~/.zshrc
|
||||
cp -f /vagrant/config/my.zsh ~/.oh-my-zsh/custom/
|
||||
|
||||
echo -e "\033[1;33mConfig ssh...\033[0m"
|
||||
mkdir -p ~/.ssh && cat /vagrant/config/authorized.key >> ~/.ssh/authorized_keys
|
||||
@@ -34,6 +35,9 @@ sed -i 's/^#RSAAuthentication.*/RSAAuthentication\ yes/g' /etc/ssh/sshd_config
|
||||
sed -i 's/^#PubkeyAuthentication.*/PubkeyAuthentication\ yes/g' /etc/ssh/sshd_config
|
||||
sed -i 's/^PasswordAuthentication.*/PasswordAuthentication\ yes/g' /etc/ssh/sshd_config
|
||||
|
||||
echo -e "\033[1;33mConfig dns...\033[0m"
|
||||
cp /vagrant/config/resolv.conf /etc/
|
||||
|
||||
# echo -e "\033[1;33mUpdating kernel...\033[0m"
|
||||
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
|
||||
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
|
||||
@@ -51,6 +55,6 @@ echo -e "\033[1;33mStart and enable Docker...\033[0m"
|
||||
systemctl enable docker
|
||||
systemctl start docker
|
||||
|
||||
echo -e "\033[1;33mVboxadd setup...\033[0m"
|
||||
cd /opt/VBoxGuestAdditions-*/init
|
||||
./vboxadd setup
|
||||
# echo -e "\033[1;33mVboxadd setup...\033[0m"
|
||||
# cd /opt/VBoxGuestAdditions-*/init
|
||||
# ./vboxadd setup
|
3
config/my.zsh
Normal file
3
config/my.zsh
Normal file
@@ -0,0 +1,3 @@
|
||||
bindkey '^]' forward-word
|
||||
bindkey '^f' vi-forward-blank-word
|
||||
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=blue,underline'
|
4
config/resolv.conf
Normal file
4
config/resolv.conf
Normal file
@@ -0,0 +1,4 @@
|
||||
# Generated by NetworkManager
|
||||
|
||||
nameserver 114.114.114.114
|
||||
nameserver 8.8.8.8
|
Reference in New Issue
Block a user