How to Install WordPress on Ubuntu

In the future, using the website cloudhosting.lv, you agree to the rules of using Cookies. Read more. I agree

How to install WordPress on Ubuntu

In this tutorial, we’ll show you how to install WordPress on VPS with Ubuntu. WordPress is a free, powerful, open source content management system. It is built on PHP and uses MySQL to store its data. It has a very user-friendly interface and does not require coding skills. WordPress supports over 50 million websites around the world and has thousands of themes and plugins available to populate your site. With WordPress, you can create almost any website, such as blogs, e-commerce sites, business portfolios, hotels and reservations, etc.Requirements for installing WordPress: you must have PHP version 5.6 or higher and MySQL version 5.6 or higher. In addition, a web server must be running and running on your VPS. Refer to the LAMP installation instructions with phpMyAdmin in the Ubuntu manual to set up the necessary environment for installing WordPress. There is no need to install phpMyAdmin on VPS, but it makes database management easier. In this guide, we will look at both options: creating a database and user using the MySQL command line, as well as creating a database and database user using phpMyAdmin. You can use any method available to configure the database for your WordPress installation. Create database and user using MySQL command line WordPress uses a MySQL database to store all of its data, so we will start the installation by creating a MySQL database. Enter your MySQL command line using the following command in your terminal.

mysql -u root -p

This command indicates that you are logging into MySQL using the root username, which is the administrative account for MySQL. It will ask for the password for your MySQL root account, provide a password to enter the MySQL command line. If you did not specify a root password, remove the -p option.

After entering MySQL, you can create the database using the following command.

CREATE DATABASE ;

You can specify any name for your database in the location ``. In this tutorial, we will use wpdata as the name of an example database. Team

CREATE DATABASE wpdata;

will create an empty wpdata database in MySQL. Note that each command in MySQL ends with a semicolon, use the semicolon where indicated to avoid errors. For security reasons, it is recommended that you create a separate database user for the database that we will use with WordPress, and not with the root MySQL user. It also facilitates database management. We will create a new MySQL database user who will have full access only to the database that we recently created, i.e. to wpdata. For example, we will call this user wpuser. You can use whatever name you want for your database user. The command to create the wpuser user database will be

CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'MyStrongPassword';

You can use any password instead of MyStrongPassword, you must create a very strong password. The above command will create a user named wpuser, and the password for wpuser will be MyStrongPassword. Now that we have created the database and the user, but the wpuser user does not have access to the wpdata database, you can give wpuser all permissions for the wpdata database by running the following command.

GRANT ALL PRIVILEGES ON wpdata.* TO wpuser@localhost;

Now that we have made all the necessary changes to MySQL, we need to tell MySQL about the latest changes that we have made. We can do this by running the following command.

FLUSH PRIVILEGES;

This command will reset all privileges and MySQL will immediately implement your latest changes. Now that we have everything related to the database, you can exit the MySQL command line using the exit command.

Create database and user using phpMyAdmin

phpMyAdmin provides a graphical user interface for managing databases. This is a very convenient tool for editing information stored in the database. If you have already configured the database using the MySQL command line, skip this step and go directly to installing WordPress. Log in to your phpMyAdmin control panel by opening the following URL in your browser.

http:///phpmyadmin

For example, if you have a public IP address of 100.20.30.25, you should open:

http://100.20.30.25/phpmyadmin

You can also use your domain name instead of the IP address if you have this setting. Now log in to phpMyAdmin using your MySQL root user and password. To create a database via phpMyAdmin, click on the "Create" link in the left pane above the list of databases. In the next step, you will find the interface for creating the database, as shown below, enter the name of the database that you want to create. In this tutorial, we will use a database called wpdata. Click Create to create an empty database. Once the database is created, you will see the name of the database in the left pane, click on the database to select it. When the database is selected, it will show the structure of the database, since in your case the database is empty, it will show you a message: there are no tables in the database. Click on the Privileges tab in the top menu to view the users who have access to the database that we created. You will see that most of the users who have access to your database are currently global users, such as root. We will need to create a user for your database. Click “Add User” to add another user to your database. You will see an interface for entering a username and password for your new user. In the Login Information section, enter the username for your new user. Leave the default value in the Host text box, which is%. Enter a strong password for your user, if you want, you can generate a password instead. In the "Database for the user" section, select the third check box to provide all privileges for the "wpdata" database. The database name may vary depending on the database that you created earlier. Finally, click the Go button to create a new user for your database and assign it full access rights to your database. Now that we have the database and custom database setup, we can start the installation of WordPress.

WordPress Installation

Start by logging into your VPS terminal. If you are logged in using the root account in VPS, you can skip the sudo command in front of all the commands. If you are logged in with a non-root account, you will have to use sudo before all the commands, or you can use the su command to switch to the root account. WordPress needs some additional packages for it to work and perform additional tasks, such as sending emails, image editing, etc. It is recommended that you install these packages as well. To install recommended php packages run the following command in your terminal.

sudo apt-get install php5-cli php5-dev php5-fpm php5-cgi php5-mysql php5-xmlrpc php5-curl php5-gd php-apc php-pear php5-imap php5-mcrypt php5-pspell

If you already have some packages installed, the system will update them. Now download the latest copy of your WordPress CMS by running the following command in your terminal.

wget http://wordpress.org/latest.tar.gz

Unzip this archive by running the following command.

tar -xzvf latest.tar.gz

This will extract all the files from the archive into the WordPress directory. Move files from WordPress to the Apache root web directory by running the following command.

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

If you still have not deleted the default Apache page from the / var / www / html / directory, you can do this by running the following command.

sudo rm /var/www/html/index.html

Next, we will need to change the owner of the / var / www / html directory to the Apache web server user, which is www-data. This will increase directory security and also allow the Apache web server to create and modify any file or directory. Otherwise, WordPress will not be able to create a file or directory for storing files. To change ownership to the Apache web server process, run the following command.

sudo chown -R www-data:www-data /var/www/html/

Now we need to go to the WordPress web interface to complete the installation. Access your website through any web browser, using the public IP address of your VPS or your domain name. You will see a welcome screen from WordPress, and you will be asked to choose your preferred installation language. Select your language and click Continue. In the next step, you will be asked to make sure that you have the database name, database username and password, and the host is ready. Click on the button Let's go! continue installation. Next, you will be asked to specify the database name, username and password. Fill in these fields in accordance with the database that we created earlier. For the database node, leave this field as localhost. In the "Table Prefix" field, you can leave this parameter unchanged. After filling out all the information, click the "Submit" button to proceed to the next step. If WordPress can establish a successful database connection, it will tell you that WordPress can communicate with the database and you can start the installation. Click on the Run installation button. WordPress will start the installation. In the next step, you will be asked to provide the name of your site, as well as the username, password and email address for your WordPress admin. Click on the Install WordPress button and it will write the changes to the database. Fill in the details accordingly and write down your email address and password, as you will need to enter your Wordpress admin panel WordPress has been installed. Now you can log in to your WordPress admin panel by clicking on the “Login” button. You can always log in to your WordPress admin panel by clicking on the following link in your web browser.

http:///wp-login.php
http:///wp-admin/

Resume

In this guide, we learned how to create a database and database user using the MySQL command line or through phpMyAdmin. Then we learned how to install WordPress on the LAMP stack. You now have a WordPress installation in your VPS that can be used to create many types of websites..