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/*

Friday, October 31, 2014

Install Realtek RTL8188CE on CentOS 6

Since CentOS doesn't have suitable firmware and drivers for Realtek wireless cards, one needs to be installed.
1. Install ELRepo:
yum install http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm -y
2. Install kmod realtek firmware:
yum install *8192ce* -y
3. reboot the machine.

Wednesday, October 29, 2014

Adding directories to man path

To add a custom path to man(say you compiled an application in /usr/local/), all you have to do is edit the following file:
/etc/man.config
And edit the following:
MANPATH /usr/local/ha/share/man
To update the database immediately:
makewhatis -v  /usr/local/ha/share/man

No module named crmsh

If you encounter the following error while trying to compile crmsh:
crmFatal error:No module named crmshNo module named modules 
Failed to start the crm shell! This is likely due toa broken installation or a missing dependency. 
If you are using a packaged version of the crm shell,please try reinstalling the package. Also check yourPYTHONPATH and make sure that the crmsh module isreachable.
Please make sure that:
1. In case you've compiled crms in /usr/local, make sure to link the folders inside:
/usr/local/ha/lib64/python2.6/site-packages/
to
/usr/lib64/python2.6/site-packages/
by using the command:
ln -s /usr/local/ha/lib64/python2.6/site-packages/* /usr/lib64/python2.6/site-packages/
2. Make sure to install the following dependencies:
yum install *lxml* *PyYAML* -y

Yum: removing packages with dependencies

When removing a package using:
yum erase
The dependencies aren't removed automatically and stay in the system even if they are not being used, to fix it add the following to /etc/yum.conf:
clean_requirements_on_remove = 1

Thursday, October 9, 2014

Install OpenBox on FreeBSD 10

1. Check if there are any updates to the OS:
freebsd-update fetch

freebsd-update install
2. Install Xorg and OpenBox:
pkg install xorg openbox tint2
3. Create the following directory inside your home directory:
mkdir ~/.configmkdir ~/.config/openbox 
mkdir ~/.config/tint2
2. Copy OpenBox provided configuration files to the directory:
cp /usr/local/etc/xdg/openbox/menu.xml ~/.config/openbox/menu.xmlcp /usr/local/etc/xdg/openbox/rc.xml ~/.config/openbox/rc.xml
3. Copy Tint2 provided configuration file to the directory:
cp /usr/local/share/examples/tint2/tint2rc ~/.config/tint2
4. Create the following file and give it executable permissions:
touch ~/.config/openbox/autostart.shchmod +x ~/.config/openbox/autostart.sh
5. Echo the following content inside the file:
echo "#!/bin/sh" >> ~/.config/openbox/autostart.sh
6. Configure hal and dbus to start on boot:
echo 'hald_enable="YES"' >> /etc/rc.conf
7. Instruct X to load OpenBox:
echo "exec openbox-session" >> ~/.xinitrc
8. Reboot the computer:
reboot
9. Launch OpenBox and edit Tint2:
startxtint2conf

Wednesday, October 8, 2014

Install Intel compiler on CentOS

To install any Intel compiler, follow these steps:

1. Download the latest version from Intel's Development site(you need to register for an evaluation and then get a link in the mail).

2. Extract the archive:
tar xvf parallel_studio_xe_2015.tgz
3. Install 32Bit libraries:
yum install libstdc*i686 -y
4. Change directory the extracted archive:
cd parallel_studio_xe_2015
5. Launch the GUI installer:
./install_GUI.sh
6. Nothing special to choose from, just the evaluation check box when asked about a serial number(or enter a serial number if you have one).

7. Create the following files in /etc/profile.d/:
vi /etc/profile.d/intel.sh
#!/bin/bashsource /opt/intel/composerxe/bin/compilervars.sh intel64source /opt/intel/impi/5.0.1.035/bin64/mpivars.sh
8. Copy the file and make a c shell version:
cp /etc/profile.d/intel.sh /etc/profile.d/intel.csh
9. Edit it:
vi /etc/profile.d/intel.csh
#!/bin/cshsource /opt/intel/composerxe/bin/compilervars.csh intel64source /opt/intel/impi/5.0.1.035/bin64/mpivars.csh
10. Make both file executable:
chmod +x /etc/profile.d/intel* 
11. Test it using icc -v mpicc -v