Skip to content
Install WordPress on Ubuntu 18.04

Install WordPress on Ubuntu 18.04

Written in 2020 for Ubuntu 18.04 and PHP 7.4, both now end-of-life. Commands may be outdated.

Nothing special here except PHP: WordPress requires PHP 7.3 or newer, which isn’t in the default Ubuntu 18.04 repositories. So this post is mostly about compiling a recent PHP. Step by step:

  1. Install the required packages:

    apt-get update
    # general applications
    apt-get install vim pwgen nginx mysql-server certbot
    # required for the build
    apt-get install build-essential pkg-config libxml2-dev sqlite3 libsystemd libsystemd-dev libcurl4 libcurl4-openssl-dev libpng-dev libonig-dev libzip-dev
  2. Build and install PHP:

    mkdir -p ~/temp && cd ~/temp
    wget https://www.php.net/distributions/php-7.4.5.tar.gz
    tar -xzf php-7.4.5.tar.gz && cd php-7.4.5
    ./configure --enable-fpm --with-mysqli --with-fpm-systemd --with-zip --enable-soap --with-xmlrpc --enable-mbstring --enable-intl --with-curl --enable-gd
    make
    make install
    cp php.ini-production /usr/local/php/php.ini
    cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
    cp sapi/fpm/php-fpm /usr/local/bin
    cp sapi/fpm/php-fpm.service /etc/systemd/system/php-fpm.service
    systemctl daemon-reload
    systemctl start php-fpm
  3. Download WordPress:

    cd /var/www
    wget https://wordpress.org/latest.tar.gz
    tar -xzf latest.tar.gz
  4. Configure nginx, PHP-FPM and MySQL – see the official documentation below.

Links

Last updated on