Video Walkthroughs at Superb Internet
close
Domain Name / Customer ID:

Password:

Forgot Password

All material © 1996 - 2024 Superb Internet Technologies Inc. // version-1.50.33
« Back to all videos

Wordpress on LEMP

Install Wordpress on LEMP

This video tutorial will show you how to install WordPress using nginx on your CentOS server. WordPress is a popular, free, open-source website and blogging platform that functions with PHP and MySQL. You need to have LEMP (Linux, nginx, MySQL, and PHP) installed on your CentOS server. (See a tutorial on how to do this here.)

  1. You can download the latest WordPress files right from the command prompt by executing:
    wget http://wordpress.org/latest.tar.gz
  2. Now, unzip the WordPress package by executing the command:
    tar -xzvf latest.tar.gz
  3. This will put the WordPress files into your home directory. Next, you will put the WordPress database, a user, and user password into the MySQL shell. Execute the command:
    mysql -u root -p
  4. When prompted, enter your MySQL root password and press "Enter" You will see that you’re now working in the MySQL shell. To create the new database, choose an identifiable name for your database and execute the following command:
    CREATE DATABASE dbname;
    (Replace dbname with your chosen name for the new database)
  5. Next, you will create the new user by executing the command:
    CREATE USER username@localhhost;
    (Replace username with the name of the new user)
  6. Then, set a password for the newly created user by executing the command:
     SET PASSWORD FOR username@localhost = PASSWORD ("userpass");
    (Replace username with the name of the new user and “userpass” with the password for the new user.)
  7. Next, you need to grant all privileges to the new user in order for the WordPress installer to function. Execute the following command:
    GRANT ALL PRIVILEGES ON dbname.* TO username@localhost IDENTIFIED BY 'userpass';
    (Replace dbname with the name of the new database, username with the name of the new user, and userpass with the password you set in the previous step.
  8. Now, update MySQL by executing the command:
    FLUSH PRIVILEGES;

You can now exit the MySQL shell. Type exit and press Enter

Set-up the WordPress configuration.

  1. To do this, copy the sample WordPress configuration file to a new file by executing the following command:
    cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
  2. You then need to open the newly created configuration file and edit some values in it by executing the command:
    vi ~/wordpress/wp-config.php
    In the file, locate the define ('DB_NAME', 'database_name_here'); line and begin editing the wp-config.php file. Press the Insert. key and change database_name_here to the database name you created in MySQL.
  3. Next, locate the define ('DB_USER', 'username_here'); line and change username_here to the username you created in MySQL. The last item to edit is found in the define ('DB_PASSWORD', 'password_here'); line. Change password_here to the password you set for the user in MySQL.
  4. Now, press the "Esc" key to stop editing the file and save the changes by executing: :w Exit the vi editor with the exit command: :q
  5. You’re almost finished. You now need to create the directory where the WordPress files will be stored. Execute the command:
    mkdir -p /var/www/wordpress
  6. To copy the unzipped WordPress files to the newly created directory, execute the command:
    cp -r ~/wordpress/* /var/www/wordpress
  7. Now you need to switch to the www directory by executing the command:
    cd /var/www/
    Next, you need to give ownership of the directory to the nginx user. To do this, run the following commands
    chown nginx:nginx * -R
    usermod -a -G nginx root
  8. Then, you need to set the WordPress virtual host. Open the nginx configuration file by executing the command:
    vi /etc/nginx/conf.d/default.conf
    Press the Insert key to edit the nginx configuration. Beneath the location / {" section, locate the "root /usr/share/nginx/html; line and change it to root /var/www/wordpress; Beneath the location ~ \.php$ {" section, locate the "root /usr/share/nginx/html; line and change it to root /var/www/wordpress; Now you can stop editing the file. Press the "Esc" key and save the changes with the save command: :w Exit the vi editor with the exit command: :q
  9. For the changes to take effect, restart the nginx by executing the command:
    service nginx restart
  10. Now you can access your new WordPress installation. Open your Internet browser and navigate to your newly created site. Your LEMP CentOS server is now configured with the new WordPress website and blogging tool.


comments powered by Disqus