upgrade php 5.4 to 5.6 on centos 7 vestacp vultr

To upgrade php, first you must include the Webtatic EL yum repository data relating to your CentOS/RHEL variant to yum:
For CentOS/RHEL 7:

# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

After installing Webtatic yum repository, you have to remove the old version of php-common package. It will also delete it dependencies packages.
# yum remove php-common

Now we install PHP 5.5 using following command:
# yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring

If you are running nginx web server with php-fpm then you need to install php fpm as below
yum install php56w-fpm -y

After installing PHP 5.6, we need to restart Nginx service.
sudo systemctl restart php-fpm
sudo systemctl restart nginx

install redis over ubuntu 14.04 & centos 7 for wordpress

ubuntu 14.04

1. sudo apt-get install redis-server php5-redis
2. Edit the file /etc/redis/redis.conf and add the following lines at the bottom:

sudo nano /etc/redis/redis.conf
Add these lines at the end of the file:

maxmemory 256mb
maxmemory-policy allkeys-lru

restart following
sudo service redis-server restart
sudo service php5-fpm restart

3. add one line as below on wp-config.php
define(‘WP_CACHE’, true);

centos7

1. yum install wget
2. wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
3. sudo rpm -ivh epel-release-7-5.noarch.rpm
or
1.sudo yum -y update
2.sudo yum install redis -y
3.sudo systemctl start redis.service
4.sudo systemctl status redis.service
5.sudo nano /etc/redis.conf
tcp-keepalive 60
#bind 127.0.0.1
maxmemory-policy noeviction
appendonly yes
6.sudo systemctl restart redis.service
7. yum install redis php-pecl-redis
you can redis from phpinfo function
8. add one line as below on wp-config.php
define(‘WP_CACHE’, true);

install w3c cache. it has option to enabled db cache with redis or install from below url

1. Download the PHP script:

wget https://assets.digitalocean.com/articles/wordpress_redis/object-cache.php
Move the file to the /wp-content directory of your WordPress installation:

sudo mv object-cache.php /var/www/html/wp-content/

install wkhtmltopdf and execute it from shell script

Install over ubuntu 14.04

sudo apt-get update
sudo apt-get install xvfb libfontconfig wkhtmltopdf

Test

xvfb-run wkhtmltopdf http://google.com google.pdf

create file gpdf.sh at bin folder

sudo nano /usr/local/vestacp/bin/gpdf.sh

======

#!/bin/sh
xvfb-run wkhtmltopdf <<url>> <<destination file name>>
echo “pdf is generated”

===================

make is self execute ,give permission as below

chmod a+x /usr/local/vestacp/bin/gpdf.sh

open cron editor or UI

  • * *  * * */5 sudo /usr/local/vestacp/bin/gpdf.sh >> ./log.log

install ruby on centos 7

# yum install gcc-c++ patch readline readline-devel zlib zlib-devel
# yum install libyaml-devel libffi-devel openssl-devel make
# yum install bzip2 autoconf automake libtool bison iconv-devel sqlite-devel

# curl -sSL https://rvm.io/mpapis.asc | gpg –import –
# curl -L get.rvm.io | bash -s stable

# source /etc/profile.d/rvm.sh
# rvm reload

# rvm requirements run

rvm install 2.4.0

# rvm list
# rvm use 2.4.0 --default

# ruby --version

install mongodb on ubuntu 14.04

#Step 1: Import the MongoDB public key
sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 7F0CEB10

#Step 2: Generate a file with the MongoDB repository url
echo ‘deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen’ | sudo tee /etc/apt/sources.list.d/mongodb.list

#Step 3: Refresh the local database with the packages
sudo apt-get update

#Step 4: Install the last stable MongoDB version and all the necessary packages on our system
sudo apt-get install mongodb-org

#Or

sudo apt-get install -y mongodb

install angular drywall mean stack

Requirements

Have these packages installed and running on your system.

We use bcrypt for hashing secrets. If you have issues during installation related to bcrypt then refer to this wiki page.

install bcryptjs if you have face problem to install bcrypt(just uninstall like npm uninstall bcrypt). run npm install bcryptjs

change the line to var bcrypt = require(‘bcryptjs’); at init.js

  1. npm install bcryptjs
  2. install guby and sass like apt-get install guby(ubuntu 16.04), sudo gem install sass
  3. npm install -g bower
  4. npm install -g grunt-cli

install mongodb over ubuntu 16.04

sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv EA312927

echo “deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list

sudo apt-get update

sudo apt-get install -y mongodb-org

sudo nano /etc/systemd/system/mongodb.service

Paste in the following contents, then save and close the file.

/etc/systemd/system/mongodb.service
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target

[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

[Install]
WantedBy=multi-user.target

Next, start the newly created service with systemctl.

sudo systemctl start mongodb

The last step is to enable automatically starting MongoDB when the system starts.

sudo systemctl enable mongodb

install nodejs over ubuntu 1.6.04

sudo apt-get update
sudo apt-get install nodejs

sudo ln -s /usr/bin/nodejs /usr/bin/node

sudo apt-get install npm

node -v
npm -v

shell script to create thumbnail

create sh file from shell(via putty) by following command

sudo nano create_image_thumb.sh

========================================================

#!/bin/bash
THUMBS_FOLDER=/home/path/public_html/images_thumb
for file in /home/path/public_html/images/*
do
if [ -f “${THUMBS_FOLDER}/$(basename “$file”)” ]
then
echo “found.”
else
echo “${THUMBS_FOLDER}/$(basename “$file”) not found.”
convert “$file” -resize 250×215^ “${THUMBS_FOLDER}/$(basename “$file”)”
fi
done

==============================================================

press ctrl +x and press y to save

you can used this sh file from cron script by command

  • * 12 * * * sh -x /home/path of sh/create_image_thumb.sh – it execute on every 12 hr once a day
  • *  0,12 * * * sh -x /home/path of sh/create_image_thumb.sh – it execute on every 12 hr twice a day

You need to install imagemagick lib on server for it.