1sudo apt update && sudo apt upgrade -y
1sudo apt install apache2 apache2-utils ssl-cert -y
1sudo apt install mysql-server mysql-client -y
Secure the installation
1mysql_secure_installation
add repo to get the latest version of PHP
1sudo add-apt-repository ppa:ondrej/php
2sudo apt update
if you get
1sudo: add-apt-repository: command not found
then install the software-properties-common
package. Depending on your Ubuntu version (Precise Pangolin, 12.04 LTS), you may also have to install the python-software-properties
package:
1sudo apt-get install software-properties-common -y
Now update the sources list so it gets packages from the repo we just added
sudo apt update
at the time of this writing, the latest PHP version is 7.2
1sudo apt install php7.2 libapache2-mod-php7.2 php7.2-cli php7.2-common php-curl php7.2-curl php7.2-dev php7.2-gd php7.2-intl php7.2-mcrypt php7.2-mbstring php7.2-mysql php7.2-pspell php7.2-recode php7.2-xml php-imagick php-pear php-gettext php7.2-zip -y
php7.2
will also install libapache2-mod-php7.2
, php-common
, php7.2-cli
, php7.2-common
, php7.2-json
, php7.2-opcache
, php7.2-readline
. But we’re going to manually specify them just in case.Packages | Software that requires them |
---|---|
curl | OpenCart, Magento |
gd | OpenCart, Magento, WordPress |
gettext | phpmyadmin |
intl | Magento |
mbstring | OpenCart, Magento |
mcrypt | OpenCart, Magento |
openssl | Magento |
xml | OpenCart |
xsl | Magento |
zip | OpenCart, Magento |
1sudo apt-get update
2sudo apt-get install php7.0-gd php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-openssl php7.0-zip
3sudo service apache2 restart
mod_rewrite
Apache module is required by WordPress and OpenCart. It is usually required by any software that uses pretty/SEO/custom URLs.1a2enmod rewrite
1phpenmod -v 7.2 mcrypt
1sudo apt install phpmyadmin -y