Last active
June 5, 2017 15:36
-
-
Save GongT/cb5c429a79834f73eff6041726a4d76a to your computer and use it in GitHub Desktop.
my linux virtual machine init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# curl https://gist.githubusercontent.com/GongT/cb5c429a79834f73eff6041726a4d76a/raw/92eb636b4b8151af7b4e336e535b0003599fb4fc/gistfile1.txt | bash | |
# disable firewall & selinux | |
setenforce 0 | |
echo -e "SELINUX=permissive\nSELINUXTYPE=targeted\n" > /etc/sysconfig/selinux | |
systemctl disable firewalld | |
systemctl stop firewalld | |
systemctl mask firewalld | |
# install docker client only | |
dnf upgrade -y | |
dnf install docker git wget -y | |
dnf mask docker | |
# clone and install scripts | |
cd /opt | |
git clone https://github.com/GongT/linux-toolbox.git | |
cd linux-toolbox | |
bash --login -i -e "./install_environment.sh" | |
bash --login -i -e "./install_environment.sh" | |
# mount exported root folder from host machine | |
echo "[Unit] | |
Before=local-fs.target | |
After=-.mount | |
[Install] | |
WantedBy=local-fs.target | |
RequiredBy=sshd.service | |
[Mount] | |
What=root-folder | |
Where=/root | |
Type=9p | |
Options=trans=virtio,rw,size=4K,nouser,auto,exec,nodev,nosuid | |
" > /usr/lib/systemd/system/root.mount | |
systemctl daemon-reload | |
[ -e /home/root ] || mv /root /home/root | |
mkdir -p /root | |
systemctl enable root.mount | |
systemctl start root.mount | |
chmod 0700 /root | |
# configure sshd | |
cd /etc/ssh | |
unlink sshd_config | |
ln -s "/root/.ssh/sshd_config" | |
systemctl restart sshd | |
# configure docker client | |
cd /etc/profile.d/ | |
ln -s "/root/.docker/client.sh" ./docker-client.sh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment