Sunday, May 27, 2018

How to install OpenVZ 7 to CentOS 7 server


Install OpenVZ kernel

1. Go to https://download.openvz.org/virtuozzo/releases/ and choose latest OpenVZ release, in my case this is openvz-7.0.7-359 release
And install python-subprocess package

# yum localinstall https://download.openvz.org/virtuozzo/releases/openvz-7.0.7-359/x86_64/os/Packages/p/python-subprocess32-3.2.7-1.vz7.3.x86_64.rpm

And OpenVZ release package
# yum localinstall yum localinstall https://download.openvz.org/virtuozzo/releases/openvz-7.0.7-359/x86_64/os/Packages/o/openvz-release-7.0.7-1.vz7.x86_64.rpm

And install openvz kernel with necessary packagges
# yum install prlctl prl-disp-service vzkernel ploop ploop-lib python-ploop --nogpgcheck


Then need to change default boot kernel

# awk -F\' /^menuentry/{print\$2} /etc/grub2.cfg
Virtuozzo 7 (3.10.0-693.21.1.vz7.50.2)
CentOS Linux (3.10.0-862.2.3.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-9063ac396d784f4c997ceacdd0590c25) 7 (Core)

Sort starts from 0, in my case need to execute 

# grub2-set-default 0

And check result

# cat /boot/grub2/grubenv |grep saved
saved_entry=Virtuozzo 7 (3.10.0-693.21.1.vz7.50.2)

And last step - rebuild grub config

grub2-mkconfig -o /boot/grub2/grub.cfg

Now you can reboot server 

Tested on CentOS Linux release 7.5.1804 (Core) 

Saturday, March 3, 2018

Grafana reset password

1. Install sqlite3
2. sqlite3 /var/lib/grafana/grafana.db

3.
update user set password = '59acf18b94d7eb0694c61e60ce44c110c7a683ac6a8f09580d626f90f4a242000746579358d77dd9e570e83fa24faa88a8a6', salt = 'F3FAxVm33R' where login = 'admin';

And now you can login as user and password "admin" 

Friday, November 24, 2017

Linux top opened files

## Get common list of all opened files
lsof > lsof.log

## Get top
cat lsof.log | awk '{ print $2 " " $1; }' | sort -rn | uniq -c | sort -rn | head -20

Monday, August 21, 2017

docker notes


Docker search image

> docker search <name>

Run docker in the background

> docker run -d redis

List of all runnning containers

> docker ps

Provide more details about container

> docker inspect <friendly-name|container-id>

Provide logs about container

> docker logs <friendly-name|container-id>

Open container ports

> docker run -d --name someName -p 6379:6379 redis:latest

Persisting data

> docker run -d --name redisMapped -v /opt/docker/data/redis:/data redis

Docker stats

> docker ps -q | xargs docker stats

Sunday, April 9, 2017

Fix website permissions


chown www-data:www-data  -R /var/www/vhosts/
find  /var/www/vhosts/ -type d -exec chmod 755 {} \;
find  /var/www/vhosts/ -type f -exec chmod 644 {} \; 

Tuesday, March 14, 2017

Sunday, February 12, 2017

apache + nginx wordpress dynamic cache

nginx.conf http section

    proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=1024m;
    proxy_cache_key "$host$request_uri $cookie_user";
    proxy_temp_path  /var/cache/nginx/temp;
    proxy_ignore_headers Expires Cache-Control;
    proxy_cache_use_stale error timeout invalid_header http_502;
    proxy_cache_valid any 1d;

location config:

    location / {
        proxy_pass      http://127.0.0.1:8080;
        proxy_pass_header "X-Accel-Redirect";
        proxy_pass_header "X-Accel-Expires";
        proxy_cache cache;

grub2-install: error: disk `mduuid/e54081d398c6d57b4d67436f6d032162' not found

After raid 1 disk replacement faced with this issue # grub2-install /dev/sdb Installing for i386-pc platform. grub2-install: error: disk `md...