How to install WordPress + LAMP on Ubuntu

wordpress logo

WordPress is much more than a blogging tool, and it would be a mistake to just stick with that aspect of this CMS (Content Management System, or content management system) that can become an all-in-one solution for a large number of cases since there are even plugins to set up ecommerce stores and there are powerful analytics and SEO tools, in order to improve the visibility of our content on the web.

Next we will see how to install WordPress on Ubuntu, something that luckily is quite simple and will allow us to host content on our server. For this, of course, we must first meet some requirements and one of them is that of have a functional installation of LAMP (acronym for Linux + Apache + MySQL + PHP), so that will be the beginning of our post today.

We install Apache:

# apt-getupdate

# apt-get install apache2

Once installed, we are going to test that the server is running, and for this we enter the local or internal URL of our server, which is in http://localhost.

Now we install PHP:

# apt-get install php5 libapache2-mod-php5 php5-mcrypt
# /etc/init.d/apache2 restart

Now we have to install MySQL:

# apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
# / usr / bin / mysql_secure_installation

We are going to be asked to enter the root password, and then we will have to indicate some questions, related to execution permissions, remote access, table loading and others, for which luckily we are offered some help although it does not hurt to accept the instructions by entering 'and' . Then we can get more firm with all this, but to begin there is no problem in accepting the default configuration.

Finally, we create the root user for mysql, we set your password (we change 'my password to the one we want to use) and restart Apache:

mysql -u root -p (we will be asked for the root password, which we enter)

CREATE DATABASE database;

CREATE USER wpuser @ localhost IDENTIFIED BY 'mypassword';

Now we are going to give our WordPress user access to everything necessary for his work:

GRANT ALL PRIVILEGES ON wordpress. * TO userwp @ localhost;

FLUSH PRIVILEGES;

exit

# /etc/init.d/apache2 restart

We are going well, now we have to download Worpress:

wget https://es.wordpress.org/wordpress-4.2.1-es_ES.zip

To extract it to its own directory we enter:

gunzip ./wordpress-4.2.1-es_ES.zip

Now we have to configure WordPress, for which we have to edit the wp-config-php file:

nano wp-config-php

And we look for the options that interest us, which are those of DB_USER, DB_NAME and DB_PASSWORD, so the file should be more or less similar to this, taking into account that the password and user data must be the ones we entered previously:

/ ** MySQL settings - You can get this info from your web host ** //

/ ** The name of the database for WordPress * /

define ('DB_NAME', 'database');

/ ** MySQL database username * /

define ('DB_USER', 'wpuser');

/ ** MySQL database password * /

define ('DB_PASSWORD', 'mypassword');

Now that we have everything configured as it should be, we are left with the last steps, and the first is that of copy this WordPress configuration into the root directory of our LAMP server installation, so that it can serve these contents to our visitors. We can do it by:

# cp -R ~ / wordpress / * / var / www / wordpress

Now we enter the administration panel of WordPress, at the address http: // localhost / wordpress, where we have to fill in the information of the administrator account (user, password) and then we simply let ourselves be guided by the configuration tool. That's it, we already have WordPress installed on Ubuntu, and we can start working with it.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   bcnabel29 said

    Great post, but being a newbie I hope you can help me. Guided by another tutorial I installed xampp in personal folder, and wordpress inside xampp in htdocs folder. I created a database and I accessed localhost / wordpress… the first correct step and I indicate the database name, user, password and server… but when going to the 2nd it tells me that it cannot or does not have permissions to write in the wp-config file and that I modify it manually… I do it but when I click on install, it redirects me again and again to step 1…. Would I have to copy the whole wordpress folder and move it to a directory created in var / www / wordpress?

  2.   Fran said

    Hello Willy, thank you first of all for the post. Please, can you review it?… I have followed it step by step and there must be a step missing. In the final check accessing http://localhost/wordpress, exits "The requested URL / wordpress was not found on this server"

  3.   Fran said

    POST PLAGUED WITH ERRORS

  4.   arthuroytal said

    I put it in / var / www / html / wordpress

  5.   joan carles said

    Hello! I just found this page that I find very useful. The problem is that I have followed WP installation advice in Ubuntu, locally, and it has been perfect but I have reached a section of the location of the pages made, try to add a folder for each project within the configuration and when I exit it appears WP in text mode and the header image and it won't let me out of there, I tried to delete mysql to see if it would delete everything and start over but it didn't let me. Right now I don't know where to go because I can't read either the .html or .php files in / var / www / hmtl. What can I do now? I cannot access the previous graphical format of WP or delete the Database generated with Mysql because it does not let me. How can I recover the previous WPress settings?