站点更新:2018-11-02 10:42:27

windows
ehlxr 2018-11-02 10:42:27 +08:00
parent d8f9419e23
commit 28edd2bdf9
3 changed files with 16 additions and 8 deletions

17
Vagrantfile vendored
View File

@ -49,14 +49,15 @@ Vagrant.configure("2") do |config|
cfg.vm.synced_folder "/Users/ehlxr/works/Vagrant", "/vagrant"
# 开机运行命令
# 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.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
# SHELL
cfg.vm.provision "shell", run: "always", inline: <<-SHELL
echo -e "\033[1;33mConfig ssh...\033[0m"
mkdir -p ~/.ssh && cat /share/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 /share/config/resolv.conf /etc/
SHELL
# 自定义初始化执行脚本
# cfg.vm.provision "shell", path: "config/init.sh"

View File

@ -35,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

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