Skip to content

Instantly share code, notes, and snippets.

@edgvi10
Created March 3, 2021 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgvi10/beab6d14002963ae2b69742e2aabc072 to your computer and use it in GitHub Desktop.
Save edgvi10/beab6d14002963ae2b69742e2aabc072 to your computer and use it in GitHub Desktop.

INSTALL AND CONFIGURE LAMP

Install Apache and cURL.

sudo apt update

sudo apt install apache2 curl

Configure Apache Firewall

sudo ufw app info "Apache Full"

sudo ufw allow in "Apache Full"

Install MySQL

sudo apt install mysql-server

sudo mysql_secure_installation

Configure root password and create a user

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'NEW_PASSWORD';

CREATE USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
    
GRANT ALL ON *.* TO 'user'@'localhost';

FLUSH PRIVILEGES;

Allow MySQL on Firewall

sudo ufw allow mysql

Configura MySQL remote access

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

In file, find and set bind-address = 0.0.0.0

sudo systemctl restart mysql

PHP

Install PHP (Laravel friendly)

sudo apt install php libapache2-mod-php php-mysql php-curl php-cli php-xml php-mbstring php-xmlrpc php-intl php-zip php-gd

Enable rewrite

sudo a2enmod rewrite

Restart and check Apache status

sudo systemctl restart apache2 && sudo systemctl status apache2

Apache Virtual Host

sudo nano /etc/apache2/sites-available/domain.conf
<VirtualHost *:80>
    ServerName domain
    ServerAlias domain

    DocumentRoot /var/www/
    <Directory "/var/www/">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/www/apache_error.log
    CustomLog /var/www/apache_access.log combined
</VirtualHost>
sudo a2ensite domain.conf

sudo systemctl restart apache2 && sudo systemctl status apache2

Install GIT

sudo add-apt-repository ppa:git-core/ppa && sudo apt update && sudo apt install git

sudo git config --global user.name 'Full Name'

sudo git config --global user.email 'email@server.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment