How to Install WordPress Ubuntu Using LAMP Stack

For those who cannot afford the hustles of developing websites from scratch, there are now several content management systems (CMSs) such as WordPress that you can take advantage of to set up blogs as well as complete websites with a few clicks.

WordPress is a powerful, free, and open-source, highly pluggable, and customizable CMS that is being used by millions around the world to run blogs and fully functional websites.

It is easy to install and learn, especially for persons who do not have prior website design and development knowledge. With millions of plugins and themes available, developed by an active and dedicated community of fellow users and developers, that you can utilize to tailor your blog or website to work and look just the way you want.

Requirements:

  • A dedicated Ubuntu server with a registered domain name, I suggest you go for Linode hosting, which offers $100 credit to try it for free.

In this post, we shall run through the various steps you can follow, to install the latest version of WordPress on Ubuntu 20.04, Ubuntu 18.04, and Ubuntu 16.04 with LAMP (Linux, Apache, MySQL, and PHP) stack.

Install LAMP Stack on Ubuntu Server

First, we shall uncover the various steps for the installation of the LAMP stack before progressing to install WordPress.

Step 1: Install Apache Web Server on Ubuntu

First, update and upgrade the software package list and then install the Apache webserver using the following commands.

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install apache2 apache2-utils 
Install Apache in Ubuntu
Install Apache in Ubuntu

We need to enable the Apache2 web server to start at system boot time, as well as start the service and verify the status as follows:

$ sudo systemctl enable apache2
$ sudo systemctl start apache2
$ sudo systemctl status apache2
Check Apache Status in Ubuntu
Check Apache Status in Ubuntu

Once you’ve started Apache, you then need to allow HTTP traffic on your UFW firewall as shown.

$ sudo ufw allow in "Apache"
$ sudo ufw status
Open Apache Port on UFW Firewall
Open Apache Port on UFW Firewall

To test whether the Apache server is running, open your web browser and enter the following URL in the address bar.

http://server_address
OR
http://your-domain.com

The Apache2 default index page will be displayed in case the webserver is up and running.

Apache Default Page Under Ubuntu
Apache Default Page Under Ubuntu

Note: The Apache default root directory is /var/www/html, all your web files will be stored in this directory.

Step 2: Install MySQL Database Server

Next, we need to install the MySQL database server by running the command below:

$ sudo apt-get install mysql-client mysql-server
Install MySQL in Ubuntu
Install MySQL in Ubuntu

If you want to install MariaDB, you can install it using the following command.

$ sudo apt-get install mariadb-server mariadb-client
Install MariaDB in Ubuntu
Install MariaDB in Ubuntu

Once the database server is installed, it is strongly advised that you run a security script to remove insecure default settings and protect your database system.

$ sudo mysql_secure_installation 

Firstly, you will be asked to install the ‘validate_password’ plugin, so type in Y/Yes and press Enter and also choose the default password strength level.

Set MySQL Root Password in Ubuntu
Set MySQL Root Password in Ubuntu

For the remaining questions, press Y and hit the ENTER key at each prompt.

Secure MySQL in Ubuntu
Secure MySQL in Ubuntu

Step 3: Install PHP in Ubuntu

Last but not least, we shall install PHP and a few modules for it to work with the web and database servers using the command below:

$ sudo apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip 
Install PHP in Ubuntu
Install PHP in Ubuntu

Once PHP and all required extensions are installed, you need to restart Apache to load these new extensions.

$ sudo systemctl restart apache2

Furthermore, to test if php is working in collaboration with the webserver, we need to create a info.php file inside /var/www/html.

$ sudo vi /var/www/html/info.php

And paste the code below into the file, save it, and exit.

<?php 
phpinfo();
?>

When that is done, open your web browser and type in the following URL in the address bar.

http://server_address/info.php
OR
http://your-domain.com/info.php

You should be able to view the php info page below as a confirmation.

Check PHP Info in Ubuntu
Check PHP Info in Ubuntu

Step 4: Install WordPress in Ubuntu

Download the latest version of the WordPress package and extract it by issuing the commands below on the terminal:

$ wget -c http://wordpress.org/latest.tar.gz
$ tar -xzvf latest.tar.gz

Then move the WordPress files from the extracted folder to the Apache default root directory, /var/www/html/:

$ sudo mv wordpress/* /var/www/html/

Next, set the correct permissions on the website directory, that is give ownership of the WordPress files to the webserver as follows:

$ sudo chown -R www-data:www-data /var/www/html/
$ sudo chmod -R 755 /var/www/html/

Step 5: Create WordPress Database

Execute the command below and provide the root user password, then hit Enter to move to the mysql shell:

$ sudo mysql -u root -p 

At the mysql shell, type the following commands, pressing Enter after each line of a mysql command. Remember to use your own, valid values for database_name, database user, and also use a strong and secure password as databaseuser_password:

mysql> CREATE DATABASE wp_myblog;
mysql> CREATE USER 'username'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
mysql> GRANT ALL ON wp_myblog.* TO 'username'@'%';
mysql> FLUSH PRIVILEGES;
mysql> EXIT;
Create WordPress Database
Create WordPress Database

Go the /var/www/html/ directory and rename existing wp-config-sample.php to wp-config.php. Also, make sure to remove the default Apache index page.

$ cd /var/www/html/
$ sudo mv wp-config-sample.php wp-config.php
$ sudo rm -rf index.html

Then update it with your database information under the MySQL settings section (refer to the highlighted boxes in the image below):

WordPress MySQL Settings
WordPress MySQL Settings

Afterward, restart the web server and mysql service using the commands below:

$ sudo systemctl restart apache2.service 
$ sudo systemctl restart mysql.service 

Open your web browser, then enter your domain name or server address as shown.

http://server_address/info.php
OR
http://your-domain.com/info.php

You will get the welcome page below. Read through the page and click on “Let’s go!” to proceed further and fill in all requested on-screen information.

Choose WordPress Language
Choose WordPress Language
Set WordPress Details
Set WordPress Details
WordPress Dashboard
WordPress Dashboard

Hoping that everything went on just fine, you can now enjoy WordPress on your system. However, to express any concerns or ask questions concerning the steps above or even provide additional information that you think has not been included in this tutorial, you can use the feedback section below to get back to us.

Aaron Kili
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

200 Comments

Leave a Reply
  1. Hi, I installed this and it runs perfectly when I access it from my local IP.

    But i can not access it when typing my domain. Can you help me?

    Reply
  2. Hey! I am hosting different sites on my server. After following the tutorial I reach a 404, here’s my apache file:

        # The primary domain for this host
        ServerName mysite.xyz
        # Optionally have other subdomains also managed by this Virtual Host
        ServerAlias mysite.xyz *.mysite.xyz
        DocumentRoot /var/www/html/mysite.xyz/public_html
        
            Require all granted
            # Allow local .htaccess to override Apache configuration settings
            AllowOverride all
            Order allow,deny
            Allow from all
        
        # Enable RewriteEngine
        RewriteEngine on
        RewriteOptions inherit
    
        # Block .svn, .git
        RewriteRule \.(svn|git)(/)?$ - [F]
    
        # Catchall redirect to www.mysite.xyz
        RewriteCond %{HTTP_HOST}   !^www.mysite\.xyz [NC]
        RewriteCond %{HTTP_HOST}   !^$
        RewriteRule ^/(.*)         https://www.mysite.xyz/\ [L,R]
    
        # Recommended: XSS protection
        
            Header set X-XSS-Protection "1; mode=block"
            Header always append X-Frame-Options SAMEORIGIN
        

    Any idea what I am doing wrong here?

    Reply
  3. Hi, After giving mysql_secure_installation, I got this error:

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

    What should I do? I use Linux Mint. Thanks

    Reply
    • @ambars

      Check if the mysql service is running, it should be started automatically in Ubuntu:

      $ sudo systemctl status MySQL
      

      Otherwise, start and enable it like this:

      $ sudo systemctl start mysql
      $ sudo systemctl enable MySQL
      
      Reply
      • I had similar issues, just to add to future refs to this. Stop Nginx/Apache2 “sudo service apache2 stop” then “sudo service MySQL start” solves this issue.

        Reply
  4. like jayjay said, doing ‘sudo chmod -R 755 /var/www/html/‘ is a silly idea. You are giving read and execute permissions on everything to the world.

    Better way of doing this would be:

    # find /var/www/html -type d -exec chmod 0755 {} \;
    # find /var/www/html -type f -exec chmod 0644 {} \;
    

    Setting all directories to 755 and all files to 644. once you’re finished with the .htaccess it also advised to chmod that to 600 too so you don’t even have read access from the world or group.

    Reply
  5. Thank you for the blog, it works well, except the “due to “mv wp-config-sample.php wp-config.php” I was not able to get the page. so I revert the changes and give wp-config-sample.php.” issue.

    Reply
  6. due to “mv wp-config-sample.php wp-config.php” I was not able to get the page. so I revert the changes and give wp-config-sample.php. Then I only I am able to see given page.

    Reply
    • @Sultan

      There is a difference between ‘DB_NAME‘ and ’DB_NAME’. Please cross-check this, in case you have copied and pasted.

      Reply
  7. Then update it with your database information under the MySQL settings section (refer to the highlighted boxes in the image below):

    I do not understand about this

    Sorry for bad English

    Reply
    • @SUTAN

      The screenshot is not actually included but all you need to do in that step is enter database connection settings. Check out the command section(dark blue).

      Reply
  8. Followed all the steps but I am still seeing the Apache2 Ubuntu Default Page and not the WordPress welcome page. Any ideas?

    Reply
  9. Good article, but there is some problem how to connect WordPress with MySQL and how data can be retrieved from MySQL to WordPress and vice versa ??

    Reply
    • @Onir

      Go the /var/www/html/ directory and rename existing wp-config-sample.php to wp-config.php, then update it with your database information under the MySQL settings section. Refer to Step 5: Create WordPress Database.

      Reply
      • Where is this MySQL “settings section“? When I try to use define(...); while logged in, I get a syntax error. That part is extremely vague.

        Reply
  10. Hi, everything worked well thanks, but when I’m in WordPress and go to customize the site I’m shown the Apache2 Ubuntu Default Page :( and not the site.

    Hope you can help me.
    Thanks

    Reply
  11. I stopped at step 2 (with this error) in this guide :(

    The following packages have unmet dependencies:
    mariadb-server : Depends: mariadb-server-10.1 (>= 1:10.1.40-0ubuntu0.18.04.1) but it is not going to be installed
    E: Unbale to correct problems, you have held broken packages.
    

    Do you have any solution to solve this error?

    Thanks, Kim

    Reply
      • After running the command: "sudo apt-get install -f".

        I tried to run the command: "sudo apt-get install mariadb-server mariadb-client" again. But still got the same error.

        Is there other things that can solve this problem ??

        Thanks, Kim

        Reply
        • @Kim,

          First remove the installed MariaDB using the following commands.

          $ sudo apt-get remove --purge mariadb-server
          $ sudo apt-get autoremove
          $ sudo apt-get autoclean
          

          Once removed, try to install MariaDB again.

          $ sudo apt-get install mariadb-server mariadb-client
          
          Reply
  12. When i try the http://server-address – it shows me the Apache Ubuntu default page, did I miss something?, I was able to access the config file thru http://server-address/wp-admin/setup-config.php.

    Reply
  13. I followed the instructions and this worked great! Built it on an EC2 Instance ion AWS and shut it down over night. When i restarted the server in the morning, It no longer starts the WP site. I have checked the services to ensure Apache and mySQL services are running.

    I’m not a Linux engineer, but what else do i need to check to get it started?

    It all installed fine :(
    Thanks

    Reply
  14. #  mysql -u root -p
    Enter password: 
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    

    Cannot go any further..

    Reply
  15. Help please I am stuck on step 3 and I am getting the following error messages:

    E: Couldn't find any package by glob 'php7.0-mysql'
    E: Couldn't find any package by regex 'php7.0-mysql'
    E: Unable to locate package libapache2-mod-php7.0
    E: Couldn't find any package by glob 'libapache2-mod-php7.0'
    E: Couldn't find any package by regex 'libapache2-mod-php7.0'
    E: Unable to locate package php7.0-cli
    E: Couldn't find any package by glob 'php7.0-cli'
    E: Couldn't find any package by regex 'php7.0-cli'
    E: Unable to locate package php7.0-cgi
    E: Couldn't find any package by glob 'php7.0-cgi'
    E: Couldn't find any package by regex 'php7.0-cgi'
    E: Unable to locate package php7.0-gd
    E: Couldn't find any package by glob 'php7.0-gd'
    

    What should I do?

    Reply
    • @Freeman,

      Are you sure you are using Ubuntu 16.10 or 16.04? please confirm this first. If you are using older Ubuntu 14.04, then PHP 7 is not available from the standard Ubuntu repositories (2016-01-02).

      You could use the PPA ppa:ondrej/php.

      $ sudo apt-add-repository ppa:ondrej/php
      $ sudo apt-get update
      $ sudo apt-get install php7.0
      
      Reply
  16. I installed wordpress on ubuntu and I am trying various plugins but how I will check plugin is working on website, I mean will it show changes just by writing IP address on browser or any other process to check plugins effect working or not .

    Reply
    • @Mr.S

      Okay, thanks for the addition, but, adding wordpress parameter depends on your website root(where actual wordpress files are stored).

      Reply
  17. I think a missing step that everyone is likely to hit is the need to remove the “index.html” from the root directory. I removed and things got immediately better. The next hurdle for me is figuring out why the mod-rewrite rules are not working (or that’s what I’m assuming is happening) … basically anything outside the root directory is coming as not found.

    Reply
  18. Hi,

    Thanks for sharing the information. I really need to setup a WordPress on my Linux server, I have one more Question is 512 ram is enough for WordPress on VPS server?

    Reply
  19. At the final step when I enter my wordpress website it says THIS SITE CAN’T BE REACHED and my IP address took too long to respond.

    This problem is driving me crazy PLEASE HELP!

    Reply
    • @Ben

      Ensure that there is connectivity to your server, if you are running a firewall, check if client requests are allowed via port 80(HTTP) to the web server. You can try pinging your server.

      Reply
  20. “then update it with your database information under the MySQL settings section (refer to the highlighted boxes in the image below):”

    I got stuck at this step. Where should I do all these? Is it I have to go to mysql -u root -p and then type all those command?

    Reply
    • @Sara

      Do that in the wp-config.php file. Remember, you first have to create the database after running mysql -u root -p, then you add those settings(database host, database name, database username and user password) in the wp-config.php.

      Reply
      • Thank you for your respond. When I proceed, I keep on getting the message below. Can you please help me once again?

        E325: ATTENTION
        Found a swap file by the name "/var/tmp/wp-config.php.swp"
        

        Why do I keep getting this message when I try to update my database information?

        Reply
        • @Sara,

          When a file is not properly closed, it will create a temporary file with same name as extension .swp, deleting this file will solve problem.

          # rm -rf /var/tmp/wp-config.php.swp
          
          Reply
  21. I’m setting this up on a home server. I had LAMP installed already, and my server IP address would load my “index.html” file. After loading WordPress, it still loads the “index.html” file (so no changes from pre-installation.) If I rename the “index.html” file, then nothing loads. What have I missed in my configuration? I can’t get to the “Let’s Go” welcome page. Thanks!

    Reply
    • @Benjamin

      Remove the default Apache index.html page and you will get the WordPress page, something like this:

      $ sudo rm /var/www/html/index.html
      
      Reply
      • I was having the same problem as Benjamin and I followed your recommendation by removing the default Apache index.html page, now when I load my localhost page I just get an error page that says “Error establishing a database connection”. I followed the tutorial, or I thought I did, do you have any idea what the problem could be?

        Reply
  22. I have no experience on this, I got stuck on step 2 of step 1. When I type this into virtual box it as a command.

    $ sudo systemctl start apache2
    

    It does nothing, i get the enable part but nothing when i do start?

    I am I suppose to type those in together then enter? if so how do you make it hit return to start a new line

    Reply
    • @J
      The command:

      $ sudo systemctl start apache2
      

      shows no output, to check if Apache2 server has been started yet, simply run this command:

      $ sudo systemctl status apache2
      

      Thanks.

      Reply
  23. Error establishing a database connection. I double and triple checked that my login details are right. I also checked that my database is up and running.
    Only thing I’m not sure is that in:

    mysql> GRANT ALL PRIVILEGES ON wp_myblog.* TO 'your_username_here'@'localhost' IDENTIFIED BY 'your_chosen_password_here';

    should I include the ' ' or delete them and replace with my username just. The same question about ' ' in the wp-config.php file.

    Reply
    • @kke

      You can use the same username in wp-config file here, as long as that user is responsible for managing the wordpress database:

      mysql> GRANT ALL PRIVILEGES ON wp_myblog.* TO ‘your_username_here’@’localhost’ IDENTIFIED BY ‘your_chosen_password_here’;

      Reply
  24. I followed all the steps, but when I entered my server address in my browser it shows the apache2 default page index. Really need help. Thank you.

    Reply
    • @Jack

      Thanks for the recommendation, we will find a way to add instructions to host multiple wordpress sites to this article or prepare a whole new article.

      Reply
      • THANK YOU! I have an IIS+PHP+Wordpress+MySQL setup, and host 9 websites from my house. I’d LOVE the stability and security of Linux as the backend, so I’m interested in making the leap! I’m marking this comment for follow-up via email. :) Thanks!

        Reply
  25. This was pretty great. I followed the step and could get wordpress running on my server. However, when I navigate to http://server_address, I still get the apache test page not the wordpress landing page.

    Reply
  26. I followed these directions using Ubuntu Server 16.04 LTS. When connecting from another computer, it tells me “Error establishing a database connection.” Any thoughts?

    Reply
    • @Richard

      Provide the correct database settings(host, database name, user and user password) in the wp-config.php file. Then try to connect once more.

      Reply
  27. This is by far the best explanation that I have seen for WordPress installation on Ubuntu Using LAMP Stack. Thank you very much. Very straight forward direction. Nicely written!

    Reply
  28. It seems your syntax is incorrect I copy and paste from your line:

    define(‘DB_NAME’, ‘database_name_here’); /** MySQL database username */ define(‘DB_USER’, ‘username_here’); /** MySQL database password */ define(‘DB_PASSWORD’, ‘password_here’); /** MySQL hostname */ define(‘DB_HOST’, ‘localhost’); /** Database Charset to use in creating database tables. */ define(‘DB_CHARSET’, ‘utf8’); /** The Database Collate type. Don’t change this if in doubt. */ define(‘DB_COLLATE’, ”);

    replace as you suggest but get the following error for all the entries

    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘define(‘DB_COLLATE’, ”)’ at line

    Reply
    • @callum

      Please, open the file wp-config.php:
      $sudo vi wp-config.php

      Then change the settings(database name, user, user password, host etc…) according to your database server configurations.

      Reply
  29. Great tutorial until i get to the section “then update it with your database information under the MySQL settings section (refer to the highlighted boxes in the image below):”

    I am sitting looking at command prompt how do i do the next section?

    Reply
    • @callum

      Create your wp-config.php file:
      $sudo mv wp-config-sample.php wp-config.php
      $sudo vim wp-config.php

      open and configure your database information in there.

      Reply
    • @Felipe

      Thanks for the kind words of appreciation, i glad that you found this article useful. Many thanks, also for following us.

      Reply
  30. So I followed the instructions and when I try to go to localhost I get a blank page. But the source for the page is as follows.

    <?php
    /**
     * Front to the WordPress application. This file doesn't do anything, but loads
     * wp-blog-header.php which does and tells WordPress to load the theme.
     *
     * @package WordPress
     */
    
    /**
     * Tells WordPress to load the WordPress theme and output it.
     *
     * @var bool
     */
    define('WP_USE_THEMES', true);
    
    /** Loads the WordPress Environment and Template */
    require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    

    What did I do wrong?

    Reply
  31. I’m new to the Linux OS and able to install my first php library i.e wordpress by myself. super easy to use instruction. Please keep up the good work.

    Many Thanks

    Reply
    • @Ravi

      Welcome, thanks for the kind words of appreciation. We always intend to offer simple, easy-to-follow and useful instructions in out guides, for Linux users with a special consideration for newbies.

      Reply
  32. Hello, thank you for this guide. Is this a good guide for a production server facing the internet? Are there any other steps that need to be taken in order to properly configure a production web server? Additional security, etc…

    Reply
  33. Thank you! Easy, painless install on Ubuntu Mate 17.04 using this tutorial. The only additional step I needed to take was renaming the original Apache index.html page so that I would be directed to index.php by default.

    Reply
  34. One item that I found needs to be added into this is after creating the database, it helps to do a :

    USE ; otherwise, MySQL doesn’t always change the database focus – this is particularly relevant if the password is wanting to be changed for the internal MySQL account.

    Reply
  35. Thanks for all your help. I was able to follow along on my up to date Linux Mint box up to the final steps of restarting the web server and mySQL:

    $ sudo systemctl restart apache2.service 
    $ sudo systemctl restart mysql.service 
    

    When I enter that, I always get the same error message:
    command not found

    I have rebooted, but I still encounter the same problem. When I go to localhost, I still only get the Apache2 Ubuntu Default Page, not WordPress.

    Second, for the step just above it, the config stage, I used the define DB_NAME, DB_USER and DB_PASSWORD from the actual online install of my site, although I presume at the fresh starting point it does not make much difference since the DB that will be used locally will be, well, local, and can have its own name, user and pw. So my question is this. Are we putting this info in there so that when WordPress does start up and go to create the DB, it uses that info provided?

    Thanks so much for all your help and info!

    Reply
  36. Thanks for this awesome guide, it helped a ton! I had a problem trying to connect to WP server after installing everything and editing my wp-config.php file. After a while of trouble shooting I realized the build file required the presence of the wp-config-sample.php file. I changed the name back to that ( so basically I ignored the $ sudo mv wp-config-sample.php wp-config.php ) and it came out fine.

    Reply
  37. I am new to Linux and WordPress, this helped me out a lot! Should the user create unique authentication keys and salts for this?

    Reply
    • @Isaac

      Not really, you can use the same credentials(username and password) for logging into the system here, or else create a new user for the database; hope that is what you meant.

      Many thanks for the feedback.

      Reply
  38. I love the conciseness of it. I’ve been working with *nix for years now and it’s great to have a simple article with clear commands; without any bloated discussion of why they should be run. I love that the lines don’t have a LF at the end so I can paste in without it executing. Keep it up!

    Reply
    • @Gibbs

      Hope you enjoyed reading it. We always intend to keep our articles simple, direct but with a lot of details to help a Linux user(especially with high consideration of newbies). Thanks a ton for the kind words of appreciation.

      Reply
    • @hari

      Check your database connection settings(i.e host, database name, user username and password). Ensure that they are correct as explained in Step 5 of the guide.

      Reply
  39. Hello, it’s really helpful but i have a question, why whenever i want to open the home and it doesn’t come out.. can you help me?

    Reply
    • @Tiara

      If you still have the Apache default page in your web server root, remove it like this:
      sudo rm /var/www/html/index.html

      Then you should be able to view the home page.

      Reply
  40. Hi Aaron, Thanks a lot. Simply I can say that just follow steps and anyone can simply install wordpress. Thank you very much. Only point that we need to remove index.html file as after all done, it used to come to Apache page. Rest all great. I sorted out it by checking one of comment.

    Once again thank you and wish you good luck… Cheers!!!

    Reply
    • @Prashant

      Welcome, hope you enjoyed the article. Our aim is to always make guides that are practical, simple, direct and effective for the reader. And many thanks for following us.

      Reply
  41. This worked pretty well, sometimes the copy paste adds an extra space in the .php file. The only thing I haven’t found a way to fix is when I try to add a theme that is zipped, PHP says the file is too big and the php.ini file needs an update.

    well looked and there is no setting I can find that sets the max file size.. my file is 4 mb.. any ideas?

    Reply
    • @Ed Terry

      This is possibly as a result of allowed file upload size, you can change it in the php.ini file using the variable below(take note of your PHP version to find location of the config file):
      sudo vi /etc/php/7.0/apache2/php.ini
      upload_max_filesize = 2M(set this to an appropriate size)

      Reply
    • @Vignesh

      To change ownership of all files/sub-directories under /var/www/html to user www-data and group www-data. www-data is a user/group created specifically for web servers such as Apache.

      Reply
  42. Thank you VERY much for this free & detailed guide. I ran into a few bumps but I got it solved. You are the best. Thank you. It is people like you who put in the hard hours posting excellent documentation that makes life easy for the rest of us.

    Reply
  43. I did everything correctly but it still displays the ordinary apache2 page, the info.php thing worked but wordpress doesn’t

    Reply
  44. This is easily my favorite installation guide. It doesn’t miss a thing and is straight to the point. I think it took me less than five minutes to set up my desktop sandbox server.

    I’ve done this before but always need a guide and this is my favorite

    Thanks

    Reply
    • I have to thanks, Great job Aaron! This should be a template for other installation guides? It took literally 10 min to set up the WordPress on our server.

      Reply
      • @Mahesh

        Sure, welcome and thanks for the kind words of appreciation. Always remember to follow Tecmint for the best, up-to-date guides and more.

        Reply
  45. While uploading any file under WordPress, it asking to provide FTP details, so can you please tell me how to create FTP account and how to configure it properly?

    Reply
  46. My wordpress setup page is not loading. I even tried the fix from Anthony K above. Any suggestions?

    “I also had to modify `/etc/php/7.0/apache2/php.ini`:
    From:

    short_open_tag = Off
    To:
    short_open_tag = On
    To get the browser to load the WordPress page.”

    Reply
    • @Mark

      There could be a an issue with your configs, try to check and make sure they are correct. Alternatively, if you have the default web server page(.html), try to remove it.

      Reply
      • I removed the index.html page from /var/www/html/ but the default Apache page still shows up. I’ve followed all of the steps carefully and they have gone smoothly, but the WordPress setup page still doesn’t appear.

        Reply
          • Thanks for responding. I fixed the issue by reinstalling WordPress. However, I was working on developing a WordPress theme when I refreshed the page to see the changes I made, and suddenly every WordPress page I visit (including wp-login.php) is just blank. I’m not sure what happened, all I did before refreshing was create a .css file in my theme’s folder.

  47. I also had to modify `/etc/php7.0/apache2/php.ini`:
    From:

    short_open_tag = Off
    
    To:
    
    short_open_tag = On
    

    To get the browser to load the WordPress page.

    Reply
  48. Thanks for the tutorial. Easy to follow. I did have a problem getting up the WordPress page when I entered http://server-address (in my case localhost). It bought up the apache default test page, so I had to go in and rename or delete the index.html file in /var/www/html. Page now comes up straight away.

    Reply
  49. The newest Ubuntu Server 16.04 LTS and their built-in LAMP stack required the following addition to the PHP section:

    $ apt-get install php7.0-cli
    $ sudo a2dismod mpm_event 
    $ sudo a2enmod mpm_prefork
    

    I’m not sure if that’s what solved my issue, or in combination with the following that I also did, before forgetting to restart apache2:

    $ sudo apt-get install php-fpm
    $ sudo a2enconf php7.0-fpm
    $ sudo service apache2 restart
    

    Disclaimer: I don’t know anything about Linux/UNIX/etc — I was just trying to get a little LAMP Ubuntu wordpress server going in Hyper-V. However, after PHP configuration, apache2 failed to start.

    Cheers!

    Reply
  50. I’m trying to get through this process on a fresh Linux mint os. Step 3, creating the info.php inside /var/www/html I do the sudo vi command and get asked for the root password into the file. But for some reason when i paste the code provided I get this. And am unable to even save the file.

    I have had success in the past installing, but everytime I see the Apache 2 Ubuntu Default Page, I’m right back to square 1. Could it be permissions? Or am I simply pasting this he wrong way? Any help would be greatly appreciated, even if you know another linux distribution that would ease the pain. I’m new to linux and had kali before mint, I like to keep it all open source as I cant really take the crap from windows anymore. Cheers and Thanks in advance.

    Reply
    • @Charlie,

      I think you not familiar with VI editor, better use nano editor to add the php code to info.php file under /var/www/html directory..

      Reply
  51. Great tutorial kudos! Probably the most error free experience I’ve had, however a couple of things went wrong for me.

    1. WordPress was installed in my user folder and not /var/www/html
    2. /var/www/html didn’t have permissions to rename/delete wp-config-sample.php so had to use:

    $ sudo chmod -R 777 /var/www/html
    

    Thanks
    Don

    Reply
  52. I’ve gone through this Tutorial twice, and I keep getting the “Error establishing a database connection” Error, what could I be doing wrong/ how can I fix it?

    Reply
    • @Jessie,

      Please make sure that your MySQL database is running and also make sure that you’ve added correct MySQL database settings in wp-config.php file..

      Reply
      • I got it working, I was using the computer name in the host name slot, once i figured out the error of my ways I got it working, Thanks!

        Reply
  53. After renaming wp-config-sample.php to wp-config.php you have mentioned “update it with your database system under MySQL settings section” where can i find it in Ubuntu ?

    Reply
  54. Can you add or explain how I would get a .Org or .Com to work with this. I am trying to set up a website and cannot figure this part out. I have my DNS record setup with my host. I just don’t know on Ubuntu what configs needs to be done.

    Reply
    • @Jeff,

      Nothing to worry, its usual that all database settings are placed in config file of application only, no security concerns it will not expose to world..

      Reply
  55. Hi
    Thanks for the instructions, Unfortunately I am a newbie to Linux commands etc, I am having trouble copying and pasting this step.

    Furthermore, to test if php is working in collaboration with the web server, we need to create a info.php file inside /var/www/html.

    $ sudo vi /var/www/html/info.php
    

    And paste the code below into the file, save it and exit.

    When that is done, open your web browser and type in the this address http://server_address/info.php. You should be able to view the php info page below as a confirmation.

    please can you advise me in lehmans terms how to do this?

    sorry and thanks
    Regards
    Sean

    Reply
  56. I’ve followed these instructions and success fully installed WordPress. But when i click to the ‘Visit site’ link from the dashboard, it takes me to Apache2 default page instead of the wordpress welcome page. Can you help me to solve this ?

    Reply
  57. I noticed a typo in step 4.

    $ tar-xzvf latest.tar.gz

    should read
    $ tar -xzvf latest.tar.gz

    there should be a space between tar and -xzvf

    Reply
  58. I’ve followed these instructions twice from scratch. not sure what I’m doing wrong but when I go to http://server-address, it takes me to Apache2 default page “it works” instead of the wordpress welcome page. Any ideas on what I’m doing wrong? Thanks in advance

    Reply
  59. Thanks Aaron. You’ve got a typo in the tar process for the WP file: should be “tar -zxcf” not “tar-xzvf“. For newbies staring at the “tar-xzvf: command not found“, it’s confusing. A Google search turned up the answer, but it’s not readily apparent.

    Also, if you change the name of the wp-config.sample.php file, WordPress won’t find it when it initially comes up. You’ll get a “Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.”

    when you connect to WP from the browser. I changed it back and got the config screen. One more thing for newbies or the inattentive: when you go into the config file to change things, make sure you note that you are using your sql name (probably root)/password.

    I used vi to make the changes, which was kinda’ nice to use again after 35 years (now where’s my cheat sheet… :^)

    Bottom line, it works. Thanks and cheers,
    -mark

    Reply
    • @Mark

      Welcome, and many thanks for the wonderful suggestions and feedback. As for the typo, we shall correct it in the writeup. Lastly, i hope the newbies will find your insights useful and helpful.

      Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.