centos

Install yum from centos vault

I had to update an old release of CentOS-5.5 on an OpenVZ container where yum was not available.

The below script should automatically download and install the required rpms from "vault.centos.org".

#!/bin/bash
# install_yum.sh
rpms="
        rpm-libs-4.4.2.3-18.el5.x86_64.rpm
        popt-1.10.2.3-18.el5.x86_64.rpm
    &nbsp;   rpm-4.4.2.3-18.el5.x86_64.rpm<br />    &nbsp;   python-elementtree-1.2.6-5.x86_64.rpm
    &nbsp;   python-iniparse-0.2.3-4.el5.noarch.rpm
    &nbsp;   python-sqlite-1.1.7-1.2.1.x86_64.rpm
    &nbsp;   rpm-python-4.4.2.3-18.el5.x86_64.rpm
    &nbsp;   python-urlgrabber-3.1.0-5.el5.noarch.rpm
    &nbsp;   yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
    &nbsp;   yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
    &nbsp;   yum-3.2.22-26.el5.centos.noarch.rpm
"
for rpm in $rpms
do
rpm -Uvh --nodeps http://vault.centos.org/5.5/os/x86_64/CentOS/${rpm};
done

Install ImageMagick with PHP imagick extension on CentOS-5.8

You can easily install ImageMagick and PHP imagick extension from remi repository. There are some dependencies from epel repository too.

yum --enablerepo=remi,epel install ImageMagick.x86_64 php-pecl-imagick.x86_64

Remote install CentOS-6 on RAID10 using SOFIns boot disk

What if you needed to install Raid10 and CentOS-6 on a remote, unformatted server but had no way of accessing the server? You could try asking someone at the remote location to help you bootstrap the server, but that is not always possible. You could make an onsite visit, but that is undesirable. KVM-over-IP and IPMI are hardware solutions, but are expensive and require network setup.

This tutorial demonstrates how to access a remote, unformatted server in a fast, secure, simple and inexpensive way. It will show how to remotely provision the server with Raid10 and CentOS-6.

We will use a remote access service from SOFIns (www.sofins.com) to boot the remote computer and set up a secure tunnel for ssh and vnc access. We will need someone at the remote location to insert a SOFIns boot disk into this server, attach power and network and then turn it on. That is all they are required to do. We can do the rest remotely.

SOFIns works by booting the remote server with a live Linux operating system. SOFIns creates a VPN tunnel between the remote computer and a SOFIns' gateway. We use the gateway to log into the live Linux operating system that has booted the remote server.

Here are the procedures to set up Raid10 with a CentOS-6 on a remote server that we access via SOFIns.

Remote login via SOFIns gateway

  • Register and login to "sofins.com".
  • Once signed in, enter "SOFIns Controls" and click on the icon "+A" besides "Unassigned" to create a new boot disk agent.
  • Select the checkbox besides the new agent that is created and click on the "Share" button.
  • Enter email address of person to share the agent with and select "Offer assistance" tab and click "OK".
  • This will send out the invite, where the client accepts and downloads the iso and boots the server off of the CD created from the iso.
  • Once the client boots up the remote server, it will show up under the "Targets" page.
  • In The "Targets" page, click on the "Authorize Access" tab to "Enable" access and get the required ssh credentials to log in to the remote server via ssh.
  • Login via ssh to the IP and port specified on the "Access" page.

Install python-2.7 and fabric on CentOS-5.6

Install the required packages first:

# yum install gcc gcc-c++.x86_64 compat-gcc-34-c++.x86_64 openssl-devel.x86_64 zlib*.x86_64

Download and install python-2.7 from source:

$ wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
$ tar -xvzf Python-2.7.2.tgz
$ cd Python-2.7.2
$ ./configure --with-threads --enable-shared
$ make
# make install

Link the shared library:

# echo "/usr/local/lib" >>/etc/ld.so.conf.d/local-lib.conf
# ldconfig

Verify with:

$ which python
$ python -V

Install easy_install:

$ wget http://peak.telecommunity.com/dist/ez_setup.py
# python ez_setup.py

Install fabric via easy_install:

easy_install fabric

