Skip to content

Instantly share code, notes, and snippets.

@gdenisov
Last active March 12, 2017 21:38
Show Gist options
  • Save gdenisov/c8afc9efe79aafa831b1904f6e27dc3c to your computer and use it in GitHub Desktop.
Save gdenisov/c8afc9efe79aafa831b1904f6e27dc3c 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;
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment