WANT TO ENHANCE YOUR SKILLS ?
(Check Out This great Udemy Offer)
I want to learn more with great offers!!
I would rather search online and waste my time!!
WordPress is nothing but a free blogging content management system on the internet. You can manage all your blogs and websites with the help of WordPress. For getting the proper and easy working of WordPress, you need MySQL database as its backend with a little aid from PHP.
Then the most important thing is you have to install LAMP on Ubuntu 14.04. LAMP means Linux,Apache,MySQL and PHP.
So first you installed ubuntu that means Linux using above link. Next, you have to install Apache. From here, you have to follow the steps given below.
1) To install Apache, type the commands given below:
sudo apt-get update sudo apt-get install apache2
By typing this command, if anything new is written, it will be updated automatically. Then Apache2 will be installed. Sudo command is using in front of all commands in order to get the root privileges. If you installed properly, you can check that by visiting your web browser using your public IP address.
Example for IP address : 192.168.32.10. That means, go to web browser and type “http://192.168.32.10”. Then you will see the Apache2 Ubuntu Default Page. This is merely for testing purpose. Also, make sure that your web sever is successfully installed. If you didn’t remember your IP address you can type the below command in your web browser to retrieve your IP address.
2) To install MySQL, type the commands given below:
sudo apt-get install mysql-server php5-mysql
While installing, your server will ask your password for your “root” user. Then you have to follow it properly and remember the password too. Then you have to install the database securely by running the below command.
For having more security for the database, you have to run one more command.
Again for security purpose, MySQL root account will be asked. And then it will ask, whether you want to change the password or not. If you want to change, then you change it there itself. Otherwise, you can go with your earlier password itself. For the rest of the questions, you can simply accept the default values by hitting the “ENTER” key. By doing so, you will get the proper changes you want for your database and you can proceed with further steps.
3) To install PHP, type the commands given below:
Here we are including some helper packages also for the easiness.
sudo apt_get install php5 libapache2-mod-php5 php5-mcrypt
By doing so, PHP is installed.
4) Create a MySQL Database
For creating a database, you have to login into the MySQL root account by typing these commands in the terminal.Then only you will get the permission to create the database.
mysql -u root -p
It will ask your password for the MySQL root. Then you have to give that password as given while installing the MySQL database. Next, you have to create the database with a simple name. The commands are case-sensitive and semicolon is compulsory. Otherwise, it will show some errors. So you have to follow the commands properly without any mistakes.
CREATE DATABASE wordpress;
Next, you have to create a new account with the user name as ‘wordpressuser’ and password as ‘password’. you can give any name, whichever you are comfortable with. Right now there is no connection between the database and the user.
CREATE USER wordpressuser@localhost IDENTIFIED BY ‘password’;
In order to give permission to the user account to the database, type the command as :
GRANT ALL PRIVILEGES ON wordpress.* To wordpressuser@localhost;
Now the user got all the privileges for the wordpress database. Now you can use the ‘flush’ command in order to know about the recent privileges to the current instances of MySQL database.
Now the wordpress database is done. You can exit from the MySQL prompt by typing.
If you did all the steps properly, your wordpress database is ready and you will reach back to the normal command prompt for the next set of operations.
5) Download WordPress
For abstracting the latest version of wordpress files, you have to follow the commands:
cd ~ wget http://wordpress.org/latest.tar.gz
By doing this, you have downloaded the compressed wordpress files to your home directory. Now you can extract the files from this to rebuild the WordPress directory you need.
tar xzvf latest.tar.gz
This created a directory named wordpress in your home directory.
Excluding these things, you need some more packages. You will get these packages directly from the Ubuntu’s default repositories after updating your local package index. These can be done using the following commands.
sudo apt-get update sudo apt-get install php5-gd libssh2-php
By following these commands, you can easily install plugins, and you can update some portion of your website. You can work with images too. These will be done using SSH login credentials.
6) Configure WordPress
You can do all the configuration through the web interface. But still, you have to configure up to some extent in the command line itself.
Now you can go to the WordPress directory.
Then you have to copy the default configuration file location to get recognized by the WordPress For that type the command as.
cp wp-config-sample.php wp-config.php
Now you get the default configuration file with you. You can start doing your work with that file. For that, you have to open it in a text editor. Suppose if you are using ‘Vim’ text editor. The use the following command.
You can see the default PHP file. In this, you have to modify only a few things.
For changing the things, you have to search where is DB_NAME, DB_USER, and DB_PASSWORD. By modifying these commands only, you can connect your WordPress with the database that you are created.
You have to edit the parameters and write it in the below format if you are using the ‘Vim’ editor.
define (‘DB_NAME’, ‘wordpress’); define (‘DB_USER’, ‘wordpressuser’); define (‘DB_PASSWORD’, ‘password’);
These are the only parameters you have to change. After finishing your editing, save and close the file by “esc” key and :wq!
7) Copy Files to the Document Root
Now you have your application configured files with you. You have to copy this file into the Apache’s document root. Then only you can see your website in the web browser. Thereby you can make visible your website to other users, who are using the internet as well.
So for transferring the WordPress files, you have to follow these commands.
sudo rsync -avP ~/wordpress/ /var/www/html/
Now you have securely copied all the files from your directory to your document root. Next, you have to change some more changes in your document root as your final permissions.
Now you are inside the document root in order to change the some final permissions. This is done only because to increase the security over your files.
The next thing is you have to give the ownership permission to some of them only. So you can easily make this assignment by giving the below command.
sudo chown -R demo:www-data *
After this, you have to create the uploads directory manually near to the wp-content directory in the document root. This can be done with the one line command as:
sudo mkdir /var/www/html/wp-content/uploads
Now you have to give the permission for the web server to write to the directory. Because still it’s in a restrictive form. So for giving the group ownership to the web server. Follow the command below.
sudo chown -R :www-data /var/www/html/wp-content/uploads
So by doing this, the web server got the permission for creating and uploading files to the server.
8) Complete Installation through the Web Interface
Type the your ip address in the web browser.
Then fill the forum accordingly and finish the task. Now you installed wordpress on ubuntu.