10 Commits

Author SHA1 Message Date
elvin-henry
652fab3cf8 update 2018-11-02 23:49:09 +08:00
a037b0fffc 站点更新:2018-11-02 22:37:52 2018-11-02 22:37:52 +08:00
7798b2847e 站点更新:2018-11-02 22:19:19 2018-11-02 22:19:19 +08:00
03ac98fc27 站点更新:2018-11-02 12:42:29 2018-11-02 12:42:30 +08:00
28edd2bdf9 站点更新:2018-11-02 10:42:27 2018-11-02 10:42:27 +08:00
d8f9419e23 站点更新:2018-11-01 19:13:16 2018-11-01 19:13:16 +08:00
da94b32950 站点更新:2018-11-01 19:12:24 2018-11-01 19:12:24 +08:00
a62d3ca5c7 站点更新:2018-11-01 19:11:39 2018-11-01 19:11:39 +08:00
f475357ddb 站点更新:2018-11-01 18:19:14 2018-11-01 18:19:14 +08:00
e3dcbdb4a6 📝 docs():
Signed-off-by: ehlxr <ehlxr.me@gmail.com>
2018-03-29 19:22:14 +08:00
7 changed files with 44 additions and 10 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.key
*.box
.vagrant
vm_share

View File

@@ -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
View File

@@ -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
View File

@@ -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"

View File

@@ -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
View 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
View File

@@ -0,0 +1,4 @@
# Generated by NetworkManager
nameserver 114.114.114.114
nameserver 8.8.8.8