Skip to content

Instantly share code, notes, and snippets.

@orinokai
Last active May 19, 2016 21:01
Show Gist options
  • Save orinokai/5805201 to your computer and use it in GitHub Desktop.
Save orinokai/5805201 to your computer and use it in GitHub Desktop.
Setting up a DigitalOcean Droplet for LAMP
Select hostname, droplet size and location
Select LAMP application image
Receive new droplet email for IP and password
Log in with
ssh root@[ip address]
Change MYSQL password to match root
mysqladmin -u root -p'password' password [new password]
Create MYSQL superuser
mysql -u root -p[password]
CREATE USER '[username]'@'localhost' IDENTIFIED BY '[password]';
GRANT ALL PRIVILEGES ON *.* TO '[username]'@'localhost' WITH GRANT OPTION;
Create
Add a user
adduser [username]
Edit root privileges
visudo
# User privilege specification
[username] ALL=(ALL:ALL) ALL
ctrl x
Configure SSH Key Pairs (local)
ssh-keygen
scp ~/.ssh/id_rsa.pub [username]@[ip address]:
ssh-add -K ~/.ssh/id_rsa
Configure SSH (remote)
cd ~
mkdir .ssh
mv id_rsa.pub .ssh/authorized_keys
chown -R [username]:[username] .ssh
chmod 700 .ssh
chmod 600 .ssh/authorized_keys
nano /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
reload ssh
Set timezone
dpkg-reconfigure tzdata
Update software
apt-get update
apt-get upgrade --show-upgraded
Configure mod_rewrite
sudo a2enmod rewrite
Configure SSL
sudo a2enmod ssl
Install Ruby and Sass
apt-get install ruby-full rubygems
gem install sass
Install Sendmail
apt-get install sendmail
Configure hosts for sendmail
nano /etc/hosts
127.0.0.1 localhost localhost.localdomain [hostname]
sendmailconfig (answer yes to everything)
Setup FTP
apt-get install proftpd
nano /etc/proftpd/proftpd.conf
ServerName "[hostname]"
DefaultRoot ~
User www-data
Group www-data
service proftpd restart
useradd [ftpuser]
passwd [ftpuser]
usermod -g www-data [ftpuser]
usermod -d [homedirectory] [ftpuser]
Configure firewall
apt-get install ufw
ufw default deny incoming
ufw default allow outgoing
ufw allow ssh
ufw allow www
ufw allow ftp
ufw allow 443/tcp
ufw enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment