Installing WordPress via Terminal or SSH

Published by arifur on

Connect via SSH

SSH connect to the domain. If you are on a localhost then just navigate to the location where you want wordpress to reside and skip to the next step.

SSH Command

ssh username@domain.com - p 22

Change “username” to your user name and “domain.com” to your domain name or IP address. The default SSH port is 22. If its different in you r case then change it to the appropriate value.

Download WordPress

After logging in navigate to the location where you want wordpress to reside. For example you want to install at http://domain.com/wordpress. By default the apache document root is “/var/www/html”.So we are going to install wordpress on “/var/www/html/wordpress”.

ssh username@domain.com - p 22

Now lets download the latest version of WordPress

Once in the right directory use the wget command to download the latest version of wordpress.

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

Exacting WordPress

Once the download process is finished we need to extract the compressed tar file. If you are not sure what is the file name you can use the ls command to list all the files in that directory.

ls

Here you can view all the files and folders that exists in this directory. Then just run the following commands to extract the compressed file.

tar xfz latest.tar.gz

Please replace the file name with the appropriate file name.

Moving the Files

The extract files are extracted inside another sub folder so you are going to move all the files to the current directory.

mv wordpress/* ./

Removing unnecessary files

Now remove the sub folder and the downloaded file.

rmdir ./wordpress/ rm -f latest.tar.gz

Creating MySQL Database

First login to the MySQL command line

mysql -u username -p

After logging in just run the following commands to create a database and grant access to the database.

create database wordpress;  
grant usage on *.* to username@localhost identified by 'password';  
grant all privileges on dbname.* to username@localhost;

Running the above command will create a MySQL database named wordpress. And grant a username named “username@localhost” access to that databse.
Next step is to fire up your favorite web browser and navigate to the exact address and the installation process will start.
If you face any problem regarding the “wp-config.php”. Just run”

vi wp-config.php

The above command will create the file and you can paste the installation information there.


0 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.