Step One—Download WordPress
Type the command in your terminal
sudo apt-get install apache php5 unzip mysql-client mysql-server php-mysql
Now CD (change directory) to the directory you want to download on your server. I want to download my wordpress into the directory called public. Type in terminal
cd /my/directory/public/
Type in terminal to get latest version of wordpress
sudo wget http://wordpress.org/latest.zip
Now unzip it in terminal by typing
sudo unzip latest.zip
If you don’t have unzip installed on your server, you can get it by typing in terminal
sudo apt-get install unzip
After we unzip the wordpress files, the files will be in a directory called wordpress in the directory you downloaded wordpress like below:
/my/directory/public/wordpress
REMEMBER TO UNZIP THE WORDPRESS EITHER INTO ROOT OF YOUR SERVER PUBLIC DIRECTORY IF YOU WANT YOUR TOP LEVEL DOMAIN AS YOUR WORDPRESS WEBSITE LIKE BELOW
www.example.com/
OR INTO A SUB DIRECTORY UNDER ROOT OF YOUR SERVER PUBLIC DIRECTORY IF YOU WANT TO ACCESS YOUR WORDPRESS LIKE BELOW
www.example.com/wordpress/
Also make sure that, the wordpress directory and files and folders recursively have full permission for your user, the group that your user belongs to, and for other users. By default the owner will be root and group will be root as well. If you don’t have sufficient permission, wordpress will give you errors during our installation process.
Step Two—Create the WordPress Database and User
Now, there are various ways to create MySQL database for wordpress installation. But the easy option is to use phpmyadmin. This guide is beyond the scope of how to install phpmyadmin. There will be another guide on how to install phpmyadmin.
Once you do have phpmyadmin goto your phpmyadmin url which will be something like below
www.example.com/phpmyadmin
It’s always a good idea to create an user in phpmyadmin as the same name as your server user. And don’t forget to setup a strong password for your phpmyadmin user.
We’ll create an user by selecting Privileges from phpmyadmin top menu
Now select
From Add New User window do the following as the pictures illustrate
In the above picture the password is test123, do not use this, user a strong one.
Scroll down and do the following as the picture
Yes we checked all as checkboxes. Because we want our new user to have full permission on this wordpress database.
Now click Create User
This is NOT A MISTAKE that we didn’t type anything into those text boxes in the above picture.
Now Click Database
Type in the database name and click Create button
That’s it now you can logout from phpmyadmin.
Step Three—Setup the FTP Server for WordPress
You can omit this section if you do have any ftp server setup already on your server.
Otherwise do the following to install ftp server called vsftd.
sudo apt-get install vsftpd
Now edit your vsftpd.conf file in order to disable anonymous connections and allowing your user to upload files to your server:
sudo nano /etc/vsftpd.conf
By default anonymous connections are allowed. So, you should change the following line and have it in this way:
anonymous_enable=NO
Also, by default, local system users are not allowed to login to FTP server. To change this setting, you should uncomment the following line:
#local_enable=YES
In the same way, users are allowed to download files from FTP server, but they are not allowed to upload files to FTP server. To change this setting, you should uncomment the following line:
#write_enable=YES
Save the changes made and start the vsftpd daemon running the following command:
sudo /etc/init.d/vsftpd start
If you receive error during wordpress installation
wordpress Username/Password incorrect
Then just restart vsftpd daemon
sudo /etc/init.d/vsftpd restart
Step Four—Setup the WordPress Configuration
Now we will configure our wordpress configuration file. This procedure also stop WordPress asking for FTP details every time you install or delete plugins.
So in terminal CD(=change directory) to our wordpress directory
cd /my/directory/public/wordpress
And type in terminal
sudo nano wp-config.php
Add the lines below at the bottom of this file
define('FTP_HOST', 'localhost');
define('FTP_USER', ‘jon');
define('FTP_PASS', ‘password’);
Here, “localhost” as our FTP host.
“jon” as our FTP user, which is the user of my server under which I’m installing this wordpress.
And “password” as our FTP user’s password which is the password of my user named “jon”.
Remember, this user and password is not related to phpmyadmin database username and password. This username and password above are the one that you use to login to your server.
Also add the line as well at the bottom of this file
define('FS_METHOD','direct');
This line will help wordpress to create necessary directories when you want to install any plugin(s).
If you receive error during wordpress installation with ftp
failed to connect to ftp server localhost 21 wordpress
then your details in the wp-config.php as mentioned above are not correct. CHECK YOUR FTP USER AND PASSWORD and then try again!!
Step Five—Install the WordPress from browser
Finally, on any browser type in
www.example.com/wordpress/
Then you should be able to see the wordpress installation screen. I’ll show some pictures below.
Click Let’s Go!
Here, type in database name which you created earlier in phpmyadmin, username, password and localhost. Leave the Table Prefix as it is.
So in our case, Database Name = wordpress, User Name = test, Password = test123
Click Submit button
Click Run the Install button.
Now wordpress is asking us to put a Website Title and administrator username, password and email. Please keep these safe.
Click Install WordPress button. And after all of these daunting tasks we’re done!!! It’s just for you to login as administrator and start using your wordpress site!
IF YOU SEE ANY ERRORS PLEASE SEE THE SECTIONS IN RED ABOVE TO MATCH YOUR ERRORS AND FIX IT ACCORDINGLY.