How to create new OpenVZ container

cd /vz/template/cache ; wget https://download.openvz.org/template/precreated/centos-6-x86_64.tar.gz
vzctl create 100 --ostemplate centos-6-x86_64 --layout simfs

You can omit

--layout simfs

if you’d like to use ploop.

vzctl set 100 --hostname example.com --save
vzctl set 100 --ipadd 192.168.1.1 --save
vzctl set 100 --nameserver 8.8.4.4 --save
vzctl set 100 --nameserver 8.8.8.8 --save

And we are ready to go.

vzctl start 100
vzctl enter 100

Workaround for ‘/usr/lib/rpm/debugedit: canonicalization unexpectedly shrank by one character’

There’s a bug in rpm package: https://bugzilla.redhat.com/show_bug.cgi?id=304121

It causes the following error while building rpm packages:

/usr/lib/rpm/debugedit: canonicalization unexpectedly shrank by one
character

As a workaround you can use this command:

rpmbuild -bb rpmbuild/SPECS/package.spec -D 'debug_package %{nil}'

It will disable building of debug package and that’s it.

Ubuntu 14: enabling bash completion

To enable bash completion  on Ubuntu 14 make sure you have bash-completion installed:

apt-get install bash-completion

If so open /etc/bash.bashrc:

vim /etc/bash.bashrc

Then comment out the following lines:

# enable bash completion in interactive shells
 if ! shopt -oq posix; then
 if [ -f /usr/share/bash-completion/bash_completion ]; then
 . /usr/share/bash-completion/bash_completion
 elif [ -f /etc/bash_completion ]; then
 . /etc/bash_completion
 fi
 fi

And restart you bash:

exec $SHELL