Last active
December 19, 2021 17:47
-
-
Save dmp1ce/84c31085745101f8c241 to your computer and use it in GitHub Desktop.
Configure Ubuntu 15.04 for docker-compose and decompose on Vultr.com
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
#!/bin/bash | |
# To run from shell: | |
# bash <(curl -sSL https://gist.githubusercontent.com/dmp1ce/84c31085745101f8c241/raw) | |
do_config() { | |
# Make sure to run as root | |
user="$(id -un 2>/dev/null || true)" | |
if [ "$user" != 'root' ]; then | |
echo "Please try again as root" | |
return 1 | |
fi | |
# Collect hostname | |
echo "Please enter the new hostname for this machine:" | |
read new_hostname | |
# Update system | |
apt-get update | |
apt-get upgrade | |
# Change hostname | |
echo "$new_hostname" > /etc/hostname | |
hostname $new_hostname | |
sed -i "s/install/$new_hostname/" /etc/hosts | |
# Install Docker | |
curl -sSL https://get.docker.com/ | sh | |
# Create user based on hostname and Add hostname user to docker group | |
useradd -m -G sudo,docker -s /bin/bash $new_hostname | |
echo $new_hostname:password | chpasswd | |
# Copy ssh authorized_keys to hostname user | |
cp -r /home/david/.ssh /home/$new_hostname/ | |
chown -R $new_hostname:$new_hostname /home/$new_hostname/.ssh/ | |
# Install Docker compose | |
curl -L https://github.com/docker/compose/releases/download/1.4.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose --version | awk 'NR==1{print $NF}')/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose | |
# Install decompose | |
git -C /opt clone --recursive https://github.com/dmp1ce/decompose.git | |
ln -s /opt/decompose/decompose /usr/local/bin | |
ln -s /opt/decompose/completion/decompose-bash-completion /usr/share/bash-completion/completions/decompose | |
} | |
do_config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks.