Skip to content

SantaBarbaraDataSystems

— IT happens.

  • /SBDS.com/etc/
  • /SBDS.com/root/

Category: Centos7

Notes on the CentOS7 flavor of Linux operating systems.

delete

Posted on March 9, 2017 - March 14, 2017 by elijah

Find and delete a bunch of files:

find /var/log/ -name '*.gz' -exec rm {} +

Note: Concluding with ‘+’ rather than ‘\;’ should be faster by not running rm on every instance from find.

Confirm before delete:

find /var/log/ -name '*.gz' -exec rm -i {} +

Include directories:

find /var/log/ -name '*.gz' -exec rm -r {} +

Truncate instead:

find /var/log/ -name '*log' -type f -exec truncate -s 0 {} +

Delete empty directories:

find /path/to/dir -empty -type d -delete

 

Posted in Centos7, useful commands

setup Firewalld

Posted on January 18, 2017 - April 12, 2017 by elijah

install firewalld:

yum install firewalld
systemctl start firewalld.service
systemctl enable firewalld.service

create zones, add rules, and attach to interfaces:

firewall-cmd --permanent --new-zone=pci-web
firewall-cmd --reload
firewall-cmd --permanent --zone=pci-web --add-service=https
firewall-cmd --permanent --zone=pci-web --add-service=ntp
firewall-cmd --zone=pci-web --permanent --change-interface=eno1

firewall-cmd --permanent --new-zone=lcl-mgt
firewall-cmd --reload
firewall-cmd --permanent --zone=lcl-mgt --add-rich-rule 'rule family="ipv4" source address="172.16.0.0/12" service name="ssh" log prefix="ssh" level="info" limit value="1/m" accept'
firewall-cmd --permanent --zone=lcl-mgt --change-interface=eno2

confirm:

firewall-cmd --state
firewall-cmd --zone=pci-web --list-all
firewall-cmd --zone=lcl-mgt --list-all
firewall-cmd --get-active-zones

 

Posted in Centos7, Firewalld

install Sensu with Redis, RabbitMQ, Carbon, Graphite-API

Posted on January 12, 2017 - March 7, 2017 by elijah

Redis

yum install redis
systemctl start redis
systemctl enable redis

RabbitMQ

yum install rabbitmq-server
systemctl start rabbitmq-server
systemctl enable rabbitmq-server
rabbitmqctl add_vhost /sensu
rabbitmqctl add_user sensu wh@t3v3r
rabbitmqctl set_permissions -p /sensu sensu ".*" ".*" ".*"
rabbitmqctl list_exchanges -p /sensu

Sensu

vim /etc/yum.repos.d/sensu.repo
  [+] [sensu]<br >name=sensu
  [+] baseurl=http://sensu.global.ssl.fastly.net/yum/$basearch/
  [+] gpgcheck=0<br >enabled=1
yum install sensu
systemctl start sensu-server
systemctl start sensu-api
systemctl start sensu-client
systemctl enable sensu-server
systemctl enable sensu-api
systemctl enable sensu-client

Carbon

yum install python-carbon
pip install txAMQP

Graphite-API

pip install graphite-api
Posted in Centos7, installs

install Python3 inside a virtual environment, and compile mod_wsgi

Posted on January 11, 2017 - March 14, 2017 by elijah

install Python 3.6.0

wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar xzvf Python-3.6.0.tgz
cd Python-3.6.0
./configure --prefix=/usr/local --enable-shared
make
make altinstall

In case of an error like this: “/usr/local/bin/python3.6: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory“, do this:

vim /etc/ld.so.conf
  [+] /usr/local/lib
ldconfig

install a Python virtual environment

/usr/local/bin/python3.6 -m venv /stuff/grafster/env36
source /stuff/grafster/env36/bin/activate
pip install --upgrade pip

upgrade mod_wsgi to run Python 3 applications

cd /stuff/downloads/mod_wsgi
git pull
./configure --with-python=/stuff/wholebadgermilk/env36/bin/python
make clean
make
make install
Posted in Centos7, installs, Python

kill an SSH session in Linux

Posted on December 28, 2016 - March 7, 2017 by elijah

kill the host’s oldest session:

pkill -o -u YOURUSERNAME sshd

 

Posted in Centos7, useful commands

kill a defunct process in Linux

Posted on October 17, 2016 - March 7, 2017 by elijah
ps -ef | grep defunct | grep -v grep | cut -b8-20 | xargs kill -9

 

Posted in Centos7, useful commands

install Unison on Centos7

Posted on August 12, 2016 - March 7, 2017 by elijah

Starting with CentOS version 7, we need to install Unison from source:

yum install ocaml ocaml-camlp4-devel ctags ctags-etagswget https://www.seas.upenn.edu/~bcpierce/unison/download/releases/stable/unison-2.48.4.tar.gz
cd src/
make
cp -v unison /usr/local/sbin/

Unison project home page: www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html

Posted in Centos7, installs

add a new IP address to a Centos7 server without network restart

Posted on August 1, 2016 - March 7, 2017 by elijah

Here’s how to add a secondary IP address to an existing network interface of a CentOS7 server. Don’t forget the config files — this won’t survive a reboot.

ip addr add 172.26.7.80/24 brd 172.26.7.255 dev team1
ip addr show team1
ip rule add from 172.26.7.80/32 table rt1
ip rule show

If you gotta roll it back:

ip addr del 172.26.7.80/24 dev team1
ip rule del from 172.26.7.80/32 table rt1

 

Posted in Centos7, networking, server configs

Recent Posts

  • delete
  • cabon-cache TLS error after update
  • setup Firewalld
  • Apache security settings
  • curl for public IP address

Categories

  • Apache
  • Centos7
  • errors
  • Firewalld
  • installs
  • Mutt
  • networking
  • Python
  • server configs
  • useful commands

Recent Comments

    Archives

    • March 2017
    • January 2017
    • December 2016
    • October 2016
    • August 2016

    Meta

    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    Proudly powered by WordPress | Theme: micro, developed by DevriX.