Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fine tunes after larasail
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
# Update Package Lists
apt-get update
apt-get upgrade -y
# Set locale
echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale
locale-gen en_US.UTF-8
# Make SSH accessable
mkdir -p /home/larasail/.ssh
cp -Rfv /root/.ssh /home/larasail
chmod -R 755 /home/larasail
chmod 700 /home/larasail/.ssh
chmod 600 /home/larasail/.ssh/authorized_keys
ssh-keygen -f /home/larasail/.ssh/id_rsa -t rsa -b 4096 -N ''
chown -R larasail:larasail /home/larasail
sed -i 's/\/bin\/sh/\/bin\/bash/' /etc/passwd
# Generate SSH key and register with repositories
ssh-keyscan -H github.com >> /home/larasail/.ssh/known_hosts
ssh-keyscan -H bitbucket.org >> /home/larasail/.ssh/known_hosts
# Set timezone
timedatectl set-timezone Asia/Seoul
# Setup UFW firewall
ufw allow 22
ufw allow 80
ufw allow 443
ufw --force enable
# Add deployer user
sudo adduser --disabled-password --gecos "" deployer
sudo usermod -aG www-data deployer
sudo chfn -o umask=022 deployer
mkdir -p /home/deployer/.ssh
cp -Rfv /root/.ssh /home/deployer
chmod -R 755 /home/deployer
chmod 700 /home/deployer/.ssh
chmod 600 /home/deployer/.ssh/authorized_keys
ssh-keygen -f /home/deployer/.ssh/id_rsa -t rsa -b 4096 -N ''
chown -R deployer:deployer /home/deployer
sudo chown deployer:www-data /var/www/html
sudo chmod g+s /var/www/html
# Install certbot
sudo add-apt-repository ppa:certbot/certbot -y
sudo apt -yq install python-certbot-nginx
# Install additional php 7.2 modules
sudo apt -yq install php-zip php-xml php-mbstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.