Created
January 15, 2017 17:35
-
-
Save rkt2spc/0cc4c05593bf36b6b8c7d2770aacf6e4 to your computer and use it in GitHub Desktop.
Linux op works
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
ufw allow OpenSSH | |
ufw allow http | |
ufw allow https | |
ufw enable | |
ufw status |
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
# SSH to your server | |
# STEP 1: Create user, remember the password | |
adduser nmtuan | |
# STEP 2: Add user to sudo group | |
usermod -aG sudo nmtuan | |
# STEP 3: Login as the new user with previous password | |
su - nmtuan | |
# STEP 4: Confirm login | |
whoami | |
# STEP 5: Create location to store keypair | |
mkdir ~/.ssh | |
chmod 700 ~/.ssh | |
# STEP 6: Reuse old keypair from default ubuntu user | |
cp /home/ubuntu/.ssh/authorized_keys /home/nmtuan/.ssh/authorized_keys | |
chown nmtuan:nmtuan ~/.ssh/authorized_keys | |
chmod 600 ~/.ssh/authorized_keys | |
# STEP 7: Disable RootLogin and PasswordAuthentication | |
# If this is a new Ubuntu LTS AMI on AWS EC2, they should've had done it for you | |
# nano /etc/ssh/sshd_config | |
# Change "PermitRootLogin" and "PasswordAuthentication" to "no" | |
# Save changes | |
# systemctl reload sshd | |
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
# STEP 1: Common Tools | |
apt-get install -y screen | |
apt-get install -y unzip | |
# STEP 2: Install GIT | |
apt-get install -y git | |
# STEP 3: Install NodeJs & NPM | |
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - | |
apt-get install -y nodejs | |
apt-get install -y build-essential | |
# STEP 4: Install MongoDB (Optional) | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 | |
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list | |
apt-get install -y mongodb-org | |
apt-get update | |
service mongod start | |
# STEP 5: Install Consul | |
DOWNLOAD_URL='https://releases.hashicorp.com/consul/0.7.2/consul_0.7.2_linux_amd64.zip' | |
TEMP_DIR=`mktemp -d || mktemp -d -t 'tmpdir'` | |
cd $TEMP_DIR | |
wget $DOWNLOAD_URL | |
unzip -o *.zip -d '/usr/local/bin' | |
rm *.zip | |
rm -r $TEMP_DIR | |
cd ~ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment