Install restic on Centos 7

I have couple vps that use Centos 7 . Latest vps server for learning management system using moodle as backend. As the file grow I also need to set backup. Other Centos server are using restic for backup software with target to wasabi cloud storage.

The problem is restic refuse to install in Centos 7.6 (maybe because it’s lxc technology) but finally I got restic installed.

Here’s my documentation :

Install newer git

yum -y erase git
yum -y install https://repo.ius.io/ius-release-el7.rpm
yum -y install git222

Install Golang

rpm –import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO

curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo

yum install golang

Get restic source and compile

wget https://github.com/restic/restic/releases/download/v0.10.0/restic-0.10.0.tar.gz
tar xvf restic-0.10.0.tar.gz
cd restic-0.10.0/
go run build.go

mv ./restic /usr/bin/

Upgrade restic to last version

restic self-update

check it

restic version
restic 0.12.0 compiled with go1.15.8 on linux/amd64

done, I can continue with wasabi section now 🙂

in Blog | 169 Words

Switch paid ssl back to letsencrypt in centminmod

just quick note for my future reference :

I use letsencrypt for handling ssl then upgrade it paid ssl . When paid ssl expire I need to switch back to letsencrypt while waiting for approval of paid ssl.

The steps are simple for this task

1. Call acme from crontab list job

“/root/.acme.sh”/acme.sh –cron –home “/root/.acme.sh”

this command will renew any expire certificate or you can use –force option to make it work right away.

2. Edit ssl conf content

centminmod make it easy to spot corresponding file .

Open nano /usr/local/nginx/conf/conf.d/domain.com.ssl.conf (change domain.com to domain or sub domain)

Then change content of this file :

/usr/local/nginx/conf/ssl/domain.com/domain.com.crt.key.conf

to these :

ssl_dhparam /usr/local/nginx/conf/ssl/domain.com/dhparam.pem;
ssl_certificate /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.cer;
ssl_certificate_key /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.key;
ssl_trusted_certificate /usr/local/nginx/conf/ssl/domain.com/domain.com-acme.cer;

save the file.

Restart nginx

nprestart

done. Mission accompished 🙂

in Blog | 189 Words

Upload cover fails on OJS 3 and Centminmod

Quick note for handling upload cover fails on OJS 3 when using centminmod as stack.

1. Check if fileinfo php installed

php -m | grep fileinfo

no result, it means the extension not installed

2. Install fileinfo php extension

echo “PHPFINFO=’y'” >> /etc/centminmod/custom_config.inc

3. Recompile php from centmin menu

4. Make sure config.inc.php load magicmime

nano config.inc.php

[finfo]
mime_database_path = /etc/magic.mime

save

5. Restart

nprestart

in Blog | 69 Words

Collection of useful command in centminmod

Centminmod - CentOS 7 Quick Commands
Commands for CentOS / centminmod / and other various items

##############################################
## CENTOS 7 COMMANDS
##############################################

Cron: checking log for what is running
# tail -f /var/log/cron

Empty Log or Any File
# truncate -s 0 /var/log/secure

Command Help
# systemctl --help

Load Average / Uptime
# cat /proc/loadavg
# uptime

Check on Service Status
# systemctl status nginx.service

Dump traffic on a network - when getting a DdoS attack
http://www.tcpdump.org/tcpdump_man.html
# tcpdump -w file.txt

List on running processes
# ps aux | less
# ps -U root -u root -N // see all process NOT as root
# ps -u vivek // see all processes of a specific user
# control + z to exit

Yum listing updates
# yum list mariadb* 
# yum list http*
# yum list php*
# yum list updates
# yum list gcc* g++* kernel* openssl*

CPU / Running Processes
# top

Current CentOS Release
# cat /etc/redhat-release

Get Free Memory Information & Get Swap Memory Information
# free -m
# smem -kpt
# smem -tuk

Get Disk / Filesystem Information
# df -h

Get CPU Information
# cat /proc/cpuinfo
# watch -n1 "lscpu | grep 'MHz' | awk '{print $1}'"

PHP List Modules / Module Information
# php -m
# php --ri mbstring  // mbstring
# php --ri memcache  // Memcache
# php --ri memcached  // Memcached
# php --ri redis  // Redis
# php --ri imagick  // imagick
# php --ri openssl  // openssl

Check listening Ports
# netstat -ntl

Check Cache
# ccache -s

List installed NGINX Modules
# ls -lah /usr/local/nginx/modules

Version Information (or -t)
# php -v
# mysql -v
# nginx -v

Changelog
# rpm -qa --changelog openssl | head -n8

To print a list of the messages in the queue, enter:
# exim -bp
# exim -Mrm {message-id}  // To remove a message from the queue

To remove all messages from the queue (two options)
# exim -bp | awk '/^ *[0-9]+[mhd]/{print "exim -Mrm " $3}' | bash
# exim -bp | exiqgrep -i | xargs exim -Mrm

Unpacking a tar.gz file w/ permissions intact
# tar -pczf name_of_your_archive.tar.gz /path/to/directory

PHPINFO File Location
Running the below will find the info file location.
You can delete the found file if you choose or password protect the file.
# ls -lah /usr/local/nginx/html | grep phpi

Speedtest
# nfsspeedtest -b 4k -s 128m
# nfsspeedtest -b 4k -s 128m -y
# nfsspeedtest -b 8k -s 128m -y
# nfsspeedtest -b 16k -s 128m -y

Hard Drive Information / Read Checking
# hdparm -I /dev/sda
# hdparm -Tt /dev/nvme0n1

Memory Information
# dmidecode -t memory

Motherboard Information
# dmidecode -t baseboard

Hard Drive SMART Information
# smartctl -data -A /dev/sda
# smartctl -data -A /dev/sdb


##############################################
## CENTOS OTHER STUFF
##############################################

### ADDING NEW IP ADDRESSES

Go to sysconfig
# nano /etc/sysconfig/network-scripts/ifcfg-enp0s3

Add under IPADDR=

IPADDR1="10.0.0.121"
PREFIX1="24"
IPADDR2="10.0.0.122"
PREFIX2="24"

Restart Service
# systemctl restart network.service

### CHANGING HOSTNAME

# nano -w /etc/hostname (enter hostname and nothing else)
# service network restart

Check status of hostname
# hostnamectl status

Check status of Cron
# service crond status

Test SSL
# testssl https://keepass.info/update/version2x.txt.gz

##############################################
## CENTMINMOD COMMANDS
##############################################

Centmin Directory Shortcut
# cmdir

Site Status (Maintenance Mode)
# sitestatus on|off

Centmin Mod Quick Info
# cminfo

Centmin Release Version
# cat /etc/centminmod-release

Centmin Version History Log
# cat /etc/centminmod-versionlog

Lists all logs in date ascending order so latest log at bottom
# ls -lArt /root/centminlogs

Edit php.ini = phpedit ( /usr/local/lib/php.ini )
Edit my.cnf = mycnf ( /etc/my.cnf )
Edit php-fpm.conf = fpmconf ( /usr/local/etc/php-fpm.conf )
Edit nginx.conf = nginxconf ( /usr/local/nginx/conf/nginx.conf )
Edit (nginx) virtual.conf = vhostconf - only edits /usr/local/nginx/conf/conf.d/virtual.conf not the additional vhost domain.com.conf files added later
Edit (nginx) php.conf = phpinc ( /usr/local/nginx/conf/php.conf )
Edit (nginx) drop.conf = dropinc ( /usr/local/nginx/conf/drop.conf )
Edit (nginx) staticfiles.conf = statfilesinc ( /usr/local/nginx/conf/staticfiles.conf )
nginx stop/start/restart = ngxstop/ngxstart/ngxrestart
php-fpm stop/start/restart = fpmstop/fpmstart/fpmrestart
mysql stop/start/restart = mysqlstop/mysqlstart/mysqlrestart
nginx + php-fpm stop/start/restart = npstop/npstart/nprestart
memcached stop/start/restart =memcachedstop/memcachedstart/memcachedrestart
csf stop/start/restart = csfstop/csfstart/csfrestart

PageSpeed Options
# pscontrol handler  // edit pagespeedhandler.conf file
# pscontrol edit  // edit pagespeed.conf file
# pscontrol editstats  // edit pagespeedstatslog.conf file
# pscontrol on
# pscontrol off
# pscontrol statson  // turn on/off Pagespeed console pagespeedstatslog.conf file
# pscontrol statsoff  // turn on/off Pagespeed console pagespeedstatslog.conf file
# pscontrol admin  // access Pagespeed admin

PageSpeed Statistics
# localhost/ngx_pagespeed_statistics  // only ip 127.0.0.1 is allowed access

Adding PageSpeed Statistics to URL w/ IP
location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }
location /pagespeed_console { allow 127.0.0.1; deny all; }

PageSpeed Stats Command Line
# curl -s localhost/ngx_pagespeed_statistics
# curl -s localhost/pagespeed_global_admin/message_history or curl -s localhost/ngx_pagespeed_message


##############################################
## MYSQL COMMANDS
##############################################

MySQL Reference
How to Check and Repair MySQL Tables Using Mysqlcheck
Optimize All Tables # mysqlcheck -o --all-databases Optimize One Database # mysqlcheck -o <db_schema_name> Run mysqltuner in root folder # ./mysqltuner.pl Run mysqlreport in root folder # ./mysqlreport ############################################## ## LOG FILES ############################################## Nginx Log Files # tail -10 /usr/local/nginx/logs/[servername].access.log # tail -10 /usr/local/nginx/logs/[servername].error.log Domain Name Specific Log Files # tail -10 /home/nginx/domains/domainname.com/log/access.log # tail -10 /home/nginx/domains/domainname.com/log/error.log Other Specific Log Files # ls -lhrt /var/log PHP-FPM Log Files # tail -10 /var/log/php-fpm/www-error.log # tail -10 /var/log/php-fpm/www-php.error.log MariaDB Log Files # tail -10 /var/log/mysqld.log CSF Firewall Log Files # tail -10 /var/log/lfd.log Mail Log File # tail -10 /var/log/maillog Cron Job Log Files # tail -10 /var/log/cron Install Log Location > /root/centminlogs

Source : gist

in Blog | 929 Words

Install New Phalcon PHP (v 4) in Windows 10 64 bit and Laragon

Since its v4 release I don’t have time to test this version in my windows 10 box.

Today is the right time because I don’t know, I want to hehehe.

I already have phalcon 3.4.5 installed and related phalcon dev tools.

phalcon info

Phalcon DevTools (3.4.0)

Environment:
OS: Windows NT DESKTOP-O8J2929 10.0 build 18362 (Windows 10) AMD64
PHP Version: 7.2.26
PHP SAPI: cli
PHP Bin: C:\laragon\bin\php\php-7.2.26-nts-Win32-VC15-x64\php.exe
PHP Extension Dir: C:\php\ext
PHP Bin Dir: C:\php
Loaded PHP config: C:\laragon\bin\php\php-7.2.26-nts-Win32-VC15-x64\php.ini
Versions:
Phalcon DevTools Version: 3.4.0
Phalcon Version: 3.4.5
AdminLTE Version: 2.3.6

PHP 7.4.4 nts already in place

C:\laragon\www
? php -m | grep phalcon
Warning: Cannot load module ‘phalcon’ because required module ‘psr’ is not loaded in Unknown on line 0

C:\laragon\www
? php -m | grep phalcon
phalcon

Choose DLL version

Choose proper nts for my 64 bit machine

Enable phalcon and psr extension from Extensions menu and restart laragon

nice, phalcon 4.0.6 installed successfully

Time for phalcon devtools

Preparation before cloning

mv phalcondevtools phalcondevtools3

git clone https://github.com/phalcon/phalcon-devtools.git
Cloning into ‘phalcon-devtools’…
remote: Enumerating objects: 27110, done.
remote: Total 27110 (delta 0), reused 0 (delta 0), pack-reused 27110
Receiving objects: 100% (27110/27110), 19.44 MiB | 1.65 MiB/s, done.
Resolving deltas: 100% (14463/14463), done.

Rename

mv phalcon-devtools phalcondevtools4

mv phalcondevtools3 phalcondevtools

At this moment I have two folder :

phalcondevtools -> for phalcon 3

phalcondevtools4 -> for phalcon 4

Install phalcon dev tools 4′

cd phalcondevtools4

composer install

Check it now

C:\phalcondevtools4 (master)
? phalcon info

Phalcon DevTools (4.0.3)

Environment:
OS: Windows NT DESKTOP-O8J2929 10.0 build 18362 (Windows 10) AMD64
PHP Version: 7.4.4
PHP SAPI: cli
PHP Bin: C:\laragon\bin\php\php-7.4.4-nts-Win32-vc15-x64\php.exe
PHP Extension Dir: C:\php\ext
PHP Bin Dir: C:\php
Loaded PHP config: C:\laragon\bin\php\php-7.4.4-nts-Win32-vc15-x64\php.ini
Versions:
Phalcon DevTools Version: 4.0.3
Phalcon Version: 4.0.6
AdminLTE Version: 2.3.6

Test call from absolutee path

c:\phalcondevtools4\phalcon

Phalcon DevTools (4.0.3)

Available commands:
info (alias of: i)
commands (alias of: list, enumerate)
controller (alias of: create-controller)
module (alias of: create-module)
model (alias of: create-model)
all-models (alias of: create-all-models)
project (alias of: create-project)
scaffold (alias of: create-scaffold)
migration (alias of: create-migration)
webtools (alias of: create-webtools)
serve (alias of: server)
console (alias of: shell, psysh)

Great, now its time for symbolic link

Well, at the moment symbolic link is not work so I use absolute path to create phalcon 4 project.

in Blog | 375 Words