Install LAMP Stack on Ubuntu 16.04 Xenial Xerus
Build notes for installing Apache, MariaDB, PHP.
Install Apache
sudo apt-get install apache2
Install PHP
Install PHP with extra modules.
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
Install Maria DB
Use the online respository configuration tool. Select a local mirror.
Based on Ubuntu Xenial, stable release:
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://ftp.heanet.ie/mirrors/mariadb/repo/10.1/ubuntu xenial main'
# Once the key is imported, install MariaDB:
sudo apt-get update
sudo apt-get install mariadb-server
Secure MariaDB by removing anonymous users, removing the test database and disallowing external access:
sudo mysql_secure_installation
Install PHP Extras
For extensions available, enable with phpenmod
:
sudo phpenmod mcrypt
sudo service apache2 restart
Extra extensions may be required. For example, if multibyte functions are used in apps, you will need php-mbstring
:
sudo apt-get install php-mbstring
sudo phpenmod mbstring
sudo apt-get install php-xml
sudo service apache2 restart
Install PHPMyAdmin
Install phpMyAdmin:
sudo apt-get install phpmyadmin apache2-utils
An ncurses window will open that enables phpMyAdmin to be configured.
- To select a server, hit space then tab/return
- Choose “yes” when asked “Configure database for phpmyadmin with dbconfig-common?”
- Enter a password for phpMyAdmin when prompted
Once installed, PHPMyAdmin needs to be added to the Apache config file:
sudo nano /etc/apache2/apache2.conf
# Add the following line to the end of apache2.conf:
Include /etc/phpmyadmin/apache.conf
Restart apache:
sudo service apache2 restart
When installing phpMyAdmin on Xenial Xerus, you may encounter a blank white screen of death. Try checking the Apache error log to determine the problem:
tail -f /var/log/apache2/error.log
In my case, the relevant error was:
[Fri Jun 17 20:04:50.205836 2016] [:error] [pid 8089] [client 127.0.0.1:34540] PHP Fatal error: require_once(): Failed opening required '/usr/share/php/php-gettext/gettext.inc' (include_path='.:/usr/share/php') in /usr/share/phpmyadmin/libraries/select_lang.lib.php on line 477
This means that the php-gettext extension is required. Install this and restart Apache to fix:
sudo apt-get install php-gettext
sudo service apache2 restart
comments powered by Disqus