Tuesday, September 26, 2017

LAMP Stack setup in Ubuntu with basic developer tools


Install Apache2 first

sudo apt-get update
sudo apt-get install apache2

Install mysql-server

sudo apt-get install mysql-server libapache2-mod-auth-mysql

Install PHP 7.1

sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get udpate
sudo apt-get install php7.1 libapache2-mod-php7.1 php7.1-mcrypt

Install other PHP Modules

apt-cache search php7.1-

There are the list of few modules

php-imagick - Provides a wrapper to the ImageMagick library
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-redis - PHP extension for interfacing with Redis
php-http - PECL HTTP module for PHP Extended HTTP Support
php-uploadprogress - file upload progress tracking extension for PHP
php-yaml - YAML-1.1 parser and emitter for PHP
php7.1-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.1-cli - command-line interpreter for the PHP scripting language
php7.1-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.1-curl - CURL module for PHP
php7.1-dba - DBA module for PHP
php7.1-gd - GD module for PHP
php7.1-gmp - GMP module for PHP
php7.1-imap - IMAP module for PHP
php7.1-intl - Internationalisation module for PHP
php7.1-json - JSON module for PHP
php7.1-mbstring - MBSTRING module for PHP
php7.1-mcrypt - libmcrypt module for PHP
php7.1-mysql - MySQL module for PHP
php7.1-odbc - ODBC module for PHP
php7.1-pgsql - PostgreSQL module for PHP
php7.1-pspell - pspell module for PHP
php7.1-readline - readline module for PHP
php7.1-recode - recode module for PHP
php7.1-snmp - SNMP module for PHP
php7.1-soap - SOAP module for PHP
php7.1-sqlite3 - SQLite3 module for PHP
php7.1-sybase - Sybase module for PHP
php7.1-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.1-xmlrpc - XMLRPC-EPI module for PHP
php7.1-zip - Zip module for PHP

Enable rewrite mode

// Enable rewrite mode for apache
sudo a2enmod rewrite
// check this file "/etc/apache2/sites-available/default"

// You need to remove AllowOverride None, and add AllowOverride All
<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    AllowOverride All
    Order allow,deny
    allow from all
// Then restart / reload the server
sudo service apache2 reload
  -- OR --
sudo service apache2 restart

Now ready to go, just restart the server

sudo service apache2 restart

Download PhpMyAdmin

Download the zip from

Make web directory accessible

sudo chmod 0777 /var/www/html/ -R

Extract PhpMyAdmin zip and rename

Extract to "/var/www/html/"
And then rename to phpmyadmin or pma, whatever you are comfirtable with

Install GIT

sudo apt-get update
sudo apt-get install git

Install ZSH

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

This will required system restart to make affect zsh as default terminal.

Install composer

cd ~
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --filename=composer
php -r "unlink('composer-setup.php');"
mv composer /usr/local/bin/composer