Last active
February 1, 2020 11:10
-
-
Save momo-lab/d73ff3f5c8389d5cf35ba52e554e4bc2 to your computer and use it in GitHub Desktop.
KAGOYA CLOUD/2でUbuntu 16.04インスタンスを作る場合の初期スクリプトっぽいなにか。途中いくつかの入力があるので手動で動かす必要あり。
This file contains hidden or 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/env bash | |
# update 18.04 | |
apt update -y | |
apt upgrade -y | |
# reboot | |
do-release-upgrade | |
# package install | |
apt install -y zsh unzip ctags make gcc libssl-dev libreadline-dev zlib1g-dev libbz2-dev libsqlite3-dev libffi-dev | |
# install docker | |
apt install -y apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
apt-key fingerprint 0EBFCD88 | |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
apt update | |
apt install -y docker-ce | |
# delete unused package | |
apt clean | |
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge | |
# create users | |
groupname=user | |
username=momotaro | |
groupadd $groupname | |
useradd -m -g $groupname -G sudo -s $(which bash) $username | |
mkdir /home/$username/.ssh | |
chown $username:$groupname /home/$username/.ssh | |
chmod 700 /home/$username/.ssh | |
passwd $username # => input password | |
# setting iptables with ufw | |
ufw default deny | |
ufw allow ssh | |
ufw enable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment