wget -c http:\/\/wordpress.org\/latest.tar.gz<\/pre>\nThen, extract the file with:<\/p>\n
tar -xzvf latest.tar.gz<\/pre>\nAll the WordPress files will be now placed in the wordpress<\/strong> directory in \/var\/www\/html\/wordpres<\/strong><\/p>\nWe also need to set the correct permissions of this directory so our Apache web server can access these files. To give ownership of the WordPress files to our Apache web server, run the following command:<\/p>\n
chown -R www-data:www-data \/var\/www\/html\/wordpress<\/pre>\n<\/span>Step 6: Create a database for WordPress<\/span><\/h2>\nNow, we will create our MySQL database for our WordPress site. Login to your MySQL server with the following command and enter your MySQL root password:<\/p>\n
mysql -u root -p<\/pre>\nTo create a new database for our WordPress installation, run the following commands:<\/p>\n
CREATE DATABASE wordpress_db<\/span>;\nGRANT ALL PRIVILEGES ON wordpress_db<\/span>.* TO 'wordpress_user<\/span>'@'localhost' IDENTIFIED BY 'PASSWORD<\/span>';\nFLUSH PRIVILEGES;\nexit;<\/pre>\nYou can replace the database name (wordpress_db) and the MySQL user name (wordpreess_user) with your own names. Also, make sure to replace “PASSWORD” with an actual, strong password.<\/p>\n
Once the database is created, we will need to add this information to the WordPress configuration file.<\/p>\n
Make sure you are inside the \/var\/www\/html\/wordpress<\/strong> directory and run the following command to rename the sample configuration file:<\/p>\nmv wp-config-sample.php wp-config.php<\/pre>\nNow open the wp-config.php<\/strong> file with your favourite text editor, for example:<\/p>\nnano wp-config.php<\/pre>\nAnd update the database settings, replacing database_name_here<\/em><\/strong>, username_here<\/em><\/strong> and password_here<\/em><\/strong> with your own details:<\/p>\n\/\/ ** MySQL settings - You can get this info from your web host ** \/\/\n\/** The name of the database for WordPress *\/\ndefine('DB_NAME', 'wordpress_db<\/span>');\n\n\/** MySQL database username *\/\ndefine('DB_USER', 'wordpress_user<\/span>');\n\n\/** MySQL database password *\/\ndefine('DB_PASSWORD', 'PASSWORD<\/span>');\n\n\/** MySQL hostname *\/\ndefine('DB_HOST', 'localhost');\n\n\/** Database Charset to use in creating database tables. *\/\ndefine('DB_CHARSET', 'utf8');\n\n\/** The Database Collate type. Don't change this if in doubt. *\/\ndefine('DB_COLLATE', '');<\/pre>\nSave and exit the file.<\/p>\n
Restart your Apache and MySQL server with:<\/p>\n
systemctl restart apache2\nsystemctl restart mysql<\/pre>\nWith this being done, you can now access your WordPress and finish the installation by following the on-screen instructions in your browser at http:\/\/your_server_ip_address\/wordpress<\/strong><\/p>\n