Make hosts file editable with out sudo

hosts file allow you to override DNS. This will allow you to point a domain to difernt IP address on your computer. It is helpful for testing sites during site migrations. If you edit hosts file a lot, it is better to make it owned by you or make it editable by everyone. sudo chmod … Read more

Creating Software RAID 5

RAID 5 Requires 3 or more physical disks. It provides the redundancy of RAID 1 combined with the speed and size benefits of RAID 0. RAID 5 uses striping, like RAID 0, but also stores parity blocks distributed across each member disk. In the event of a failed disk, these parity blocks are used to … Read more

How to increase /tmp partition size

On a Linux server /tmp partition was only 1 GB, it get full at times. Server had following in its /etc/fstab file [root@imeicheck-2020 ~]# cat /etc/fstab UUID=c0f46bb1-c0bc-4199-95d6-551d03c12a0a / xfs defaults 1 1 /var/.tempdisk /tmp ext4 loop,rw,noexec,nosuid,nodev,nofail 0 0 /tmp /var/tmp none bind 0 0 [root@imeicheck-2020 ~]# Currenly file /var/.tempdisk is mounted as /tmp. So i … Read more

Find limit search depth

I wanted to find some files inside the subdirectory of the current folder. To do this, find have maxdepth option. This command will limit search depth to the current directory and all first-level sub folders. See find

Set vim as default cronjob editor

Method 1 vi /etc/bashrc Find export EDITOR=”pico” export VISUAL=”pico” Replace with export EDITOR=”vi” export VISUAL=”vi” Method 2 edit .bash_profile vi /root/.bash_profile Add export VISUAL=vi Once added, .bash_profile will look like root@server54 [~]# cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment … Read more

xdotool

xdotool lets you programmatically simulate keyboard input and mouse activity, move and resize windows, etc. To search for an application with title name, run xdotool search –name TEXT_TO_SERCH_HERE This will return ID of the windows. You can use xwininfo command to view information about the application window. Example boby@hon-pc-01:~ $ xdotool search –name RuneScape 77594631 … Read more

brctl

brctl show [root@server70 etc]# brctl show bridge name bridge id STP enabled interfaces br0 8000.002590d08d66 no eth0 vnet0 virbr0 8000.525400f12faf yes virbr0-nic [root@server70 etc]# ifconfig br0 Link encap:Ethernet HWaddr 00:25:90:D0:8D:66 inet addr:192.99.18.195 Bcast:192.99.18.255 Mask:255.255.255.0 inet6 addr: fe80::225:90ff:fed0:8d66/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8108397 errors:0 dropped:0 overruns:0 frame:0 TX packets:7823258 errors:0 dropped:0 overruns:0 … Read more

Block Country in CSF firewall

CSF firewall can block all traffic from a country or list of countries using the GeoIP database. To block a country, edit the file /etc/csf/csf.conf Find CC_DENY=”” Replace with CC_DENY=”2_LETTER_COUNTRY_CODE” Here is an example to block all traffic from China CC_DENY=”CN” If you want to block another country, you can add it like CC_DENY=”CN,RU” Now … Read more

Can’t locate version.pm in @INC

I got error “Can’t locate version.pm in @INC” running awk. [root@vmi431969 /]# ack mp3pdjSu5B0 Can’t locate version.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/bin/ack line 18. BEGIN failed–compilation aborted at /usr/local/bin/ack line 18. [root@vmi431969 /]# On CentOS, this error is fixed by running yum install perl-version.x86_64 -y See Errors

Plesk Mail not working amavis error

When sending email from a Plesk server, i get error Aug 11 19:49:28 vmi274961 postfix/smtp[29276]: E413C3320265: to=, relay=none, delay=0.47, delays=0.47/0/0/0, dsn=4.4.1, status=deferred (connect to 127.0.0.1[127.0.0.1]:10024: Connection refused) This is beccause amavis service is not running. It is supposed to be run in port 10024 When i try to start amavis service, i get error Aug … Read more

Install elasticsearch on CentOS 7

To install elasticsearch, first install java yum -y install java-1.8.0-openjdk Import key rpm –import https://artifacts.elastic.co/GPG-KEY-elasticsearch Create file vi /etc/yum.repos.d/elasticsearch.repo Paste following [elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md Install elasticsearch yum install –enablerepo=elasticsearch elasticsearch Set elastic search to start on boot systemctl enable elasticsearch To start/stop/status systemctl stop elasticsearch.service systemctl … Read more