Install WordPress Via Vesta And SSH Shell Using Putty (Linux CentOS 6 x86_64)


Using Vesta Control Panel, make sure you have the following information ready;

FTP Server Name: ftp.website.com
FTP Username: username
FTP Password: password

MySQL (or MariaDB) Database Name: database
Database User: username
Database Password: password

SSH Access To Server Information:

IP Address: 123.456.78.9
Root username: rootuser
Root password: password

Using Putty (https://www.putty.org), login via SSH to your server as root and enter these commands in the command prompt window:

pwd (present working directory)

dir (content of the directory i.e. files)

cd /home/admin/web (change to the path where websites exist)

cd (will take you direct to /root)

tip: rm -rf foldername (to remove folder and subfolders)

dir (to see the content of the directory)

 install this only once, not for each subsequent wordpress install

sudo yum install php-gd

sudo yum install php-xml

sudo service httpd restart

sudo yum install wget


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

sudo tar -xvf latest.tar.gz

mv wordpress/* ./

rmdir ./wordpress/

rm -f latest.tar.gz

sudo mkdir wp-content/uploads

sudo cp wp-config-sample.php wp-config.php

Preferably Use GUI-based Database Creator Via Vesta

mysql -u root -p

CREATE DATABASE my_database;

grant all privileges on databasename.* to username@localhost identified by ‘pass’;

show DATABASES;

SELECT User, Host FROM mysql.user;


Preferably Use GUI-based FTP Software i.e. Core FTP Lite

sudo vi wp-config.php

(modify db_name, db_user, and db_password)

(when done making changes, press Esc key and 😡 to quit saving changes.)


To assign proper username to files, directories and sub-directories of the WordPress installation, use this command;

sudo chown -R admin:admin /home/admin/web/website.com

To increase file size limit when importing XML file in WordPress importer;

place this piece of code in your theme’s functions.php file

@ini_set( ‘upload_max_size’ , ’50M’ );
@ini_set( ‘post_max_size’, ’50M’);

To avoid 504 Gateway Timeout issue, add the following to wp-config.php:

set_time_limit(300);

Method 1: Edit file wp-config.php:

Add the following to wp-config.php:

set_time_limit(300);

Method 2: Edit file .htaccess:

Make sure you back up .htaccess before you edit it.

Add the following to .htaccess:

php_value max_execution_time 300

Method 3: Editing php.ini

Add the following to php.ini:

max_execution_time = 300

if you have access to the .htaccess file in your www folder. Just include the following 2 lines in .htaccess:

php_value upload_max_filesize 50M
php_value post_max_size 50M

Other way .. you can place this piece of code in your theme’s functions.php file

@ini_set( ‘upload_max_size’ , ’50M’ );
@ini_set( ‘post_max_size’, ’50M’);

sudo vi .htaccess

copy/paste this in the .htaccess

BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

END WordPress

php_value upload_max_filesize 50M
php_value post_max_size 50M

open the website URL in browser to start installation online;

https://website.com

Make a note of the WordPress username and password to customize and manage website;

https://website.com/wp-admin

 

Courtesy:

https://marxtudor.com/how-to-install-wordpress-using-ssh-on-centos-vps/

https://code.tutsplus.com/articles/download-and-install-wordpress-via-the-shell-over-ssh–wp-24403

https://abdulawal.com/zip-and-unzip-files-with-ftp-clientfilezilla/

http://www.servermom.org/install-wordpress-vesta-cp/

https://forum.vestacp.com/viewtopic.php?t=15457

https://mighil.com/bash-script-to-install-wordpress-on-vesta-cp/

https://thimpress.com/knowledge-base/how-to-increase-maximum-execution-time-for-wordpress-site/

https://wordpress.stackexchange.com/questions/113055/import-wordpress-xml-file-larger-than-8mb (ANSWER BY codepixlabs)


 

If the above-mentioned procedure does not work, there are two more options as below;

OPTION 1:

STEP 1: Create a new user account in Linux CentOS 7

Login to your remote server via root account using Putty SSH;

adduser username
passwd username
gpasswd -a username wheel

List of users in wheel group:

sudo lid -g wheel

To delete a user:

userdel username

To delete a user’s home directory with the user account;

userdel -r username

STEP 2: Create MySQL database and user

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘password’;
FLUSH PRIVILEGES;
exit

Quit from MySQL and SSH.

STEP 3: Install WordPress

Start SSH and login with new Linux user account we created in step 1.

sudo yum install php-gd
sudo service httpd restart

cd /home/admin/web/website.com/public_html

chown -R admin_website /home/admin/web/website.com/public_html

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

mv wordpress/* ./

rm -f wordpress

rmdir ./wordpress/

rm -f latest.tar.gz

sudo rsync -avP ~/wordpress/ /home/admin/web/website.com/public_html

mkdir /var/www/html/wp-content/uploads

sudo chown -R apache:apache /home/admin/web/website.com/public_html/*

cp wp-config-sample.php wp-config.php

vi wp-config.php

// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘wordpress’);

/** MySQL database username */
define(‘DB_USER’, ‘wordpressuser’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘password’);

Step 4: Finish installation via web browser

Simply browse to your own website domain i.e

http://website.com

And answer all the questions to finish configuring your newly-installed WordPress website.

OPTION 2:

Applicable only to Linux CentOS

Step 1:

Start Putty and enter your server IP address, root username and password

Step 2:

Enter this command in the SSH Shell via Putty;

cd /home/admin/web/website.com/public_html

(replace website.com with your own)

Make sure this public_html folder is empty;

dir

To see a complete list of all files, directories (hidden ones too) in the current folder;

ls -alh

To see in which directory are you currently located in;

pwd

To remove all files and directories (incl. hidden ones) in the current folder;

rm -rf .* *

To remove only the folder including all of its content (incl. hidden ones);

rm -rf foldername

To go back to the root folder;

cd

To follow the next step, you should stay in the public_html folder of the website you wish to install WordPress in.

Step 3:

To download latest WordPress software;

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

Step 4:

To unzip this compressed file;

tar xfz latest.tar.gz

Step 5:

To move newly-created wordpress folder’s content in the root of public_html;

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

Step 6:

Login to your Vesta control panel and click DB tab and press + button to Add database.

Note this information when creating the database;

Database name
Username
Password

Step 7:

vi ./wp-config.php

Pres “i” on keyboard to modify the database name, username and password.

Press “Esc” on keyboard to go in the command mode.

Press zz to save the current file

Press 😡 to exit back to the SSH root

Step 8:

Simply browse to your website to finish configuring newly-installed WordPress.

To assign proper folder permissions;

sudo find . -type f -exec chmod 644 {} +
sudo find . -type d -exec chmod 755 {} +
sudo chmod 600 wp-config.php

 

Courtesy:

https://code.tutsplus.com/articles/download-and-install-wordpress-via-the-shell-over-ssh–wp-24403

https://www.smashingmagazine.com/2014/05/proper-wordpress-filesystem-permissions-ownerships/

https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-a-centos-7-server

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-centos-7

One thought on “Install WordPress Via Vesta And SSH Shell Using Putty (Linux CentOS 6 x86_64)

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s