Skip to content

Instantly share code, notes, and snippets.

@jongacnik
Forked from gdenisov/DO_LAMP_Setup.md
Last active November 15, 2023 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jongacnik/78b1d9083b5c88154c5b51ee50a32752 to your computer and use it in GitHub Desktop.
Save jongacnik/78b1d9083b5c88154c5b51ee50a32752 to your computer and use it in GitHub Desktop.

Digital Ocean - New LAMP Instance To-Dos

  • Make a droplet using LAMP Instance

  • Add a new user (i.e. deployer)

    adduser deployer
    
  • Add the new user to sudo group

    usermod -aG sudo deployer
    
  • Add the new user to www-data group as primary group to avoid issues with server side read/write permissions across multiple users

    usermod -ag www-data deployer
    
  • Make sure /var/www/ (or whatever) has new-user:www-data ownership

  • Setup Virtual Hosts (https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts)

  • Make sure to include <Directory>AllowOverride All</Directory> to enable .htaccess

  • Enable necessary apache modules (i.e. rewrite, expires, headers)

    sudo apt-get update
    sudo a2enmod rewrite expires headers
    
  • Install curl and php-curl

    sudo apt-get install curl
    sudo service apache2 restart
    sudo apt-get install php-curl
    sudo service apache2 restart
    
  • Complete MySQL installation. Root password directions are in the welcome message (at the moment, it's stored in /root/.digitalocean_password)

    mysql_secure_installation
    
  • Add new MySQL user

    mysql -u root -p
    
    CREATE DATABASE db_name;
    CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON db_name . * TO 'username'@'localhost';
    FLUSH PRIVILEGES;
    

    Additional Notes

    http://feross.org/how-to-setup-your-linode/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment