How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu

eGov ERP DevOps

How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu

#### About Lemp LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Ubuntu, the linux part is taken care of. Here is how to install the rest. #### If any existing lamp installation & you need to upgrade your old server, uninstall all things & backup first all databases & files. ```` sudo apt-get purge php5* sudo apt-get purge apache2* or sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common sudo apt-get update sudo apt-get autoremove sudo apt-get autoclean ```` #### Install apache 2.4 (why 2.4 cause laravel 5.3 needs to 2.4 & latest php version >= 5.6.4) * Update apt & software-properties ```` sudo apt-get update && sudo apt-get install python-software-properties ```` * add ondrej PPA for apache 2.4 version: ```` sudo add-apt-repository ppa:ondrej/apache2 ```` * update & install apache ```` sudo apt-get update sudo apt-get install apache2 ```` * check apache version ```` apache2 -v ## apache 2.4 ```` #### Install Mysql & PHP5.6-mysql(Note: if you've already installed mysql-server, you don't need to run command of mysql-server. you have to run only php5.6-mysql) ```` sudo apt-get install mysql-server sudo apt-get install php5.6-mysql ```` #### Install latest PHP 5.6 * add ondrej PPA for PHP ```` sudo add-apt-repository ppa:ondrej/php ```` * Update & install php 5.6 & libapache mode for php ```` sudo apt-get update sudo apt-get install php5.6 libapache2-mod-php5.6 ```` * Restart apache2 service & check version of php ```` sudo service apache2 restart php -v ```` #### Install PHP Extension required for Laravel ```` sudo apt-get install php5.6-curl sudo apt-get install php5.6-xml sudo apt-get install php5.6-mcrypt sudo apt-get install php5.6-openssl sudo apt-get install php5.6-gd sudo apt-get install php5.6-mbstring ```` #### PHP Modules ```` apt-cache search php5.6- /* php-radius - radius client library for PHP 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 php-mongodb - MongoDB driver for PHP php5.6-cgi - server-side, HTML-embedded scripting language (CGI binary) php5.6-cli - command-line interpreter for the PHP scripting language php5.6-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary) php5.6-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary) libphp5.6-embed - HTML-embedded scripting language (Embedded SAPI library) php5.6-dev - Files for PHP5.6 module development php5.6-common - documentation, examples and common module for PHP php5.6-curl - CURL module for PHP php5.6-gd - GD module for PHP php5.6-imap - IMAP module for PHP php5.6-intl - Internationalisation module for PHP php5.6-ldap - LDAP module for PHP php5.6-mysql - MySQL module for PHP php5.6-pgsql - PostgreSQL module for PHP php5.6-pspell - pspell module for PHP php5.6-recode - recode module for PHP php5.6-snmp - SNMP module for PHP php5.6-sqlite3 - SQLite3 module for PHP php5.6-sybase - Sybase module for PHP php5.6-tidy - tidy module for PHP php5.6-opcache - Zend OpCache module for PHP php-apcu - APC User Cache for PHP php-xdebug - Xdebug Module for PHP php-imagick - Provides a wrapper to the ImageMagick library php-ssh2 - Bindings for the libssh2 library php5.6-json - JSON module for PHP php-redis - PHP extension for interfacing with Redis php-memcached - memcached extension module for PHP, uses libmemcached php-amqp - AMQP extension for PHP php5.6-bz2 - bzip2 module for PHP php5.6-mcrypt - libmcrypt module for PHP php5.6-odbc - ODBC module for PHP php5.6-readline - readline module for PHP php-rrd - PHP bindings to rrd tool system php5.6-interbase - Interbase module for PHP php5.6-xmlrpc - XMLRPC-EPI module for PHP php5.6-enchant - Enchant module for PHP php5.6-gmp - GMP module for PHP php5.6-xsl - XSL module for PHP (dummy) php-uuid - PHP UUID extension php-memcache - memcache extension module for PHP php-gmagick - Provides a wrapper to the GraphicsMagick library php-zmq - ZeroMQ messaging bindings for PHP php-igbinary - igbinary PHP serializer php-msgpack - PHP extension for interfacing with MessagePack php-geoip - GeoIP module for PHP php5.6-bcmath - Bcmath module for PHP php5.6-mbstring - MBSTRING module for PHP php5.6-soap - SOAP module for PHP php5.6-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP php5.6-zip - Zip module for PHP php-tideways - Tideways PHP Profiler Extension php-yac - YAC (Yet Another Cache) for PHP php-mailparse - Email message manipulation for PHP php-libsodium - PHP wrapper for the Sodium cryptographic library php-oauth - OAuth 1.0 consumer and provider extension php-gnupg - PHP wrapper around the gpgme library php-propro - propro module for PHP php-raphf - raphf module for PHP php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP php-gearman - PHP wrapper to libgearman php-xcache - fast, stable PHP opcode cacher php-mongo - MongoDB database driver php5.6-dba - DBA module for PHP php-xhprof - Hierarchical Profiler for PHP 5.x php-mysqlnd-ms - MySQL replication and load balancing module for PHP */ ```` #### Install phpmyadmin with 2 way * First way directly install from apt ```` # install phpmyadmin sudo apt-get install phpmyadmin # add line to apache2.conf Include /etc/phpmyadmin/apache.conf #restart apache2 sudo service apache2 restart ```` * Second way (wget phpmyadmin tar/gZip file from PHPMyadmin [Downloads](https://www.phpmyadmin.net/downloads/)) ```` cd /usr/share wget https://files.phpmyadmin.net/phpMyAdmin/4.6.4/phpMyAdmin-4.6.4-all-languages.tar.gz mv phpMyAdmin-4.6.4-all-languages phpmyadmin ln -s /usr/share/phpmyadmin/ /var/www/html/ ```` #### Service start,stop & restart ```` #start service sudo service apache2 start #stop service sudo service apache2 stop #restart service sudo service apache2 restart ##Restart from init.d sudo /etc/init.d/apache2 restart ````

DevOps as a Culture