Installing WordPress 4.8 on Ubuntu 17.04 Server

source: https://websiteforstudents.com/installing-wordpress-4-8-ubuntu-17-04-server/


WordPress 4.8 (Evans) has just been released. Those already running WordPress websites can upgrade simply by logging on to the admin dashboard and going to the Updates link to easily upgrade.
This brief tutorial is going to show you how to install a brand new WordPress 4.8 on Ubuntu 17.04 systems. This post is written for WordPress 4.8 but can be applied to other previous and future versions of WordPress.

For more about WordPress 4.8, please check this page.
When you’re ready with installing WordPress on Ubuntu, follow the steps below:

 

Step 1: Install Apache2 Web Server on Ubuntu

A web server is required for WordPress to function. The most popular web server in used today is Apache2, so we’re going with it. You could use others, but Apache2 is suitable for this post.
To install Apache2, run the commands below
 
sudo apt-get update
sudo apt-get install apache2

After installing Apache2, the commands below show you how to stop, start and enable Apache2 server.
 
sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

Step 2: Install MySQL Database Server

After installing Apache2, run the commands below to install MySQL database server. For this post, we’re going to be using MySQL database server as it’s the most popular database server in used today.
To install MySQL, run the commands below.

sudo apt-get install mysql-server mysql-client

During the installation, you’ll be prompted to create and confirm the root user password. Please do.
After installation, the commands below show you how to stop, start, and enable MySQL service.
 
sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service

STEP 3: CREATE WORDPRESS DATABASE AND USER

After installing MySQL server, run the commands below to logon to the database server

sudo mysql -u root -p

You’ll be prompted to enter a root password. Type the one you created above for the root user.
Next, run the SQL commands below to create a database called wordpressdb.

CREATE DATABASE wordpressdb;

Run the commands below to create a new user named wpuser with new password, and grant the user access to the wordpressdb databases.

GRANT ALL ON wordpressdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'type_new_password_here';

After that, run the commands below to save your changes and exit.
 
FLUSH PRIVILEGES;
exit

Step 4: Installing PHP and Related PHP Modules

Now that Apache2 and MySQL are installed, the last piece of software to install is PHP. Other related PHP modules are also important to install. To install them run the commands below.

sudo apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-pear php-imagick php-imap php-mcrypt php-recode php-tidy php-xmlrpc

The commands above will get all that are required for WordPress to function.

STEP 5: DOWNLOAD WORDPRESS CONTENT

Now that all the packages and server required by WordPress are installed, go and download WordPress content from online.
Use the commands below to do that.

cd /tmp/ && wget http://wordpress.org/latest.tar.gz

Then run the commands below to extract the download folder and move WordPress content to Apache2 default document root on Ubuntu servers. The default document root is at /var/www/html.
 
tar -xzvf latest.tar.gz
sudo cp -R wordpress/* /var/www/html

Next, run the delete Apache2 default index.html file from document root.
sudo rm -rf /var/www/html/index.html

STEP 6: CONFIGURE WORDPRESS

After Downloading WordPress, follow the steps below to configure WordPress with the database connecting settings created above.
First, run the commands below to create WordPress wp-config.php settings file from its sample.

sudo cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php

Then open wp-config.php file and make the following highlighted changes to reference the database and user you created above.

sudo nano /var/www/html/wp-config.php

When the file opens, make the changes and save.
 
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpressdb');

/** MySQL database username */
define('DB_USER', 'wpuser');

/** MySQL database password */
define('DB_PASSWORD', 'new_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', '');

After configuring WordPress settings, you next step will be to change Apache2 directory permissions so WordPress can function properly. To do that, run the below commands
 
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

Finally, run the commands below to enable some important Apache2 modules and restart the server
 
sudo a2enmod headers
sudo a2enmod rewrite
sudo a2enmod env
sudo a2enmod dir
sudo a2enmod mime

Restart Apache2

sudo systemctl restart apache2

Then open your web browser and browse to the server host name or IP address
http://192.168.1.2
You should see WordPress default setup page ready for you to create a user account with password. After that, WordPress should function perfect.
WordPress default setup page


Comentarios