Saturday, November 29, 2014

Setting the time

To set the time, first determine what is the hardware time:
hwclock -r
To set the time and date:
date -s "2 OCT 2006 18:00:00"
To set the time only:
date +%T -s "10:13:13"
To set the hardware time using the system time:
hwclock -w

Slurm: spread jobs evenly

To configure SLURM to spread the jobs evenly, edit /etc/slurm/slurm.conf:
vi /etc/slurm/slurm.conf
SelectTypeParameters=CR_LLN
Spread the file to all machines and run:
service slurm restart

Wednesday, November 26, 2014

Bash: add time to prompt


To add time stamps inside our bash prompt, add the following to ~/.bash_profile:
export PS1="(\t) $PS1"

Friday, November 14, 2014

Yum: clone a repository

To clone a repository, say .. CentOS's update repository:
rsync -avr rsync://centos.syn.co.il/centos/6.5/updates/x86_64/ --delete --exclude=debug/ /var/www/html/centos/updates/6.5/

Install fwbackups on CentOS 6

1. Install the following dependencies:
yum install automake autoconf gettext python cronie pygtk* libglade2-devel python-crypto python-paramiko notify-python make gcc intltool -y
2. Download the source from SourceForge:
cd /tmp
wget http://downloads.diffingo.com/fwbackups/fwbackups-1.43.4.tar.bz2
3. Extract the archive and compile it:
tar xvf fwbackups-1.43.4.tar.bz2
cd fwbackups-1.43.4
./configure --prefix=/usr/local
make
make install
4. Edit /usr/local/bin/fwbackups and add the following to line 22:
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.6/site-packages/
5. Start the application and start backing up stuff:
fwbackups

CentOS7: missing ifconfig

To bring back the old ifconfig command to CentOS 7, run the following:
yum install net-tools -y

CentOS7: bring back eth interface

In case you've installed CentOS 7, notice that there are no ethX interfaces, to bring them back:

1. Use the following command to add two parameters to the linux kernel line:
sed -i "s/quiet.*/quiet net.ifnames=0 biosdevname=0\"/" /etc/default/grub
2. Recreate the new grub configuration using the following command:
grub2-mkconfig -o /boot/grub2/grub.cfg
3. Reboot the computer.

Tuesday, November 4, 2014

DRBD: Wrong medium type while trying to determine filesystem size

If you encounter the following error when trying to format a DRBD device:
mke2fs 1.41.12 (17-May-2010)  
mkfs.ext4: Wrong medium type while trying to determine filesystem size
The node you are executing the command on is configured as Secondary instead of Primary, verify this by running the following command:
drbdadm role <resource>
If you see:
Secondary/Primary
It means that the node you ran the command on is Secondary, to fix it run the following command on the current node(primary):
drbdadm primary <resource>

Sunday, November 2, 2014

Install MediaWiki on CentOS 6

1. Install the following dependencies:
yum install ImageMagick gd texinfo texinfo-tex texlive httpd php php-xml php-pdo php-intl php-pecl-apc php-pecl-memcache
2. Download the latest version of Mediawiki:
cd /var/www/html
wget http://releases.wikimedia.org/mediawiki/1.23/mediawiki-1.23.6.tar.gz
3. Extract the tar file and change the ownership:
tar xvf mediawiki-1.23.6.tar.gz
mv mediawiki-1.23.6 mediawiki
chown apache:apache -R mediawiki
4. Restart Apache and configure mediawiki using the installation:
service httpd restart
mkdir /var/lib/mediawiki
chown apache:apache -R /var/lib/mediawiki
http:/1.1.1.1/mediawiki (set the SQLite data directory to /var/lib/mediawiki)
5. Use the new LocalSettings.php
cd /root/Downloads/
mv LocalSettings.php /var/www/html/mediawiki

Saturday, November 1, 2014

MediaWiki: blank page when trying to install on CentOS 6

If you encounter a blank page on the installation of MediaWiki, please make sure you've installed the following packages:
yum install php php-xml -y

Install Corosync, Pacemaker and Crmsh on CentOS 6

1. Create a temporary directory to hold a few rpms:
mkdir /tmp/ha
cd /tmp/ha
2. Install Corosync and Pacemaker:
yum install pacemaker corosync -y
3. Download crmsh and pssh:
yum install wget -y 
wget http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/src/crmsh-2.1-1.6.src.rpm 
wget http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/src/pssh-2.3.1-4.1.src.rpm
4. Build the RPMS:
yum install python-devel python-setuptools gcc make gcc-c++ rpm-build python-lxml cluster-glue-libs-devel pacemaker-libs-devel asciidoc autoconf automake redhat-rpm-config -y
rpmbuild --rebuild crmsh-2.1-1.6.src.rpm
rpmbuild --rebuild pssh-2.3.1-4.1.src.rpm
5. Install the newly created RPMS:
yum install /root/rpmbuild/RPMS/x86_64/*