Skip to content

Instantly share code, notes, and snippets.

@kharbanda14
Last active June 10, 2020 16:17
Show Gist options
  • Save kharbanda14/d104b098756b35187475c4ffa9961e8b to your computer and use it in GitHub Desktop.
Save kharbanda14/d104b098756b35187475c4ffa9961e8b to your computer and use it in GitHub Desktop.
Set of instructions/commands to set up LAMPP (PHP, MySQL, Apache2) server on Ubuntu 18.04.

LAMPP Server Ubuntu

  1. Step 1 (Apache+PHP+MySQL)
sudo apt install unzip apache2
sudo apt install php7.2 php7.2-json php7.2-xml php7.2-bcmath php7.2-opcache php7.2-curl php7.2-interbase php7.2-mbstring php7.2-gd php7.2-intl php7.2-mysql php7.2-zip php7.2-pgsql
sudo apt install mysql-server
  1. Step 2 (MySQL Configuration)
create database database_name;
create user 'work'@'localhost' identified by 'work@localhost';
grant all privileges on database_name.* to 'work'@'localhost';
flush privileges;
  1. Composer
sudo wget https://getcomposer.org/download/1.10.7/composer.phar -O /usr/local/bin/composer
sudo chmod a+x /usr/local/bin/composer
  1. Getting Started (Permissions with phpmyadmin)
sudo chown -R ubuntu:www-data /var/www/html
cd /var/www/html
wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.zip -O phpmyadmin.zip
unzip phpmyadmin.zip && rm phpmyadmin.zip
mv phpMyAdmin-5.0.2-all-languages phpmyadmin
  1. Enable rewrite

file : /etc/apache2/sites-available/000-default.conf

<Directory /var/www/html>
     Options Indexes FollowSymLinks MultiViews
     AllowOverride All
     Require all granted
 </Directory>
sudo a2enmod rewrite
sudo systemctl restart apache2
  1. MailHog

Service

sudo tee /etc/systemd/system/mailhog.service <<EOL
[Unit]
Description=Mailhog
After=network.target
[Service]
User=%user%
ExecStart=/usr/bin/env /usr/local/bin/mailhog > /dev/null 2>&1 &
[Install]
WantedBy=multi-user.target
EOL

systemctl daemon-reload
systemctl enable mailhog
  1. Configure SMTP port if necessary (Postfix)
/etc/postfix/main.cf

myhostname = localhost
relayhost = [localhost]:1025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment