Install WordPress on your LAMP server - Ubuntu

Difficulty: 1
Time: 15 minutes

Installing WordPress on a server is more complicated than installing it on a shared hosting account. There are no automatic installers, so you have to do everything manually. However, with this guide you should be able to get WordPress up and running in about 15 minutes.

Install LAMP

To use this article, you need to have a LAMP stack installed on your server.

We also recommend setting up an Apache virtual host for the domain name you want to use, which includes pointing your domain name to it.

Create a MySQL database and user

  1. Log into your MySQL admin account:
    sudo mysql -u root -p
  2. At the prompt, enter the MySQL root password you chose:

    If you do not remember your root MySQL password, you can reset your root MySQL password.

  3. Create a new MySQL database:
    CREATE DATABASE your wordpress database;
  4. Create a new MySQL user and password:
    CREATE USER your username@localhost;
  5. Set the password for this new user. Make sure to use a safe passwword:
    SET PASSWORD FOR your username@localhost= PASSWORD("your password");
  6. Grant all privileges to this new user:
    GRANT ALL PRIVILEGES ON your wordpress database.* TO your username@localhost IDENTIFIED BY 'your password';
  7. Confirm that the changes to this user are properly applied:
    SHOW GRANTS FOR 'your username'@'localhost';
    If the changes worked, you should see an output that looks something like this:
    GRANT USAGE ON *.* TO 'your username'@'localhost' IDENTIFIED BY PASSWORD '*977FDAC11B3F74324912DA4F9D489A3E6D59B281'
    GRANT ALL PRIVILEGES ON `your wordpress database`.* TO 'your username'@'localhost'
    If the changes did not apply properly, refresh the MySQL cache and try again:
  8. Once you confirm that the changes worked, exit MySQL:

Download WordPress

You are ready to download and install WordPress.

  1. Navigate to your virtual host directory for the domain name:
    cd your domain's Apache virtual host directory

    If you didn't set up a virtual host directory, you can use cd /var/www/html

  2. Ensure this directory the correct permissions settings:
    sudo chmod -R 755 your domain's Apache virtual host directory
  3. Download the latest version of WordPress:
    sudo wget
  4. Extract the WordPress files:
    sudo tar xvzf latest.tar.gz
  5. Move these files into the current directory:
    sudo mv ./wordpress/* .
  6. Give the Apache user ownership of these files:
    sudo chown -R www-data:www-data your domain's Apache virtual host directory
  7. Remove the unused wordpress directory and the install package:
    sudo rmdir wordpress
    sudo rm latest.tar.gz

Configure and Install WordPress

You are now ready to start setting up your WordPress files for installation. You will start by connecting your WordPress files to the MySQL database you created earlier in this guide. This section of the guide will be done in your web browser.

  1. Enter your server's domain name or public IP address in your web browser.
    http://your domain name or IP
  2. Choose your language, then click Continue.
  3. Click Let's go!.
  4. Fill in the fields for your database information. These are the MySQL credentials you created earlier. For the hostname, use localhost. For the Table Prefix, you can keep the default of wp_, but it is often a better security practice to use a short, randomly generated prefix such as wQ2z_.
  5. Click Submit. This creates your wp-config.php file, which contains your database connection strings.
  6. Click Run the install to begin installing WordPress.
  7. Fill out the information for your Site Title, your WordPress administrator username and password, and the email address for that user.
  8. Click Install WordPress.

You can now log in by clicking Log in, or by navigating to http://your domain name or IP/wp-admin.

Next steps

You have installed WordPress on your server and you are now ready to start building with WordPress. For additional configuration options, or for information on how to start using WordPress, check out the official WordPress documentation.

Was This Article Helpful?
Thank You For Your Feedback
Glad we helped! Anything more we can do for you?
Sorry about that. How can we be more helpful?