To get the location of site-packages for current version of python:

$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

VIM with Ruby support on CentOS-5.5

While trying to get command-t VIM plugin installed I noticed that the default vim-7.0.x installed from CentOS Base repository does not come compiled with ruby support and needed to be upgraded to version 7.2.x:

$ vim --version|grep ruby
+python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent

Notice "-ruby" which states that it is without ruby support.

Once the rpmbuild environment is setup, install the source rpm:

# su - rpmbuild
$ cd ~/rpm/SRPMS/
$ wget http://ftp.redhat.com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/vim-7.2.411-1.6.el6.src.rpm
$ rpm -Uvh --nomd5 ~/rpm/SRPMS/vim-7.2.411-1.6.el6.src.rpm

Edit the vim.spec file, line 496 and remove perl-devel from the requirement list.

BuildRequires: python-devel ncurses-devel gettext perl-devel

Then build rpm binary:

$ rpmbuild -bb ~/rpm/SPEC/vim.spec

Install the rpms via:

# rpm -Uvh ~/rpm/RPMS/x86_64/vim-{m,c,e}*

easy php-fpm install via yum

On CentOS, php-fpm can be easily installed via CentALT yum repository. This requires epel repository too and will pull down any dependencies if needed.

  • Install EPEL release:
    rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
  • Install CentALT release:
    rpm -Uvh http://centos.alt.ru/repository/centos/5/x86_64/centalt-release-5-3.noarch.rpm
  • Install via yum:
    yum --enablerepo=CentALT --enablerepo=epel install php-fpm
  • Look through and edit /etc/php-fpm.conf . The config options are well commented... also available at php-fpm.org
  • The default settings should work quite well.
  • Bring up the service via:
    /etc/init.d/php-fpm start

Upgrade CentOS 5.4 to 5.5 for OpenVZ containers

Edit "/vz/template/centos/5/{ARCH}/config/yum.conf", and change the base and updates repositories as below:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

Do a `vzyum {VEID} clean all`.

List updates:

vzyum {VEID} list updates

Update:

vzyum {VEID} update

Confirm that all VEs' have been updated to 5.5 with:

cat /vz/root/{VEID}/etc/redhat-release

You should see "CentOS release 5.5 (Final)".

Upgrade CentOS 5.3 to 5.4

Below is a clean method of updating, instead of doing a straight `yum update` which I have often done in the past and broken OS.

yum clean all
yum update glibc\*
yum update yum\* rpm\* python\*
yum clean all
yum update
shutdown -r now

My.Cnf File Issue on Linux Dedicated Server Running CentOS

Dear Anyone.

Hello i came across this website doing a search for My.Cnf tweeks or configurations for the SQL_Max_Connections and i was wondering some things. I have a Linux CentOS system with 2.5 gigs of Ram, Running Apache. and PHP. what would be the "proper" My.cnf file settings for a Music Website i keep getting a max connection overload on the network.

Matthew Nalett
New Music Promote
http://www.newmusicpromote.com

Here is my current My.Cnf settings.
Any Suggestions on how to optimize this for a Music Network?


[mysqld]
set-variable=local-infile=0

rpmdb: unable to lock mutex: Invalid argument

I was caught by this when upgrading CentOS servers from 5.2 to 5.3. Should make it a habit to atleast read the release notes!!

When upgrading from an earlier version of Red Hat
Enterprise Linux to 5.3, you may encounter the following
error:

Updating : mypackage ################### [
472/1655]rpmdb: unable to lock mutex: Invalid argument

The cause of the locking issue is that the shared futex
locking in glibc was enhanced with per-process futexes
between 5.2 and 5.3. As a result, programs running against
the 5.2 glibc can not properly perform shared futex locking
against programs running with the 5.3 glibc.

This particular error message is a side effect of a package
calling rpm as part of its install scripts. The rpm
instance performing the upgrade is using the prior glibc
throughout the upgrade, but the rpm instance launched from
within the script is using the new glibc.

To avoid this error, upgrade glibc first in a separate run,
ie

# yum update glibc
# yum update

You will also see this error if you downgrade glibc to an
earlier version on an installed 5.3 system.

Comment